Skip to content

Commit

Permalink
kbuild: only one call for include/ in make headers_*
Browse files Browse the repository at this point in the history
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
<[email protected]>.

Signed-off-by: Sam Ravnborg <[email protected]>
Cc: David Woodhouse <[email protected]>
  • Loading branch information
sravnborg committed Jul 25, 2008
1 parent f6ecd4c commit 88181ec
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 22 deletions.
24 changes: 13 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -1014,7 +1014,7 @@ firmware_install: FORCE
#Default location for installed headers
export INSTALL_HDR_PATH = $(objtree)/usr

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

PHONY += headers_install_all
headers_install_all: __headers
$(Q)$(MAKE) $(hdr-inst)=include
$(Q)set -e; for arch in $(hdr-archs); do \
$(MAKE) ARCH=$$arch SRCARCH=$$arch $(hdr-inst)=include \
BIASMDIR=-bi-$$arch ;\
$(MAKE) $(hdr-inst)=include/asm-$$arch \
SRCARCH=$$arch dst=include/asm-$$arch; \
done

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

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

PHONY += headers_check
headers_check: headers_install
$(Q)$(MAKE) $(hdr-inst)=include ARCH=$(SRCARCH) HDRCHECK=1
$(Q)$(MAKE) $(hdr-inst)=include HDRCHECK=1
$(Q)$(MAKE) $(hdr-inst)=include/asm-$(SRCARCH) \
dst=include/asm HDRCHECK=1

# ---------------------------------------------------------------------------
# Modules
Expand Down
5 changes: 3 additions & 2 deletions include/Kbuild
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Top-level Makefile calls into asm-$(ARCH)
# List only non-arch directories below

header-y += asm-generic/
header-y += linux/
header-y += sound/
header-y += mtd/
header-y += rdma/
header-y += video/
header-y += drm/

header-y += asm-$(ARCH)/
9 changes: 0 additions & 9 deletions scripts/Makefile.headersinst
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,6 @@ include $(kbuild-file)

include scripts/Kbuild.include

# If this is include/asm-$(ARCH) then override $(_dst) so that
# we install to include/asm directly.
# Unless $(BIASMDIR) is set, in which case we're probably doing
# a 'headers_install_all' build and we should keep the -$(ARCH)
# in the directory name.
ifeq ($(obj),include/asm-$(ARCH)$(BIASMDIR))
_dst := include/asm
endif

install := $(INSTALL_HDR_PATH)/$(_dst)

header-y := $(sort $(header-y) $(unifdef-y))
Expand Down

0 comments on commit 88181ec

Please sign in to comment.