From 371fdc77af44f4cb32475fd499e1d912ccc30890 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Wed, 26 Nov 2014 19:31:13 +0900 Subject: kbuild: collect shorthands into scripts/Kbuild.include The shorthand "clean" is defined in both the top Makefile and scripts/Makefile.clean. Likewise, the "hdr-inst" is defined in both the top Makefile and scripts/Makefile.headersinst. To reduce code duplication, this commit collects them into scripts/Kbuild.include like the "build" and "modbuiltin" shorthands. It requires scripts/Makefile.clean to include scripts/Kbuild.include, but its impact on the performance of "make clean" should be negligible. Signed-off-by: Masahiro Yamada Signed-off-by: Michal Marek --- Makefile | 7 ------- scripts/Kbuild.include | 12 ++++++++++++ scripts/Makefile.clean | 5 +---- scripts/Makefile.headersinst | 1 - 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 05d67af376c5..0032d1ca4e49 100644 --- a/Makefile +++ b/Makefile @@ -1035,8 +1035,6 @@ firmware_install: FORCE #Default location for installed headers export INSTALL_HDR_PATH = $(objtree)/usr -hdr-inst := -rR -f $(srctree)/scripts/Makefile.headersinst obj - # If we do an all arch process set dst to asm-$(hdr-arch) hdr-dst = $(if $(KBUILD_HEADERS), dst=include/asm-$(hdr-arch), dst=include/asm) @@ -1580,11 +1578,6 @@ ifneq ($(cmd_files),) include $(cmd_files) endif -# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.clean obj=dir -# Usage: -# $(Q)$(MAKE) $(clean)=dir -clean := -f $(srctree)/scripts/Makefile.clean obj - endif # skip-makefile PHONY += FORCE diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index 65e7b08bb2cc..0f909814edfc 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -179,6 +179,18 @@ build := -f $(srctree)/scripts/Makefile.build obj # $(Q)$(MAKE) $(modbuiltin)=dir modbuiltin := -f $(srctree)/scripts/Makefile.modbuiltin obj +### +# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.clean obj= +# Usage: +# $(Q)$(MAKE) $(clean)=dir +clean := -f $(srctree)/scripts/Makefile.clean obj + +### +# Shorthand for $(Q)$(MAKE) -rR -f scripts/Makefile.headersinst obj= +# Usage: +# $(Q)$(MAKE) $(hdr-inst)=dir +hdr-inst := -rR -f $(srctree)/scripts/Makefile.headersinst obj + # Prefix -I with $(srctree) if it is not an absolute path. # skip if -I has no parameter addtree = $(if $(patsubst -I%,%,$(1)), \ diff --git a/scripts/Makefile.clean b/scripts/Makefile.clean index b1c668dc6815..0aa91a07d968 100644 --- a/scripts/Makefile.clean +++ b/scripts/Makefile.clean @@ -7,10 +7,7 @@ src := $(obj) PHONY := __clean __clean: -# Shorthand for $(Q)$(MAKE) scripts/Makefile.clean obj=dir -# Usage: -# $(Q)$(MAKE) $(clean)=dir -clean := -f $(srctree)/scripts/Makefile.clean obj +include scripts/Kbuild.include # The filename Kbuild has precedence over Makefile kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src)) diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst index 8ccf83056a7a..1106d6ca3a38 100644 --- a/scripts/Makefile.headersinst +++ b/scripts/Makefile.headersinst @@ -122,7 +122,6 @@ $(check-file): scripts/headers_check.pl $(output-files) FORCE endif # Recursion -hdr-inst := -rR -f $(srctree)/scripts/Makefile.headersinst obj .PHONY: $(subdirs) $(subdirs): $(Q)$(MAKE) $(hdr-inst)=$(obj)/$@ dst=$(_dst)/$@ -- cgit v1.2.3 From a29b82326ed4eb5567b03c85b52c6891578d5a03 Mon Sep 17 00:00:00 2001 From: Michal Marek Date: Wed, 26 Nov 2014 15:09:24 +0100 Subject: kbuild: Remove duplicate $(cmd) definition in Makefile.clean Makefile.clean includes Kbuild.include since commit 371fdc77 (kbuild: collect shorthands into scripts/Kbuild.include), so there is no need for a local copy. Signed-off-by: Michal Marek --- scripts/Makefile.clean | 5 ----- 1 file changed, 5 deletions(-) diff --git a/scripts/Makefile.clean b/scripts/Makefile.clean index 0aa91a07d968..1bca180db8ad 100644 --- a/scripts/Makefile.clean +++ b/scripts/Makefile.clean @@ -88,11 +88,6 @@ PHONY += $(subdir-ymn) $(subdir-ymn): $(Q)$(MAKE) $(clean)=$@ -# If quiet is set, only print short version of command - -cmd = @$(if $($(quiet)cmd_$(1)),echo ' $($(quiet)cmd_$(1))' &&) $(cmd_$(1)) - - # Declare the contents of the .PHONY variable as phony. We keep that # information in a variable se we can use it in if_changed and friends. -- cgit v1.2.3 From a1e7b7bb1ab5bf3498eacc2d22beb56dac1d4e08 Mon Sep 17 00:00:00 2001 From: Konstantin Khlebnikov Date: Tue, 28 Oct 2014 17:18:20 +0400 Subject: Makefile: sort list of defconfig targets in make help output Without sorting this list is completely unreadable for ARCH=arm. Signed-off-by: Konstantin Khlebnikov Signed-off-by: Michal Marek --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 0032d1ca4e49..88b7fa50f619 100644 --- a/Makefile +++ b/Makefile @@ -1232,7 +1232,7 @@ rpm: include/config/kernel.release FORCE # --------------------------------------------------------------------------- boards := $(wildcard $(srctree)/arch/$(SRCARCH)/configs/*_defconfig) -boards := $(notdir $(boards)) +boards := $(sort $(notdir $(boards))) board-dirs := $(dir $(wildcard $(srctree)/arch/$(SRCARCH)/configs/*/*_defconfig)) board-dirs := $(sort $(notdir $(board-dirs:/=))) -- cgit v1.2.3 From 2d560306096739e2251329ab5c16059311a151b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20K=C3=BCmmel?= Date: Tue, 4 Nov 2014 12:01:59 +0100 Subject: =?UTF-8?q?kconfig:=20Fix=20warning=20"=E2=80=98jump=E2=80=99=20ma?= =?UTF-8?q?y=20be=20used=20uninitialized"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Warning: In file included from scripts/kconfig/zconf.tab.c:2537:0: scripts/kconfig/menu.c: In function ‘get_symbol_str’: scripts/kconfig/menu.c:590:18: warning: ‘jump’ may be used uninitialized in this function [-Wmaybe-uninitialized] jump->offset = strlen(r->s); Simplifies the test logic because (head && local) means (jump != 0) and makes GCC happy when checking if the jump pointer was initialized. Signed-off-by: Peter Kümmel Signed-off-by: Michal Marek --- scripts/kconfig/menu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c index a26cc5d2a9b0..72c9dba84c5d 100644 --- a/scripts/kconfig/menu.c +++ b/scripts/kconfig/menu.c @@ -548,7 +548,7 @@ static void get_prompt_str(struct gstr *r, struct property *prop, { int i, j; struct menu *submenu[8], *menu, *location = NULL; - struct jump_key *jump; + struct jump_key *jump = NULL; str_printf(r, _("Prompt: %s\n"), _(prop->text)); menu = prop->menu->parent; @@ -586,7 +586,7 @@ static void get_prompt_str(struct gstr *r, struct property *prop, str_printf(r, _(" Location:\n")); for (j = 4; --i >= 0; j += 2) { menu = submenu[i]; - if (head && location && menu == location) + if (jump && menu == location) jump->offset = strlen(r->s); str_printf(r, "%*c-> %s", j, ' ', _(menu_get_prompt(menu))); -- cgit v1.2.3 From 223c24a7dba9db1f5ec2ae501b7d342396e83a9a Mon Sep 17 00:00:00 2001 From: Michal Marek Date: Thu, 27 Nov 2014 16:13:17 +0100 Subject: kbuild: Automatically remove stale file In 3.7, the file moved from include/linux/ to include/generated/uapi/linux/. The path in the #include directive remained the same for compatibility reasons, but this created a problem when bisecting. Commit 9c8cdb71 (kbuild: unconditionally clobber include/linux/version.h on distclean) fixes this, provided the user does make distclean between builds. Better not rely on the user and delete the stale file each time make is invoked. Cc: Paul Gortmaker Cc: David Howells Signed-off-by: Michal Marek --- Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 88b7fa50f619..107eb9ed648f 100644 --- a/Makefile +++ b/Makefile @@ -480,6 +480,7 @@ asm-generic: # of make so .config is not included in this case either (for *config). version_h := include/generated/uapi/linux/version.h +old_version_h := include/linux/version.h no-dot-config-targets := clean mrproper distclean \ cscope gtags TAGS tags help %docs check% coccicheck \ @@ -1004,6 +1005,7 @@ endef $(version_h): $(srctree)/Makefile FORCE $(call filechk,version.h) + $(Q)rm -f $(old_version_h) include/generated/utsrelease.h: include/config/kernel.release FORCE $(call filechk,utsrelease.h) @@ -1172,7 +1174,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 include/linux/version.h + signing_key.x509.signer # clean - Delete most, but leave enough to build external modules # -- cgit v1.2.3 From fbae4d585e5a61792f16b6d5a6305d61df01b4a6 Mon Sep 17 00:00:00 2001 From: Michal Marek Date: Fri, 28 Nov 2014 13:31:43 +0100 Subject: kbuild: Fix make help- on powerpc make ARCH=powerpc help- should not require a cofigured source tree. Also, sort the boards in the output. Signed-off-by: Michal Marek --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 107eb9ed648f..b9fb496e64ba 100644 --- a/Makefile +++ b/Makefile @@ -483,7 +483,7 @@ version_h := include/generated/uapi/linux/version.h old_version_h := include/linux/version.h no-dot-config-targets := clean mrproper distclean \ - cscope gtags TAGS tags help %docs check% coccicheck \ + cscope gtags TAGS tags help% %docs check% coccicheck \ $(version_h) headers_% archheaders archscripts \ kernelversion %src-pkg @@ -1325,7 +1325,7 @@ help-board-dirs := $(addprefix help-,$(board-dirs)) help-boards: $(help-board-dirs) -boards-per-dir = $(notdir $(wildcard $(srctree)/arch/$(SRCARCH)/configs/$*/*_defconfig)) +boards-per-dir = $(sort $(notdir $(wildcard $(srctree)/arch/$(SRCARCH)/configs/$*/*_defconfig))) $(help-board-dirs): help-%: @echo 'Architecture specific targets ($(SRCARCH) $*):' -- cgit v1.2.3 From 1846dfbde3e8a53f3673dcb1c1b79fd9b3f8d40d Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Tue, 2 Dec 2014 13:30:46 +0900 Subject: kbuild: remove redundant -rR flag of hdr-inst Passing -rR for "make headers_install" is redundant because the top Makefile has already set -rR to MAKEFLAGS. Signed-off-by: Masahiro Yamada Signed-off-by: Michal Marek --- scripts/Kbuild.include | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index 0f909814edfc..353dcf09dd18 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -186,10 +186,10 @@ modbuiltin := -f $(srctree)/scripts/Makefile.modbuiltin obj clean := -f $(srctree)/scripts/Makefile.clean obj ### -# Shorthand for $(Q)$(MAKE) -rR -f scripts/Makefile.headersinst obj= +# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.headersinst obj= # Usage: # $(Q)$(MAKE) $(hdr-inst)=dir -hdr-inst := -rR -f $(srctree)/scripts/Makefile.headersinst obj +hdr-inst := -f $(srctree)/scripts/Makefile.headersinst obj # Prefix -I with $(srctree) if it is not an absolute path. # skip if -I has no parameter -- cgit v1.2.3