aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorLen Brown <len.brown@intel.com>2009-01-09 03:39:43 -0500
committerLen Brown <len.brown@intel.com>2009-01-09 03:39:43 -0500
commitb2576e1d4408e134e2188c967b1f28af39cd79d4 (patch)
tree004f3c82faab760f304ce031d6d2f572e7746a50 /Makefile
parent3cc8a5f4ba91f67bbdb81a43a99281a26aab8d77 (diff)
parent2150edc6c5cf00f7adb54538b9ea2a3e9cedca3f (diff)
Merge branch 'linus' into release
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile222
1 files changed, 75 insertions, 147 deletions
diff --git a/Makefile b/Makefile
index 71e98e9e6acd..28331288341f 100644
--- a/Makefile
+++ b/Makefile
@@ -205,13 +205,14 @@ ifeq ($(ARCH),x86_64)
205 SRCARCH := x86 205 SRCARCH := x86
206endif 206endif
207 207
208# Where to locate arch specific headers 208# Additional ARCH settings for sparc
209ifeq ($(ARCH),sparc64) 209ifeq ($(ARCH),sparc64)
210 hdr-arch := sparc 210 SRCARCH := sparc
211else
212 hdr-arch := $(SRCARCH)
213endif 211endif
214 212
213# Where to locate arch specific headers
214hdr-arch := $(SRCARCH)
215
215KCONFIG_CONFIG ?= .config 216KCONFIG_CONFIG ?= .config
216 217
217# SHELL used by kbuild 218# SHELL used by kbuild
@@ -320,7 +321,8 @@ KALLSYMS = scripts/kallsyms
320PERL = perl 321PERL = perl
321CHECK = sparse 322CHECK = sparse
322 323
323CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ -Wbitwise $(CF) 324CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \
325 -Wbitwise -Wno-return-void $(CF)
324MODFLAGS = -DMODULE 326MODFLAGS = -DMODULE
325CFLAGS_MODULE = $(MODFLAGS) 327CFLAGS_MODULE = $(MODFLAGS)
326AFLAGS_MODULE = $(MODFLAGS) 328AFLAGS_MODULE = $(MODFLAGS)
@@ -336,7 +338,7 @@ LINUXINCLUDE := -Iinclude \
336 -I$(srctree)/arch/$(hdr-arch)/include \ 338 -I$(srctree)/arch/$(hdr-arch)/include \
337 -include include/linux/autoconf.h 339 -include include/linux/autoconf.h
338 340
339KBUILD_CPPFLAGS := -D__KERNEL__ $(LINUXINCLUDE) 341KBUILD_CPPFLAGS := -D__KERNEL__
340 342
341KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ 343KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
342 -fno-strict-aliasing -fno-common \ 344 -fno-strict-aliasing -fno-common \
@@ -439,7 +441,11 @@ ifeq ($(config-targets),1)
439include $(srctree)/arch/$(SRCARCH)/Makefile 441include $(srctree)/arch/$(SRCARCH)/Makefile
440export KBUILD_DEFCONFIG KBUILD_KCONFIG 442export KBUILD_DEFCONFIG KBUILD_KCONFIG
441 443
442config %config: scripts_basic outputmakefile FORCE 444config: scripts_basic outputmakefile FORCE
445 $(Q)mkdir -p include/linux include/config
446 $(Q)$(MAKE) $(build)=scripts/kconfig $@
447
448%config: scripts_basic outputmakefile FORCE
443 $(Q)mkdir -p include/linux include/config 449 $(Q)mkdir -p include/linux include/config
444 $(Q)$(MAKE) $(build)=scripts/kconfig $@ 450 $(Q)$(MAKE) $(build)=scripts/kconfig $@
445 451
@@ -600,20 +606,25 @@ export INSTALL_PATH ?= /boot
600MODLIB = $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE) 606MODLIB = $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE)
601export MODLIB 607export MODLIB
602 608
603# 609strip-symbols := $(srctree)/scripts/strip-symbols \
604# INSTALL_MOD_STRIP, if defined, will cause modules to be 610 $(wildcard $(srctree)/arch/$(ARCH)/scripts/strip-symbols)
605# stripped after they are installed. If INSTALL_MOD_STRIP is '1', then
606# the default option --strip-debug will be used. Otherwise,
607# INSTALL_MOD_STRIP will used as the options to the strip command.
608 611
612#
613# INSTALL_MOD_STRIP, if defined, will cause modules to be stripped while
614# they get installed. If INSTALL_MOD_STRIP is '1', then the default
615# options (see below) will be used. Otherwise, INSTALL_MOD_STRIP will
616# be used as the option(s) to the objcopy command.
609ifdef INSTALL_MOD_STRIP 617ifdef INSTALL_MOD_STRIP
610ifeq ($(INSTALL_MOD_STRIP),1) 618ifeq ($(INSTALL_MOD_STRIP),1)
611mod_strip_cmd = $(STRIP) --strip-debug 619mod_strip_cmd = $(OBJCOPY) --strip-debug
620ifeq ($(CONFIG_KALLSYMS_ALL),$(CONFIG_KALLSYMS_STRIP_GENERATED))
621mod_strip_cmd += --wildcard $(addprefix --strip-symbols ,$(strip-symbols))
622endif
612else 623else
613mod_strip_cmd = $(STRIP) $(INSTALL_MOD_STRIP) 624mod_strip_cmd = $(OBJCOPY) $(INSTALL_MOD_STRIP)
614endif # INSTALL_MOD_STRIP=1 625endif # INSTALL_MOD_STRIP=1
615else 626else
616mod_strip_cmd = true 627mod_strip_cmd = false
617endif # INSTALL_MOD_STRIP 628endif # INSTALL_MOD_STRIP
618export mod_strip_cmd 629export mod_strip_cmd
619 630
@@ -743,6 +754,7 @@ last_kallsyms := 2
743endif 754endif
744 755
745kallsyms.o := .tmp_kallsyms$(last_kallsyms).o 756kallsyms.o := .tmp_kallsyms$(last_kallsyms).o
757kallsyms.h := $(wildcard include/config/kallsyms/*.h) $(wildcard include/config/kallsyms/*/*.h)
746 758
747define verify_kallsyms 759define verify_kallsyms
748 $(Q)$(if $($(quiet)cmd_sysmap), \ 760 $(Q)$(if $($(quiet)cmd_sysmap), \
@@ -767,24 +779,41 @@ endef
767 779
768# Generate .S file with all kernel symbols 780# Generate .S file with all kernel symbols
769quiet_cmd_kallsyms = KSYM $@ 781quiet_cmd_kallsyms = KSYM $@
770 cmd_kallsyms = $(NM) -n $< | $(KALLSYMS) \ 782 cmd_kallsyms = { test $* -eq 0 || $(NM) -n $<; } \
771 $(if $(CONFIG_KALLSYMS_ALL),--all-symbols) > $@ 783 | $(KALLSYMS) $(if $(CONFIG_KALLSYMS_ALL),--all-symbols) >$@
784
785quiet_cmd_kstrip = STRIP $@
786 cmd_kstrip = $(OBJCOPY) --wildcard $(addprefix --strip$(if $(CONFIG_RELOCATABLE),-unneeded)-symbols ,$(filter %/scripts/strip-symbols,$^)) $< $@
772 787
773.tmp_kallsyms1.o .tmp_kallsyms2.o .tmp_kallsyms3.o: %.o: %.S scripts FORCE 788$(foreach n,0 1 2 3,.tmp_kallsyms$(n).o): KBUILD_AFLAGS += -Wa,--strip-local-absolute
789$(foreach n,0 1 2 3,.tmp_kallsyms$(n).o): %.o: %.S scripts FORCE
774 $(call if_changed_dep,as_o_S) 790 $(call if_changed_dep,as_o_S)
775 791
776.tmp_kallsyms%.S: .tmp_vmlinux% $(KALLSYMS) 792ifeq ($(CONFIG_KALLSYMS_STRIP_GENERATED),y)
793strip-ext := .stripped
794endif
795
796.tmp_kallsyms%.S: .tmp_vmlinux%$(strip-ext) $(KALLSYMS) $(kallsyms.h)
777 $(call cmd,kallsyms) 797 $(call cmd,kallsyms)
778 798
799# make -jN seems to have problems with intermediate files, see bug #3330.
800.SECONDARY: $(foreach n,1 2 3,.tmp_vmlinux$(n).stripped)
801.tmp_vmlinux%.stripped: .tmp_vmlinux% $(strip-symbols) $(kallsyms.h)
802 $(call cmd,kstrip)
803
804ifneq ($(CONFIG_DEBUG_INFO),y)
805.tmp_vmlinux%: LDFLAGS_vmlinux += -S
806endif
779# .tmp_vmlinux1 must be complete except kallsyms, so update vmlinux version 807# .tmp_vmlinux1 must be complete except kallsyms, so update vmlinux version
780.tmp_vmlinux1: $(vmlinux-lds) $(vmlinux-all) FORCE 808.tmp_vmlinux%: $(vmlinux-lds) $(vmlinux-all) FORCE
781 $(call if_changed_rule,ksym_ld) 809 $(if $(filter 1,$*),$(call if_changed_rule,ksym_ld),$(call if_changed,vmlinux__))
782 810
783.tmp_vmlinux2: $(vmlinux-lds) $(vmlinux-all) .tmp_kallsyms1.o FORCE 811.tmp_vmlinux0$(strip-ext):
784 $(call if_changed,vmlinux__) 812 $(Q)echo "placeholder" >$@
785 813
786.tmp_vmlinux3: $(vmlinux-lds) $(vmlinux-all) .tmp_kallsyms2.o FORCE 814.tmp_vmlinux1: .tmp_kallsyms0.o
787 $(call if_changed,vmlinux__) 815.tmp_vmlinux2: .tmp_kallsyms1.o
816.tmp_vmlinux3: .tmp_kallsyms2.o
788 817
789# Needs to visit scripts/ before $(KALLSYMS) can be used. 818# Needs to visit scripts/ before $(KALLSYMS) can be used.
790$(KALLSYMS): scripts ; 819$(KALLSYMS): scripts ;
@@ -926,7 +955,7 @@ PHONY += prepare archprepare prepare0 prepare1 prepare2 prepare3
926# 2) Create the include2 directory, used for the second asm symlink 955# 2) Create the include2 directory, used for the second asm symlink
927prepare3: include/config/kernel.release 956prepare3: include/config/kernel.release
928ifneq ($(KBUILD_SRC),) 957ifneq ($(KBUILD_SRC),)
929 @echo ' Using $(srctree) as source for kernel' 958 @$(kecho) ' Using $(srctree) as source for kernel'
930 $(Q)if [ -f $(srctree)/.config -o -d $(srctree)/include/config ]; then \ 959 $(Q)if [ -f $(srctree)/.config -o -d $(srctree)/include/config ]; then \
931 echo " $(srctree) is not clean, please run 'make mrproper'";\ 960 echo " $(srctree) is not clean, please run 'make mrproper'";\
932 echo " in the '$(srctree)' directory.";\ 961 echo " in the '$(srctree)' directory.";\
@@ -936,6 +965,7 @@ ifneq ($(KBUILD_SRC),)
936 mkdir -p include2; \ 965 mkdir -p include2; \
937 ln -fsn $(srctree)/include/asm-$(SRCARCH) include2/asm; \ 966 ln -fsn $(srctree)/include/asm-$(SRCARCH) include2/asm; \
938 fi 967 fi
968 ln -fsn $(srctree) source
939endif 969endif
940 970
941# prepare2 creates a makefile if using a separate output directory 971# prepare2 creates a makefile if using a separate output directory
@@ -979,11 +1009,11 @@ define check-symlink
979endef 1009endef
980 1010
981# We create the target directory of the symlink if it does 1011# We create the target directory of the symlink if it does
982# not exist so the test in chack-symlink works and we have a 1012# not exist so the test in check-symlink works and we have a
983# directory for generated filesas used by some architectures. 1013# directory for generated filesas used by some architectures.
984define create-symlink 1014define create-symlink
985 if [ ! -L include/asm ]; then \ 1015 if [ ! -L include/asm ]; then \
986 echo ' SYMLINK $@ -> include/asm-$(SRCARCH)'; \ 1016 $(kecho) ' SYMLINK $@ -> include/asm-$(SRCARCH)'; \
987 if [ ! -d include/asm-$(SRCARCH) ]; then \ 1017 if [ ! -d include/asm-$(SRCARCH) ]; then \
988 mkdir -p include/asm-$(SRCARCH); \ 1018 mkdir -p include/asm-$(SRCARCH); \
989 fi; \ 1019 fi; \
@@ -1022,6 +1052,10 @@ include/linux/version.h: $(srctree)/Makefile FORCE
1022include/linux/utsrelease.h: include/config/kernel.release FORCE 1052include/linux/utsrelease.h: include/config/kernel.release FORCE
1023 $(call filechk,utsrelease.h) 1053 $(call filechk,utsrelease.h)
1024 1054
1055PHONY += headerdep
1056headerdep:
1057 $(Q)find include/ -name '*.h' | xargs --max-args 1 scripts/headerdep.pl
1058
1025# --------------------------------------------------------------------------- 1059# ---------------------------------------------------------------------------
1026 1060
1027PHONY += depend dep 1061PHONY += depend dep
@@ -1096,7 +1130,7 @@ all: modules
1096PHONY += modules 1130PHONY += modules
1097modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux) 1131modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux)
1098 $(Q)$(AWK) '!x[$$0]++' $(vmlinux-dirs:%=$(objtree)/%/modules.order) > $(objtree)/modules.order 1132 $(Q)$(AWK) '!x[$$0]++' $(vmlinux-dirs:%=$(objtree)/%/modules.order) > $(objtree)/modules.order
1099 @echo ' Building modules, stage 2.'; 1133 @$(kecho) ' Building modules, stage 2.';
1100 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost 1134 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
1101 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.fwinst obj=firmware __fw_modbuild 1135 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.fwinst obj=firmware __fw_modbuild
1102 1136
@@ -1270,7 +1304,8 @@ help:
1270 @echo ' versioncheck - Sanity check on version.h usage' 1304 @echo ' versioncheck - Sanity check on version.h usage'
1271 @echo ' includecheck - Check for duplicate included header files' 1305 @echo ' includecheck - Check for duplicate included header files'
1272 @echo ' export_report - List the usages of all exported symbols' 1306 @echo ' export_report - List the usages of all exported symbols'
1273 @echo ' headers_check - Sanity check on exported headers'; \ 1307 @echo ' headers_check - Sanity check on exported headers'
1308 @echo ' headerdep - Detect inclusion cycles in headers'; \
1274 echo '' 1309 echo ''
1275 @echo 'Kernel packaging:' 1310 @echo 'Kernel packaging:'
1276 @$(MAKE) $(build)=$(package-dir) help 1311 @$(MAKE) $(build)=$(package-dir) help
@@ -1360,7 +1395,7 @@ $(module-dirs): crmodverdir $(objtree)/Module.symvers
1360 $(Q)$(MAKE) $(build)=$(patsubst _module_%,%,$@) 1395 $(Q)$(MAKE) $(build)=$(patsubst _module_%,%,$@)
1361 1396
1362modules: $(module-dirs) 1397modules: $(module-dirs)
1363 @echo ' Building modules, stage 2.'; 1398 @$(kecho) ' Building modules, stage 2.';
1364 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost 1399 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
1365 1400
1366PHONY += modules_install 1401PHONY += modules_install
@@ -1409,123 +1444,12 @@ endif # KBUILD_EXTMOD
1409 1444
1410# Generate tags for editors 1445# Generate tags for editors
1411# --------------------------------------------------------------------------- 1446# ---------------------------------------------------------------------------
1447quiet_cmd_tags = GEN $@
1448 cmd_tags = $(CONFIG_SHELL) $(srctree)/scripts/tags.sh $@
1412 1449
1413#We want __srctree to totally vanish out when KBUILD_OUTPUT is not set 1450tags TAGS cscope: FORCE
1414#(which is the most common case IMHO) to avoid unneeded clutter in the big tags file.
1415#Adding $(srctree) adds about 20M on i386 to the size of the output file!
1416
1417ifeq ($(src),$(obj))
1418__srctree =
1419else
1420__srctree = $(srctree)/
1421endif
1422
1423ifeq ($(ALLSOURCE_ARCHS),)
1424ifeq ($(ARCH),um)
1425ALLINCLUDE_ARCHS := $(ARCH) $(SUBARCH)
1426else
1427ALLINCLUDE_ARCHS := $(SRCARCH)
1428endif
1429else
1430#Allow user to specify only ALLSOURCE_PATHS on the command line, keeping existing behaviour.
1431ALLINCLUDE_ARCHS := $(ALLSOURCE_ARCHS)
1432endif
1433
1434ALLSOURCE_ARCHS := $(SRCARCH)
1435
1436define find-sources
1437 ( for arch in $(ALLSOURCE_ARCHS) ; do \
1438 find $(__srctree)arch/$${arch} $(RCS_FIND_IGNORE) \
1439 -wholename $(__srctree)arch/$${arch}/include/asm -type d -prune \
1440 -o -name $1 -print; \
1441 done ; \
1442 find $(__srctree)security/selinux/include $(RCS_FIND_IGNORE) \
1443 -name $1 -print; \
1444 find $(__srctree)include $(RCS_FIND_IGNORE) \
1445 \( -name config -o -name 'asm-*' \) -prune \
1446 -o -name $1 -print; \
1447 for arch in $(ALLINCLUDE_ARCHS) ; do \
1448 test -e $(__srctree)include/asm-$${arch} && \
1449 find $(__srctree)include/asm-$${arch} $(RCS_FIND_IGNORE) \
1450 -name $1 -print; \
1451 test -e $(__srctree)arch/$${arch}/include/asm && \
1452 find $(__srctree)arch/$${arch}/include/asm $(RCS_FIND_IGNORE) \
1453 -name $1 -print; \
1454 done ; \
1455 find $(__srctree)include/asm-generic $(RCS_FIND_IGNORE) \
1456 -name $1 -print; \
1457 find $(__srctree) $(RCS_FIND_IGNORE) \
1458 \( -name include -o -name arch -o -name '.tmp_*' \) -prune -o \
1459 -name $1 -print; \
1460 )
1461endef
1462
1463define all-sources
1464 $(call find-sources,'*.[chS]')
1465endef
1466define all-kconfigs
1467 $(call find-sources,'Kconfig*')
1468endef
1469define all-defconfigs
1470 $(call find-sources,'defconfig')
1471endef
1472
1473define xtags
1474 if $1 --version 2>&1 | grep -iq exuberant; then \
1475 $(all-sources) | xargs $1 -a \
1476 -I __initdata,__exitdata,__acquires,__releases \
1477 -I __read_mostly,____cacheline_aligned,____cacheline_aligned_in_smp,____cacheline_internodealigned_in_smp \
1478 -I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL \
1479 --extra=+f --c-kinds=+px \
1480 --regex-asm='/^ENTRY\(([^)]*)\).*/\1/'; \
1481 $(all-kconfigs) | xargs $1 -a \
1482 --langdef=kconfig \
1483 --language-force=kconfig \
1484 --regex-kconfig='/^[[:blank:]]*(menu|)config[[:blank:]]+([[:alnum:]_]+)/\2/'; \
1485 $(all-defconfigs) | xargs -r $1 -a \
1486 --langdef=dotconfig \
1487 --language-force=dotconfig \
1488 --regex-dotconfig='/^#?[[:blank:]]*(CONFIG_[[:alnum:]_]+)/\1/'; \
1489 elif $1 --version 2>&1 | grep -iq emacs; then \
1490 $(all-sources) | xargs $1 -a; \
1491 $(all-kconfigs) | xargs $1 -a \
1492 --regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/\3/'; \
1493 $(all-defconfigs) | xargs -r $1 -a \
1494 --regex='/^#?[ \t]?\(CONFIG_[a-zA-Z0-9_]+\)/\1/'; \
1495 else \
1496 $(all-sources) | xargs $1 -a; \
1497 fi
1498endef
1499
1500quiet_cmd_cscope-file = FILELST cscope.files
1501 cmd_cscope-file = (echo \-k; echo \-q; $(all-sources)) > cscope.files
1502
1503quiet_cmd_cscope = MAKE cscope.out
1504 cmd_cscope = cscope -b -f cscope.out
1505
1506cscope: FORCE
1507 $(call cmd,cscope-file)
1508 $(call cmd,cscope)
1509
1510quiet_cmd_TAGS = MAKE $@
1511define cmd_TAGS
1512 rm -f $@; \
1513 $(call xtags,etags)
1514endef
1515
1516TAGS: FORCE
1517 $(call cmd,TAGS)
1518
1519quiet_cmd_tags = MAKE $@
1520define cmd_tags
1521 rm -f $@; \
1522 $(call xtags,ctags)
1523endef
1524
1525tags: FORCE
1526 $(call cmd,tags) 1451 $(call cmd,tags)
1527 1452
1528
1529# Scripts to check various things for consistency 1453# Scripts to check various things for consistency
1530# --------------------------------------------------------------------------- 1454# ---------------------------------------------------------------------------
1531 1455
@@ -1604,7 +1528,11 @@ endif
1604 $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) 1528 $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
1605 1529
1606# Modules 1530# Modules
1607/ %/: prepare scripts FORCE 1531/: prepare scripts FORCE
1532 $(cmd_crmodverdir)
1533 $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
1534 $(build)=$(build-dir)
1535%/: prepare scripts FORCE
1608 $(cmd_crmodverdir) 1536 $(cmd_crmodverdir)
1609 $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \ 1537 $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
1610 $(build)=$(build-dir) 1538 $(build)=$(build-dir)
@@ -1638,7 +1566,7 @@ cmd_crmodverdir = $(Q)mkdir -p $(MODVERDIR) \
1638 $(if $(KBUILD_MODULES),; rm -f $(MODVERDIR)/*) 1566 $(if $(KBUILD_MODULES),; rm -f $(MODVERDIR)/*)
1639 1567
1640a_flags = -Wp,-MD,$(depfile) $(KBUILD_AFLAGS) $(AFLAGS_KERNEL) \ 1568a_flags = -Wp,-MD,$(depfile) $(KBUILD_AFLAGS) $(AFLAGS_KERNEL) \
1641 $(NOSTDINC_FLAGS) $(KBUILD_CPPFLAGS) \ 1569 $(NOSTDINC_FLAGS) $(LINUXINCLUDE) $(KBUILD_CPPFLAGS) \
1642 $(modkern_aflags) $(EXTRA_AFLAGS) $(AFLAGS_$(basetarget).o) 1570 $(modkern_aflags) $(EXTRA_AFLAGS) $(AFLAGS_$(basetarget).o)
1643 1571
1644quiet_cmd_as_o_S = AS $@ 1572quiet_cmd_as_o_S = AS $@