aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorSam Ravnborg <sam@mars.ravnborg.org>2004-07-28 03:54:53 +0200
committerSam Ravnborg <sam@mars.ravnborg.org>2004-07-28 03:54:53 +0200
commite321b2ec2eb2993b3d0116e5163c78ad923e3c54 (patch)
tree9c3073b0fdc5766bec7a8e24f6ac5f27bc6e0f36 /Makefile
parent56978bc28161020c87403d6ab3c28798c658daa4 (diff)
downloadhistory-e321b2ec2eb2993b3d0116e5163c78ad923e3c54.tar.gz
kbuild: Create Makefile in output directory if != kernel tree
When building a kernel using the O= syntax to save output files in a separate output directory now create a small Makefile in that same dir. This Makefile allow one to use make in the output directory without the hassle of going back to the kernel source tree. The O= option is added by this Makefile stub. Please note that the Makefile silently overwrite an old one, so changes will be lost if modified. If there is a need to tweak a Makefile in the output directory it is recommended to use the filename 'makefile', which GNU Make will try first. Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile14
1 files changed, 12 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 5a1763e647268..3723c9ef5c3bd 100644
--- a/Makefile
+++ b/Makefile
@@ -631,14 +631,24 @@ $(vmlinux-dirs): prepare-all scripts
# A multi level approach is used. prepare1 is updated first, then prepare0.
# prepare-all is the collection point for the prepare targets.
-.PHONY: prepare-all prepare prepare0 prepare1
+.PHONY: prepare-all prepare prepare0 prepare1 prepare2
+
+# prepare 2 generate Makefile to be placed in output directory, if
+# using a seperate output directory. This allows convinient use
+# of make in output directory
+prepare2:
+ $(Q)if [ ! $(srctree) -ef $(objtree) ]; then \
+ $(CONFIG_SHELL) $(srctree)/scripts/mkmakefile \
+ $(srctree) $(objtree) $(VERSION) $(PATCHLEVEL) \
+ > $(objtree)/Makefile; \
+ fi
# prepare1 is used to check if we are building in a separate output directory,
# and if so do:
# 1) Check that make has not been executed in the kernel src $(srctree)
# 2) Create the include2 directory, used for the second asm symlink
-prepare1:
+prepare1: prepare2
ifneq ($(KBUILD_SRC),)
@echo ' Using $(srctree) as source for kernel'
$(Q)if [ -h $(srctree)/include/asm -o -f $(srctree)/.config ]; then \