aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSam Ravnborg <sam@ravnborg.org>2008-06-20 18:24:17 -0400
committerSam Ravnborg <sam@ravnborg.org>2008-07-25 16:12:33 -0400
commit2fb9b1bd9dd7f4455407dc1bec74fb8ae0d3138e (patch)
tree28560746a2788549198dcb7ce3588cb7297c6593
parentdb1bec4f5271d7799d481cd4d95fdc268bdd7614 (diff)
kbuild: prepare headers_* for arch/$ARCH/include
Factor out the headers_*_all support to a seperate shell script and add support for arch specific header files can be located in either arch/$ARCH/include/asm or include/asm-$ARCH/ In "make help" always display the headers_* targets. Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
-rw-r--r--Makefile49
-rwxr-xr-xscripts/headers.sh41
2 files changed, 63 insertions, 27 deletions
diff --git a/Makefile b/Makefile
index 3f0a3ca5be8f..c5ab2b8a138a 100644
--- a/Makefile
+++ b/Makefile
@@ -205,6 +205,9 @@ ifeq ($(ARCH),x86_64)
205 SRCARCH := x86 205 SRCARCH := x86
206endif 206endif
207 207
208# Where to locate arch specific headers
209hdr-arch := $(SRCARCH)
210
208KCONFIG_CONFIG ?= .config 211KCONFIG_CONFIG ?= .config
209 212
210# SHELL used by kbuild 213# SHELL used by kbuild
@@ -1014,43 +1017,39 @@ firmware_install: FORCE
1014#Default location for installed headers 1017#Default location for installed headers
1015export INSTALL_HDR_PATH = $(objtree)/usr 1018export INSTALL_HDR_PATH = $(objtree)/usr
1016 1019
1017hdr-filter := generic um ppc sparc64 cris
1018hdr-archs := $(filter-out $(hdr-filter), \
1019 $(patsubst $(srctree)/include/asm-%/Kbuild,%, \
1020 $(wildcard $(srctree)/include/asm-*/Kbuild)))
1021hdr-inst := -rR -f $(srctree)/scripts/Makefile.headersinst obj 1020hdr-inst := -rR -f $(srctree)/scripts/Makefile.headersinst obj
1021# Find out where the Kbuild file is located to support
1022# arch/$(ARCH)/include/asm
1023hdr-dir = $(strip \
1024 $(if $(wildcard $(srctree)/arch/$(hdr-arch)/include/asm/Kbuild), \
1025 arch/$(hdr-arch)/include/asm, include/asm-$(hdr-arch)))
1026
1027# If we do an all arch process set dst to asm-$(hdr-arch)
1028hdr-dst = $(if $(KBUILD_HEADERS), dst=include/asm-$(hdr-arch), dst=include/asm)
1022 1029
1023PHONY += __headers 1030PHONY += __headers
1024__headers: include/linux/version.h scripts_basic FORCE 1031__headers: include/linux/version.h scripts_basic FORCE
1025 $(Q)$(MAKE) $(build)=scripts scripts/unifdef 1032 $(Q)$(MAKE) $(build)=scripts scripts/unifdef
1026 1033
1027PHONY += headers_install_all 1034PHONY += headers_install_all
1028headers_install_all: __headers 1035headers_install_all:
1029 $(Q)$(MAKE) $(hdr-inst)=include 1036 $(Q)$(CONFIG_SHELL) $(srctree)/scripts/headers.sh install
1030 $(Q)set -e; for arch in $(hdr-archs); do \
1031 $(MAKE) $(hdr-inst)=include/asm-$$arch \
1032 SRCARCH=$$arch dst=include/asm-$$arch; \
1033 done
1034 1037
1035PHONY += headers_install 1038PHONY += headers_install
1036headers_install: __headers 1039headers_install: __headers
1037 $(if $(wildcard $(srctree)/include/asm-$(SRCARCH)/Kbuild),, \ 1040 $(if $(wildcard $(srctree)/$(hdr-dir)/Kbuild),, \
1038 $(error Headers not exportable for this architecture ($(SRCARCH)))) 1041 $(error Headers not exportable for the $(SRCARCH) architecture))
1039 $(Q)$(MAKE) $(hdr-inst)=include 1042 $(Q)$(MAKE) $(hdr-inst)=include
1040 $(Q)$(MAKE) $(hdr-inst)=include/asm-$(SRCARCH) dst=include/asm 1043 $(Q)$(MAKE) $(hdr-inst)=$(hdr-dir) $(hdr-dst)
1041 1044
1042PHONY += headers_check_all 1045PHONY += headers_check_all
1043headers_check_all: headers_install_all 1046headers_check_all: headers_install_all
1044 $(Q)$(MAKE) $(hdr-inst)=include HDRCHECK=1 1047 $(Q)$(CONFIG_SHELL) $(srctree)/scripts/headers.sh check
1045 $(Q)set -e; for arch in $(hdr-archs); do \
1046 $(MAKE) SRCARCH=$$arch $(hdr-inst)=include/asm-$$arch HDRCHECK=1 ;\
1047 done
1048 1048
1049PHONY += headers_check 1049PHONY += headers_check
1050headers_check: headers_install 1050headers_check: headers_install
1051 $(Q)$(MAKE) $(hdr-inst)=include HDRCHECK=1 1051 $(Q)$(MAKE) $(hdr-inst)=include HDRCHECK=1
1052 $(Q)$(MAKE) $(hdr-inst)=include/asm-$(SRCARCH) \ 1052 $(Q)$(MAKE) $(hdr-inst)=$(hdr-dir) $(hdr-dst) HDRCHECK=1
1053 dst=include/asm HDRCHECK=1
1054 1053
1055# --------------------------------------------------------------------------- 1054# ---------------------------------------------------------------------------
1056# Modules 1055# Modules
@@ -1234,21 +1233,17 @@ help:
1234 @echo ' cscope - Generate cscope index' 1233 @echo ' cscope - Generate cscope index'
1235 @echo ' kernelrelease - Output the release version string' 1234 @echo ' kernelrelease - Output the release version string'
1236 @echo ' kernelversion - Output the version stored in Makefile' 1235 @echo ' kernelversion - Output the version stored in Makefile'
1237 @if [ -r $(srctree)/include/asm-$(SRCARCH)/Kbuild ]; then \ 1236 @echo ' headers_install - Install sanitised kernel headers to INSTALL_HDR_PATH'; \
1238 echo ' headers_install - Install sanitised kernel headers to INSTALL_HDR_PATH'; \
1239 echo ' (default: $(INSTALL_HDR_PATH))'; \ 1237 echo ' (default: $(INSTALL_HDR_PATH))'; \
1240 fi 1238 echo ''
1241 @echo ''
1242 @echo 'Static analysers' 1239 @echo 'Static analysers'
1243 @echo ' checkstack - Generate a list of stack hogs' 1240 @echo ' checkstack - Generate a list of stack hogs'
1244 @echo ' namespacecheck - Name space analysis on compiled kernel' 1241 @echo ' namespacecheck - Name space analysis on compiled kernel'
1245 @echo ' versioncheck - Sanity check on version.h usage' 1242 @echo ' versioncheck - Sanity check on version.h usage'
1246 @echo ' includecheck - Check for duplicate included header files' 1243 @echo ' includecheck - Check for duplicate included header files'
1247 @echo ' export_report - List the usages of all exported symbols' 1244 @echo ' export_report - List the usages of all exported symbols'
1248 @if [ -r $(srctree)/include/asm-$(SRCARCH)/Kbuild ]; then \ 1245 @echo ' headers_check - Sanity check on exported headers'; \
1249 echo ' headers_check - Sanity check on exported headers'; \ 1246 echo ''
1250 fi
1251 @echo ''
1252 @echo 'Kernel packaging:' 1247 @echo 'Kernel packaging:'
1253 @$(MAKE) $(build)=$(package-dir) help 1248 @$(MAKE) $(build)=$(package-dir) help
1254 @echo '' 1249 @echo ''
diff --git a/scripts/headers.sh b/scripts/headers.sh
new file mode 100755
index 000000000000..d33426f866db
--- /dev/null
+++ b/scripts/headers.sh
@@ -0,0 +1,41 @@
1#!/bin/sh
2# Run headers_$1 command for all suitable architectures
3
4# Stop on error
5set -e
6
7do_command()
8{
9 if [ -f ${srctree}/arch/$2/include/asm/Kbuild ]; then
10 make ARCH=$2 KBUILD_HEADERS=$1 headers_$1
11 elif [ -f ${srctree}/include/asm-$2/Kbuild ]; then
12 make ARCH=$2 KBUILD_HEADERS=$1 headers_$1
13 else
14 printf "Ignoring arch: %s\n" ${arch}
15 fi
16}
17
18# Do not try this architecture
19drop="generic um ppc sparc64 cris"
20
21archs=$(ls ${srctree}/arch)
22
23for arch in ${archs}; do
24 case ${arch} in
25 um) # no userspace export
26 ;;
27 ppc) # headers exported by powerpc
28 ;;
29 sparc64) # headers exported by sparc
30 ;;
31 cris) # headers export are known broken
32 ;;
33 *)
34 if [ -d ${srctree}/arch/${arch} ]; then
35 do_command $1 ${arch}
36 fi
37 ;;
38 esac
39done
40
41