Skip to content

Commit 88181ec

Browse files
committed
kbuild: only one call for include/ in make headers_*
Move it to the top-level file to decide if we install/check the generic headers or the arch specific headers. This revealed a long standing bug where "make headers_check_all" relied on the files in asm/ for the current architecture. So make headers_check_all is now broken by this commit. In addition: o add a simpler way to detect if an arch support exporting header files. o add 'set -e;' so we error out early if make headers_check_all fails. o add sparc64 and cris to arch we do not process in make headers_*_all because: sparc64 - use sparc to export headers cris - is know seriously broken Includes suggestions from: David Woodhouse <dwmw2@infradead.org>. Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Cc: David Woodhouse <dwmw2@infradead.org>
1 parent f6ecd4c commit 88181ec

3 files changed

Lines changed: 16 additions & 22 deletions

File tree

‎Makefile‎

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1014,7 +1014,7 @@ firmware_install: FORCE
10141014
#Default location for installed headers
10151015
export INSTALL_HDR_PATH = $(objtree)/usr
10161016

1017-
hdr-filter := generic um ppc
1017+
hdr-filter := generic um ppc sparc64 cris
10181018
hdr-archs := $(filter-out $(hdr-filter), \
10191019
$(patsubst $(srctree)/include/asm-%/Kbuild,%, \
10201020
$(wildcard $(srctree)/include/asm-*/Kbuild)))
@@ -1026,29 +1026,31 @@ __headers: include/linux/version.h scripts_basic FORCE
10261026

10271027
PHONY += headers_install_all
10281028
headers_install_all: __headers
1029+
$(Q)$(MAKE) $(hdr-inst)=include
10291030
$(Q)set -e; for arch in $(hdr-archs); do \
1030-
$(MAKE) ARCH=$$arch SRCARCH=$$arch $(hdr-inst)=include \
1031-
BIASMDIR=-bi-$$arch ;\
1031+
$(MAKE) $(hdr-inst)=include/asm-$$arch \
1032+
SRCARCH=$$arch dst=include/asm-$$arch; \
10321033
done
10331034

10341035
PHONY += headers_install
10351036
headers_install: __headers
1036-
$(Q)if [ ! -r $(srctree)/include/asm-$(SRCARCH)/Kbuild ]; then \
1037-
echo '*** Error: Headers not exportable for this architecture ($(SRCARCH))'; \
1038-
exit 1 ; \
1039-
fi
1040-
$(Q)$(MAKE) $(hdr-inst)=include ARCH=$(SRCARCH)
1037+
$(if $(wildcard $(srctree)/include/asm-$(SRCARCH)/Kbuild),, \
1038+
$(error Headers not exportable for this architecture ($(SRCARCH))))
1039+
$(Q)$(MAKE) $(hdr-inst)=include
1040+
$(Q)$(MAKE) $(hdr-inst)=include/asm-$(SRCARCH) dst=include/asm
10411041

10421042
PHONY += headers_check_all
10431043
headers_check_all: headers_install_all
1044+
$(Q)$(MAKE) $(hdr-inst)=include HDRCHECK=1
10441045
$(Q)set -e; for arch in $(hdr-archs); do \
1045-
$(MAKE) ARCH=$$arch SRCARCH=$$arch $(hdr-inst)=include \
1046-
BIASMDIR=-bi-$$arch HDRCHECK=1 ;\
1046+
$(MAKE) SRCARCH=$$arch $(hdr-inst)=include/asm-$$arch HDRCHECK=1 ;\
10471047
done
10481048

10491049
PHONY += headers_check
10501050
headers_check: headers_install
1051-
$(Q)$(MAKE) $(hdr-inst)=include ARCH=$(SRCARCH) HDRCHECK=1
1051+
$(Q)$(MAKE) $(hdr-inst)=include HDRCHECK=1
1052+
$(Q)$(MAKE) $(hdr-inst)=include/asm-$(SRCARCH) \
1053+
dst=include/asm HDRCHECK=1
10521054

10531055
# ---------------------------------------------------------------------------
10541056
# Modules

‎include/Kbuild‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
# Top-level Makefile calls into asm-$(ARCH)
2+
# List only non-arch directories below
3+
14
header-y += asm-generic/
25
header-y += linux/
36
header-y += sound/
47
header-y += mtd/
58
header-y += rdma/
69
header-y += video/
710
header-y += drm/
8-
9-
header-y += asm-$(ARCH)/

‎scripts/Makefile.headersinst‎

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,6 @@ include $(kbuild-file)
2828

2929
include scripts/Kbuild.include
3030

31-
# If this is include/asm-$(ARCH) then override $(_dst) so that
32-
# we install to include/asm directly.
33-
# Unless $(BIASMDIR) is set, in which case we're probably doing
34-
# a 'headers_install_all' build and we should keep the -$(ARCH)
35-
# in the directory name.
36-
ifeq ($(obj),include/asm-$(ARCH)$(BIASMDIR))
37-
_dst := include/asm
38-
endif
39-
4031
install := $(INSTALL_HDR_PATH)/$(_dst)
4132

4233
header-y := $(sort $(header-y) $(unifdef-y))

0 commit comments

Comments
 (0)