mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sam Ravnborg <sam@ravnborg.org>
To: Jan Engelhardt <jengelh@computergmbh.de>
Cc: zippel@linux-m68k.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: Unfortunate infinite make recursion
Date: Sat, 22 Sep 2007 22:52:16 +0200	[thread overview]
Message-ID: <20070922205216.GB31873@uranus.ravnborg.org> (raw)
In-Reply-To: <Pine.LNX.4.64.0709221319440.15712@fbirervta.pbzchgretzou.qr>

On Sat, Sep 22, 2007 at 01:24:32PM +0200, Jan Engelhardt wrote:
> Hi,
> 
> 
> You can cause a recursion in kbuild/make with the following:
> 
> make O=$PWD kernel/time.o
> make mrproper
> 
> Of course no one would use O=$PWD (that's just the testcase),
> but this happened too often:
> 
> /ws/linux/linux-2.6.23$ make O=/ws/linux/linux-2.6.23 kernel/time.o
> (Oops - should have been O=/ws/linux/obj-2.6.23!)
> 
> The make O=$PWD truncates the Makefile, making it necessary to run `git 
> checkout Makefile` - should you have git; or reextract the tarball 
> (should you /still/ have it). Well, can we catch this case somehow?

Does the following patch fix it at your end?
Seems to work for me.

	Sam

diff --git a/Makefile b/Makefile
index 6708e41..f787b05 100644
--- a/Makefile
+++ b/Makefile
@@ -115,7 +115,9 @@ saved-output := $(KBUILD_OUTPUT)
 KBUILD_OUTPUT := $(shell cd $(KBUILD_OUTPUT) && /bin/pwd)
 $(if $(KBUILD_OUTPUT),, \
      $(error output directory "$(saved-output)" does not exist))
-
+# Check the OUTPUT directory is not the same as where we have kernel src
+$(if $(filter-out $(KBUILD_OUTPUT),$(shell /bin/pwd)),, \
+     $(error Output directory (O=...) specify kernel src dir))
 PHONY += $(MAKECMDGOALS)
 
 $(filter-out _all,$(MAKECMDGOALS)) _all:


  parent reply	other threads:[~2007-09-22 20:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-22 11:24 Jan Engelhardt
2007-09-22 15:42 ` Oleg Verych
2007-09-22 20:40   ` Sam Ravnborg
2007-09-22 22:23     ` Oleg Verych
2007-09-23  6:03       ` Sam Ravnborg
2007-09-23  7:37         ` Oleg Verych
2007-09-22 20:52 ` Sam Ravnborg [this message]
2007-09-23  6:17   ` Jan Engelhardt
     [not found] <96blF-29e-27@gated-at.bofh.it>
2007-09-22 21:19 ` Bodo Eggert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070922205216.GB31873@uranus.ravnborg.org \
    --to=sam@ravnborg.org \
    --cc=jengelh@computergmbh.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=zippel@linux-m68k.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®