From 9c8cdb71644a22c2ffa0a7daa1b54cb6ed718c47 Mon Sep 17 00:00:00 2001 From: Paul Gortmaker Date: Thu, 13 Feb 2014 16:28:58 -0500 Subject: kbuild: unconditionally clobber include/linux/version.h on distclean As of v3.7, the UAPI changes relocated headers around such that the kernel version header lived in a new place. If a person is bisecting and if you go back to pre-UAPI days, you will create an include/linux/version.h -- then if you checkout a post-UAPI kernel, and even run "make distclean" it still won't delete that old version file. So you get a situation like this: $ grep -R LINUX_VERSION_CODE include/ include/generated/uapi/linux/version.h:#define LINUX_VERSION_CODE 200192 include/linux/version.h:#define LINUX_VERSION_CODE 132646 The value in that second line is representative of a v2.6.38 version. And it will be sourced/used, hence leading to strange behaviours, such as drivers/staging content (which typically hasn't been purged of version ifdefs) failing to build. Since it is a subtle mode of failure, lets always clobber the old file when doing a distclean. Signed-off-by: Paul Gortmaker Acked-by: David Howells Signed-off-by: Michal Marek --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 606ef7c4a544..aae58aad01c5 100644 --- a/Makefile +++ b/Makefile @@ -1070,7 +1070,7 @@ MRPROPER_FILES += .config .config.old .version .old_version $(version_h) \ Module.symvers tags TAGS cscope* GPATH GTAGS GRTAGS GSYMS \ signing_key.priv signing_key.x509 x509.genkey \ extra_certificates signing_key.x509.keyid \ - signing_key.x509.signer + signing_key.x509.signer include/linux/version.h # clean - Delete most, but leave enough to build external modules # -- cgit v1.2.3-59-g8ed1b From a03fcb50e816a69acffb13b5e56db75063aeba8a Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Fri, 28 Mar 2014 16:36:12 +0900 Subject: kbuild: remove redundant '.*.cmd' pattern from make distclean '.*.cmd' files are cleaned-up by "make clean". The same pattern in "make distclean" is unnecessary. Signed-off-by: Masahiro Yamada Signed-off-by: Michal Marek --- Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index aae58aad01c5..cea64d277457 100644 --- a/Makefile +++ b/Makefile @@ -1109,8 +1109,7 @@ distclean: mrproper @find $(srctree) $(RCS_FIND_IGNORE) \ \( -name '*.orig' -o -name '*.rej' -o -name '*~' \ -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \ - -o -name '.*.rej' \ - -o -name '*%' -o -name '.*.cmd' -o -name 'core' \) \ + -o -name '.*.rej' -o -name '*%' -o -name 'core' \) \ -type f -print | xargs rm -f -- cgit v1.2.3-59-g8ed1b From 1c9e70a55b088d97a59241744fe459409d0c3582 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Mon, 31 Mar 2014 16:41:36 +0900 Subject: kbuild: create a build directory automatically for out-of-tree build Kbuild supports saving output files in a separate directory. But the build directory must be created beforehand. For example, $ mkdir -p dir/to/store/output/files $ make O=dir/to/store/output/files defconfig Creating a build directory automatically would be useful. Signed-off-by: Masahiro Yamada Acked-by: Sam Ravnborg Signed-off-by: Michal Marek --- Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index cea64d277457..faf55c96ba59 100644 --- a/Makefile +++ b/Makefile @@ -120,9 +120,10 @@ ifneq ($(KBUILD_OUTPUT),) # Invoke a second make in the output directory, passing relevant variables # check that the output directory actually exists saved-output := $(KBUILD_OUTPUT) -KBUILD_OUTPUT := $(shell cd $(KBUILD_OUTPUT) && /bin/pwd) +KBUILD_OUTPUT := $(shell mkdir -p $(KBUILD_OUTPUT) && cd $(KBUILD_OUTPUT) \ + && /bin/pwd) $(if $(KBUILD_OUTPUT),, \ - $(error output directory "$(saved-output)" does not exist)) + $(error failed to create output directory "$(saved-output)")) PHONY += $(MAKECMDGOALS) sub-make -- cgit v1.2.3-59-g8ed1b