aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-12-10 13:17:07 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-12-10 13:17:07 -0500
commitdc3d532a1792263ec9b26c1cbc7ce566056b5b1f (patch)
tree37592af93655cf34c9099761bfdcf52fc306d309
parentaf1bff4f1d117f99ad8a88e6532baff475fb44a5 (diff)
parent18c32dac75b187d1a4e858f3cfdf03e844129f5e (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/sam/fix-kbuild
* git://git.kernel.org/pub/scm/linux/kernel/git/sam/fix-kbuild: kbuild: fix building with O=.. options kbuild: fix building with redirected output.
-rw-r--r--Makefile14
-rw-r--r--scripts/mkmakefile6
2 files changed, 12 insertions, 8 deletions
diff --git a/Makefile b/Makefile
index 92dc3cb5f43d..7fb1a2c08305 100644
--- a/Makefile
+++ b/Makefile
@@ -108,6 +108,9 @@ endif
108PHONY := _all 108PHONY := _all
109_all: 109_all:
110 110
111# Cancel implicit rules on top Makefile
112$(CURDIR)/Makefile Makefile: ;
113
111ifneq ($(KBUILD_OUTPUT),) 114ifneq ($(KBUILD_OUTPUT),)
112# Invoke a second make in the output directory, passing relevant variables 115# Invoke a second make in the output directory, passing relevant variables
113# check that the output directory actually exists 116# check that the output directory actually exists
@@ -115,13 +118,10 @@ saved-output := $(KBUILD_OUTPUT)
115KBUILD_OUTPUT := $(shell cd $(KBUILD_OUTPUT) && /bin/pwd) 118KBUILD_OUTPUT := $(shell cd $(KBUILD_OUTPUT) && /bin/pwd)
116$(if $(KBUILD_OUTPUT),, \ 119$(if $(KBUILD_OUTPUT),, \
117 $(error output directory "$(saved-output)" does not exist)) 120 $(error output directory "$(saved-output)" does not exist))
118# Check that OUTPUT directory is not the same as where we have kernel src
119$(if $(filter-out $(KBUILD_OUTPUT),$(shell /bin/pwd)),, \
120 $(error Output directory (O=...) specifies kernel src dir))
121 121
122PHONY += $(MAKECMDGOALS) sub-make 122PHONY += $(MAKECMDGOALS) sub-make
123 123
124$(filter-out _all sub-make,$(MAKECMDGOALS)) _all: sub-make 124$(filter-out _all sub-make $(CURDIR)/Makefile, $(MAKECMDGOALS)) _all: sub-make
125 $(Q)@: 125 $(Q)@:
126 126
127sub-make: FORCE 127sub-make: FORCE
@@ -291,7 +291,8 @@ export quiet Q KBUILD_VERBOSE
291# Look for make include files relative to root of kernel src 291# Look for make include files relative to root of kernel src
292MAKEFLAGS += --include-dir=$(srctree) 292MAKEFLAGS += --include-dir=$(srctree)
293 293
294# We need some generic definitions. 294# We need some generic definitions (do not try to remake the file).
295$(srctree)/scripts/Kbuild.include: ;
295include $(srctree)/scripts/Kbuild.include 296include $(srctree)/scripts/Kbuild.include
296 297
297# Make variables (CC, etc...) 298# Make variables (CC, etc...)
@@ -1560,9 +1561,6 @@ endif # skip-makefile
1560PHONY += FORCE 1561PHONY += FORCE
1561FORCE: 1562FORCE:
1562 1563
1563# Cancel implicit rules on top Makefile, `-rR' will apply to sub-makes.
1564Makefile: ;
1565
1566# Declare the contents of the .PHONY variable as phony. We keep that 1564# Declare the contents of the .PHONY variable as phony. We keep that
1567# information in a variable se we can use it in if_changed and friends. 1565# information in a variable se we can use it in if_changed and friends.
1568.PHONY: $(PHONY) 1566.PHONY: $(PHONY)
diff --git a/scripts/mkmakefile b/scripts/mkmakefile
index ee39facee152..9ad1bd793252 100644
--- a/scripts/mkmakefile
+++ b/scripts/mkmakefile
@@ -11,6 +11,12 @@
11 11
12 12
13test ! -r $2/Makefile -o -O $2/Makefile || exit 0 13test ! -r $2/Makefile -o -O $2/Makefile || exit 0
14# Only overwrite automatically generated Makefiles
15# (so we do not overwrite kernel Makefile)
16if ! grep -q Automatically $2/Makefile
17then
18 exit 0
19fi
14echo " GEN $2/Makefile" 20echo " GEN $2/Makefile"
15 21
16cat << EOF > $2/Makefile 22cat << EOF > $2/Makefile