Skip to content

Commit e6883b1

Browse files
committed
kbuild: refactor headers_* targets in Makefile
o Use lower case for local variables o Add a helper target for common targets o Use $(hdr-inst)= ... to make Make invocations simpler o Add -rR to make invocations In total this adds more lines than it removes but the benefit is better readability Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Cc: David Woodhouse <dwmw2@infradead.org>
1 parent 5047887 commit e6883b1

1 file changed

Lines changed: 23 additions & 16 deletions

File tree

‎Makefile‎

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,36 +1010,43 @@ firmware_install: FORCE
10101010

10111011
# ---------------------------------------------------------------------------
10121012
# Kernel headers
1013-
INSTALL_HDR_PATH=$(objtree)/usr
1014-
export INSTALL_HDR_PATH
10151013

1016-
HDRFILTER=generic i386 x86_64
1017-
HDRARCHES=$(filter-out $(HDRFILTER),$(patsubst $(srctree)/include/asm-%/Kbuild,%,$(wildcard $(srctree)/include/asm-*/Kbuild)))
1014+
#Default location for installed headers
1015+
export INSTALL_HDR_PATH = $(objtree)/usr
10181016

1019-
PHONY += headers_install_all
1020-
headers_install_all: include/linux/version.h scripts_basic FORCE
1017+
hdr-filter := generic um ppc
1018+
hdr-archs := $(filter-out $(hdr-filter), \
1019+
$(patsubst $(srctree)/include/asm-%/Kbuild,%, \
1020+
$(wildcard $(srctree)/include/asm-*/Kbuild)))
1021+
hdr-inst := -rR -f $(srctree)/scripts/Makefile.headersinst obj
1022+
1023+
PHONY += __headers
1024+
__headers: include/linux/version.h scripts_basic FORCE
10211025
$(Q)$(MAKE) $(build)=scripts scripts/unifdef
1022-
$(Q)for arch in $(HDRARCHES); do \
1023-
$(MAKE) ARCH=$$arch -f $(srctree)/scripts/Makefile.headersinst obj=include BIASMDIR=-bi-$$arch ;\
1026+
1027+
PHONY += headers_install_all
1028+
headers_install_all: __headers
1029+
$(Q)for arch in $(hdr-archs); do \
1030+
$(MAKE) ARCH=$$arch $(hdr-inst)=include BIASMDIR=-bi-$$arch ;\
10241031
done
10251032

10261033
PHONY += headers_install
1027-
headers_install: include/linux/version.h scripts_basic FORCE
1028-
@if [ ! -r $(srctree)/include/asm-$(SRCARCH)/Kbuild ]; then \
1034+
headers_install: __headers
1035+
$(Q)if [ ! -r $(srctree)/include/asm-$(SRCARCH)/Kbuild ]; then \
10291036
echo '*** Error: Headers not exportable for this architecture ($(SRCARCH))'; \
1030-
exit 1 ; fi
1031-
$(Q)$(MAKE) $(build)=scripts scripts/unifdef
1032-
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.headersinst ARCH=$(SRCARCH) obj=include
1037+
exit 1 ; \
1038+
fi
1039+
$(Q)$(MAKE) $(hdr-inst)=include ARCH=$(SRCARCH)
10331040

10341041
PHONY += headers_check_all
10351042
headers_check_all: headers_install_all
1036-
$(Q)for arch in $(HDRARCHES); do \
1037-
$(MAKE) ARCH=$$arch -f $(srctree)/scripts/Makefile.headersinst obj=include BIASMDIR=-bi-$$arch HDRCHECK=1 ;\
1043+
$(Q)for arch in $(hdr-archs); do \
1044+
$(MAKE) ARCH=$$arch $(hdr-inst)=include BIASMDIR=-bi-$$arch HDRCHECK=1 ;\
10381045
done
10391046

10401047
PHONY += headers_check
10411048
headers_check: headers_install
1042-
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.headersinst ARCH=$(SRCARCH) obj=include HDRCHECK=1
1049+
$(Q)$(MAKE) $(hdr-inst)=include ARCH=$(SRCARCH) HDRCHECK=1
10431050

10441051
# ---------------------------------------------------------------------------
10451052
# Modules

0 commit comments

Comments
 (0)