diff options
author | Masahiro Yamada <yamada.m@jp.panasonic.com> | 2014-11-26 05:31:13 -0500 |
---|---|---|
committer | Michal Marek <mmarek@suse.cz> | 2014-11-26 08:36:52 -0500 |
commit | 371fdc77af44f4cb32475fd499e1d912ccc30890 (patch) | |
tree | ce9ed2d9ad910157faf8a990e40520bc278f36cc | |
parent | f114040e3ea6e07372334ade75d1ee0775c355e1 (diff) |
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 <yamada.m@jp.panasonic.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
-rw-r--r-- | Makefile | 7 | ||||
-rw-r--r-- | scripts/Kbuild.include | 12 | ||||
-rw-r--r-- | scripts/Makefile.clean | 5 | ||||
-rw-r--r-- | scripts/Makefile.headersinst | 1 |
4 files changed, 13 insertions, 12 deletions
@@ -1035,8 +1035,6 @@ firmware_install: FORCE | |||
1035 | #Default location for installed headers | 1035 | #Default location for installed headers |
1036 | export INSTALL_HDR_PATH = $(objtree)/usr | 1036 | export INSTALL_HDR_PATH = $(objtree)/usr |
1037 | 1037 | ||
1038 | hdr-inst := -rR -f $(srctree)/scripts/Makefile.headersinst obj | ||
1039 | |||
1040 | # If we do an all arch process set dst to asm-$(hdr-arch) | 1038 | # If we do an all arch process set dst to asm-$(hdr-arch) |
1041 | hdr-dst = $(if $(KBUILD_HEADERS), dst=include/asm-$(hdr-arch), dst=include/asm) | 1039 | hdr-dst = $(if $(KBUILD_HEADERS), dst=include/asm-$(hdr-arch), dst=include/asm) |
1042 | 1040 | ||
@@ -1580,11 +1578,6 @@ ifneq ($(cmd_files),) | |||
1580 | include $(cmd_files) | 1578 | include $(cmd_files) |
1581 | endif | 1579 | endif |
1582 | 1580 | ||
1583 | # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.clean obj=dir | ||
1584 | # Usage: | ||
1585 | # $(Q)$(MAKE) $(clean)=dir | ||
1586 | clean := -f $(srctree)/scripts/Makefile.clean obj | ||
1587 | |||
1588 | endif # skip-makefile | 1581 | endif # skip-makefile |
1589 | 1582 | ||
1590 | PHONY += FORCE | 1583 | 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 | |||
179 | # $(Q)$(MAKE) $(modbuiltin)=dir | 179 | # $(Q)$(MAKE) $(modbuiltin)=dir |
180 | modbuiltin := -f $(srctree)/scripts/Makefile.modbuiltin obj | 180 | modbuiltin := -f $(srctree)/scripts/Makefile.modbuiltin obj |
181 | 181 | ||
182 | ### | ||
183 | # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.clean obj= | ||
184 | # Usage: | ||
185 | # $(Q)$(MAKE) $(clean)=dir | ||
186 | clean := -f $(srctree)/scripts/Makefile.clean obj | ||
187 | |||
188 | ### | ||
189 | # Shorthand for $(Q)$(MAKE) -rR -f scripts/Makefile.headersinst obj= | ||
190 | # Usage: | ||
191 | # $(Q)$(MAKE) $(hdr-inst)=dir | ||
192 | hdr-inst := -rR -f $(srctree)/scripts/Makefile.headersinst obj | ||
193 | |||
182 | # Prefix -I with $(srctree) if it is not an absolute path. | 194 | # Prefix -I with $(srctree) if it is not an absolute path. |
183 | # skip if -I has no parameter | 195 | # skip if -I has no parameter |
184 | addtree = $(if $(patsubst -I%,%,$(1)), \ | 196 | 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) | |||
7 | PHONY := __clean | 7 | PHONY := __clean |
8 | __clean: | 8 | __clean: |
9 | 9 | ||
10 | # Shorthand for $(Q)$(MAKE) scripts/Makefile.clean obj=dir | 10 | include scripts/Kbuild.include |
11 | # Usage: | ||
12 | # $(Q)$(MAKE) $(clean)=dir | ||
13 | clean := -f $(srctree)/scripts/Makefile.clean obj | ||
14 | 11 | ||
15 | # The filename Kbuild has precedence over Makefile | 12 | # The filename Kbuild has precedence over Makefile |
16 | kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src)) | 13 | 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 | |||
122 | endif | 122 | endif |
123 | 123 | ||
124 | # Recursion | 124 | # Recursion |
125 | hdr-inst := -rR -f $(srctree)/scripts/Makefile.headersinst obj | ||
126 | .PHONY: $(subdirs) | 125 | .PHONY: $(subdirs) |
127 | $(subdirs): | 126 | $(subdirs): |
128 | $(Q)$(MAKE) $(hdr-inst)=$(obj)/$@ dst=$(_dst)/$@ | 127 | $(Q)$(MAKE) $(hdr-inst)=$(obj)/$@ dst=$(_dst)/$@ |