aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile129
1 files changed, 80 insertions, 49 deletions
diff --git a/Makefile b/Makefile
index 6192922de9c0..f3e206509ee1 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
1VERSION = 2 1VERSION = 2
2PATCHLEVEL = 6 2PATCHLEVEL = 6
3SUBLEVEL = 26 3SUBLEVEL = 27
4EXTRAVERSION = 4EXTRAVERSION = -rc2
5NAME = Rotary Wombat 5NAME = Rotary Wombat
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
@@ -205,6 +205,13 @@ ifeq ($(ARCH),x86_64)
205 SRCARCH := x86 205 SRCARCH := x86
206endif 206endif
207 207
208# Where to locate arch specific headers
209ifeq ($(ARCH),sparc64)
210 hdr-arch := sparc
211else
212 hdr-arch := $(SRCARCH)
213endif
214
208KCONFIG_CONFIG ?= .config 215KCONFIG_CONFIG ?= .config
209 216
210# SHELL used by kbuild 217# SHELL used by kbuild
@@ -326,7 +333,8 @@ AFLAGS_KERNEL =
326# Needed to be compatible with the O= option 333# Needed to be compatible with the O= option
327LINUXINCLUDE := -Iinclude \ 334LINUXINCLUDE := -Iinclude \
328 $(if $(KBUILD_SRC),-Iinclude2 -I$(srctree)/include) \ 335 $(if $(KBUILD_SRC),-Iinclude2 -I$(srctree)/include) \
329 -include include/linux/autoconf.h 336 -I$(srctree)/arch/$(hdr-arch)/include \
337 -include include/linux/autoconf.h
330 338
331KBUILD_CPPFLAGS := -D__KERNEL__ $(LINUXINCLUDE) 339KBUILD_CPPFLAGS := -D__KERNEL__ $(LINUXINCLUDE)
332 340
@@ -921,8 +929,10 @@ ifneq ($(KBUILD_SRC),)
921 echo " in the '$(srctree)' directory.";\ 929 echo " in the '$(srctree)' directory.";\
922 /bin/false; \ 930 /bin/false; \
923 fi; 931 fi;
924 $(Q)if [ ! -d include2 ]; then mkdir -p include2; fi; 932 $(Q)if [ ! -d include2 ]; then \
925 $(Q)ln -fsn $(srctree)/include/asm-$(SRCARCH) include2/asm 933 mkdir -p include2; \
934 ln -fsn $(srctree)/include/asm-$(SRCARCH) include2/asm; \
935 fi
926endif 936endif
927 937
928# prepare2 creates a makefile if using a separate output directory 938# prepare2 creates a makefile if using a separate output directory
@@ -948,22 +958,34 @@ export CPPFLAGS_vmlinux.lds += -P -C -U$(ARCH)
948 958
949# The asm symlink changes when $(ARCH) changes. 959# The asm symlink changes when $(ARCH) changes.
950# Detect this and ask user to run make mrproper 960# Detect this and ask user to run make mrproper
951 961define check-symlink
952include/asm: FORCE 962 set -e; \
953 $(Q)set -e; asmlink=`readlink include/asm | cut -d '-' -f 2`; \ 963 if [ -L include/asm ]; then \
954 if [ -L include/asm ]; then \ 964 asmlink=`readlink include/asm | cut -d '-' -f 2`; \
955 if [ "$$asmlink" != "$(SRCARCH)" ]; then \ 965 if [ "$$asmlink" != "$(SRCARCH)" ]; then \
956 echo "ERROR: the symlink $@ points to asm-$$asmlink but asm-$(SRCARCH) was expected"; \ 966 echo "ERROR: the symlink $@ points to asm-$$asmlink but asm-$(SRCARCH) was expected"; \
957 echo " set ARCH or save .config and run 'make mrproper' to fix it"; \ 967 echo " set ARCH or save .config and run 'make mrproper' to fix it"; \
958 exit 1; \ 968 exit 1; \
959 fi; \ 969 fi; \
960 else \
961 echo ' SYMLINK $@ -> include/asm-$(SRCARCH)'; \
962 if [ ! -d include ]; then \
963 mkdir -p include; \
964 fi; \
965 ln -fsn asm-$(SRCARCH) $@; \
966 fi 970 fi
971endef
972
973# We create the target directory of the symlink if it does
974# not exist so the test in chack-symlink works and we have a
975# directory for generated filesas used by some architectures.
976define create-symlink
977 if [ ! -L include/asm ]; then \
978 echo ' SYMLINK $@ -> include/asm-$(SRCARCH)'; \
979 if [ ! -d include/asm-$(SRCARCH) ]; then \
980 mkdir -p include/asm-$(SRCARCH); \
981 fi; \
982 ln -fsn asm-$(SRCARCH) $@; \
983 fi
984endef
985
986include/asm: FORCE
987 $(Q)$(check-symlink)
988 $(Q)$(create-symlink)
967 989
968# Generate some files 990# Generate some files
969# --------------------------------------------------------------------------- 991# ---------------------------------------------------------------------------
@@ -1010,36 +1032,43 @@ firmware_install: FORCE
1010 1032
1011# --------------------------------------------------------------------------- 1033# ---------------------------------------------------------------------------
1012# Kernel headers 1034# Kernel headers
1013INSTALL_HDR_PATH=$(objtree)/usr
1014export INSTALL_HDR_PATH
1015 1035
1016HDRFILTER=generic i386 x86_64 1036#Default location for installed headers
1017HDRARCHES=$(filter-out $(HDRFILTER),$(patsubst $(srctree)/include/asm-%/Kbuild,%,$(wildcard $(srctree)/include/asm-*/Kbuild))) 1037export INSTALL_HDR_PATH = $(objtree)/usr
1018 1038
1019PHONY += headers_install_all 1039hdr-inst := -rR -f $(srctree)/scripts/Makefile.headersinst obj
1020headers_install_all: include/linux/version.h scripts_basic FORCE 1040# Find out where the Kbuild file is located to support
1041# arch/$(ARCH)/include/asm
1042hdr-dir = $(strip \
1043 $(if $(wildcard $(srctree)/arch/$(hdr-arch)/include/asm/Kbuild), \
1044 arch/$(hdr-arch)/include/asm, include/asm-$(hdr-arch)))
1045
1046# If we do an all arch process set dst to asm-$(hdr-arch)
1047hdr-dst = $(if $(KBUILD_HEADERS), dst=include/asm-$(hdr-arch), dst=include/asm)
1048
1049PHONY += __headers
1050__headers: include/linux/version.h scripts_basic FORCE
1021 $(Q)$(MAKE) $(build)=scripts scripts/unifdef 1051 $(Q)$(MAKE) $(build)=scripts scripts/unifdef
1022 $(Q)for arch in $(HDRARCHES); do \ 1052
1023 $(MAKE) ARCH=$$arch -f $(srctree)/scripts/Makefile.headersinst obj=include BIASMDIR=-bi-$$arch ;\ 1053PHONY += headers_install_all
1024 done 1054headers_install_all:
1055 $(Q)$(CONFIG_SHELL) $(srctree)/scripts/headers.sh install
1025 1056
1026PHONY += headers_install 1057PHONY += headers_install
1027headers_install: include/linux/version.h scripts_basic FORCE 1058headers_install: __headers
1028 @if [ ! -r $(srctree)/include/asm-$(SRCARCH)/Kbuild ]; then \ 1059 $(if $(wildcard $(srctree)/$(hdr-dir)/Kbuild),, \
1029 echo '*** Error: Headers not exportable for this architecture ($(SRCARCH))'; \ 1060 $(error Headers not exportable for the $(SRCARCH) architecture))
1030 exit 1 ; fi 1061 $(Q)$(MAKE) $(hdr-inst)=include
1031 $(Q)$(MAKE) $(build)=scripts scripts/unifdef 1062 $(Q)$(MAKE) $(hdr-inst)=$(hdr-dir) $(hdr-dst)
1032 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.headersinst ARCH=$(SRCARCH) obj=include
1033 1063
1034PHONY += headers_check_all 1064PHONY += headers_check_all
1035headers_check_all: headers_install_all 1065headers_check_all: headers_install_all
1036 $(Q)for arch in $(HDRARCHES); do \ 1066 $(Q)$(CONFIG_SHELL) $(srctree)/scripts/headers.sh check
1037 $(MAKE) ARCH=$$arch -f $(srctree)/scripts/Makefile.headersinst obj=include BIASMDIR=-bi-$$arch HDRCHECK=1 ;\
1038 done
1039 1067
1040PHONY += headers_check 1068PHONY += headers_check
1041headers_check: headers_install 1069headers_check: headers_install
1042 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.headersinst ARCH=$(SRCARCH) obj=include HDRCHECK=1 1070 $(Q)$(MAKE) $(hdr-inst)=include HDRCHECK=1
1071 $(Q)$(MAKE) $(hdr-inst)=$(hdr-dir) $(hdr-dst) HDRCHECK=1
1043 1072
1044# --------------------------------------------------------------------------- 1073# ---------------------------------------------------------------------------
1045# Modules 1074# Modules
@@ -1061,6 +1090,7 @@ modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux)
1061 $(Q)$(AWK) '!x[$$0]++' $(vmlinux-dirs:%=$(objtree)/%/modules.order) > $(objtree)/modules.order 1090 $(Q)$(AWK) '!x[$$0]++' $(vmlinux-dirs:%=$(objtree)/%/modules.order) > $(objtree)/modules.order
1062 @echo ' Building modules, stage 2.'; 1091 @echo ' Building modules, stage 2.';
1063 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost 1092 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
1093 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.fwinst obj=firmware __fw_modbuild
1064 1094
1065 1095
1066# Target to prepare building external modules 1096# Target to prepare building external modules
@@ -1130,7 +1160,7 @@ MRPROPER_FILES += .config .config.old include/asm .version .old_version \
1130 include/linux/autoconf.h include/linux/version.h \ 1160 include/linux/autoconf.h include/linux/version.h \
1131 include/linux/utsrelease.h \ 1161 include/linux/utsrelease.h \
1132 include/linux/bounds.h include/asm*/asm-offsets.h \ 1162 include/linux/bounds.h include/asm*/asm-offsets.h \
1133 Module.symvers tags TAGS cscope* 1163 Module.symvers Module.markers tags TAGS cscope*
1134 1164
1135# clean - Delete most, but leave enough to build external modules 1165# clean - Delete most, but leave enough to build external modules
1136# 1166#
@@ -1148,7 +1178,8 @@ clean: archclean $(clean-dirs)
1148 @find . $(RCS_FIND_IGNORE) \ 1178 @find . $(RCS_FIND_IGNORE) \
1149 \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \ 1179 \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \
1150 -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \ 1180 -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \
1151 -o -name '*.symtypes' -o -name 'modules.order' \) \ 1181 -o -name '*.symtypes' -o -name 'modules.order' \
1182 -o -name 'Module.markers' -o -name '.tmp_*.o.*' \) \
1152 -type f -print | xargs rm -f 1183 -type f -print | xargs rm -f
1153 1184
1154# mrproper - Delete all generated files, including .config 1185# mrproper - Delete all generated files, including .config
@@ -1222,21 +1253,17 @@ help:
1222 @echo ' cscope - Generate cscope index' 1253 @echo ' cscope - Generate cscope index'
1223 @echo ' kernelrelease - Output the release version string' 1254 @echo ' kernelrelease - Output the release version string'
1224 @echo ' kernelversion - Output the version stored in Makefile' 1255 @echo ' kernelversion - Output the version stored in Makefile'
1225 @if [ -r $(srctree)/include/asm-$(SRCARCH)/Kbuild ]; then \ 1256 @echo ' headers_install - Install sanitised kernel headers to INSTALL_HDR_PATH'; \
1226 echo ' headers_install - Install sanitised kernel headers to INSTALL_HDR_PATH'; \
1227 echo ' (default: $(INSTALL_HDR_PATH))'; \ 1257 echo ' (default: $(INSTALL_HDR_PATH))'; \
1228 fi 1258 echo ''
1229 @echo ''
1230 @echo 'Static analysers' 1259 @echo 'Static analysers'
1231 @echo ' checkstack - Generate a list of stack hogs' 1260 @echo ' checkstack - Generate a list of stack hogs'
1232 @echo ' namespacecheck - Name space analysis on compiled kernel' 1261 @echo ' namespacecheck - Name space analysis on compiled kernel'
1233 @echo ' versioncheck - Sanity check on version.h usage' 1262 @echo ' versioncheck - Sanity check on version.h usage'
1234 @echo ' includecheck - Check for duplicate included header files' 1263 @echo ' includecheck - Check for duplicate included header files'
1235 @echo ' export_report - List the usages of all exported symbols' 1264 @echo ' export_report - List the usages of all exported symbols'
1236 @if [ -r $(srctree)/include/asm-$(SRCARCH)/Kbuild ]; then \ 1265 @echo ' headers_check - Sanity check on exported headers'; \
1237 echo ' headers_check - Sanity check on exported headers'; \ 1266 echo ''
1238 fi
1239 @echo ''
1240 @echo 'Kernel packaging:' 1267 @echo 'Kernel packaging:'
1241 @$(MAKE) $(build)=$(package-dir) help 1268 @$(MAKE) $(build)=$(package-dir) help
1242 @echo '' 1269 @echo ''
@@ -1409,7 +1436,11 @@ define find-sources
1409 \( -name config -o -name 'asm-*' \) -prune \ 1436 \( -name config -o -name 'asm-*' \) -prune \
1410 -o -name $1 -print; \ 1437 -o -name $1 -print; \
1411 for arch in $(ALLINCLUDE_ARCHS) ; do \ 1438 for arch in $(ALLINCLUDE_ARCHS) ; do \
1412 find $(__srctree)include/asm-$${arch} $(RCS_FIND_IGNORE) \ 1439 test -e $(__srctree)include/asm-$${arch} && \
1440 find $(__srctree)include/asm-$${arch} $(RCS_FIND_IGNORE) \
1441 -name $1 -print; \
1442 test -e $(__srctree)arch/$${arch}/include/asm && \
1443 find $(__srctree)arch/$${arch}/include/asm $(RCS_FIND_IGNORE) \
1413 -name $1 -print; \ 1444 -name $1 -print; \
1414 done ; \ 1445 done ; \
1415 find $(__srctree)include/asm-generic $(RCS_FIND_IGNORE) \ 1446 find $(__srctree)include/asm-generic $(RCS_FIND_IGNORE) \
@@ -1461,7 +1492,7 @@ quiet_cmd_cscope-file = FILELST cscope.files
1461 cmd_cscope-file = (echo \-k; echo \-q; $(all-sources)) > cscope.files 1492 cmd_cscope-file = (echo \-k; echo \-q; $(all-sources)) > cscope.files
1462 1493
1463quiet_cmd_cscope = MAKE cscope.out 1494quiet_cmd_cscope = MAKE cscope.out
1464 cmd_cscope = cscope -b 1495 cmd_cscope = cscope -b -f cscope.out
1465 1496
1466cscope: FORCE 1497cscope: FORCE
1467 $(call cmd,cscope-file) 1498 $(call cmd,cscope-file)