diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-09-24 17:24:14 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-09-24 17:24:14 -0400 |
commit | 6e936d3e9a45a4307e7f4a29ee9829e7a0464af1 (patch) | |
tree | 555f9d89779e6a675b38d9703f278ecf0579531c /Makefile | |
parent | a68aa1cc6f3203b8a332683ebde67a00f39eec43 (diff) | |
parent | 5cc8d246d0ebbdf827d4bb7c3de175377d244d73 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild
* git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild: (28 commits)
kbuild: add distclean info to 'make help' and more details for 'clean'
dontdiff: add utsrelease.h
kbuild: fix "mkdir -p" usage in scripts/package/mkspec
kbuild: correct and clarify versioning info in Makefile
kbuild: fixup Documentation/kbuild/modules.txt
kbuild: Extend kbuild/defconfig tags support to exuberant ctags
kbuild: fix for some typos in Documentation/makefiles.txt
kbuild: clarify "make C=" build option
Documentaion: update Documentation/Changes with minimum versions
kbuild: update help in top level Makefile
kbuild: fail kernel compilation in case of unresolved module symbols
kbuild: remove debug left-over from Makefile.host
kbuild: create output directory for hostprogs with O=.. build
kbuild: add missing return statement in modpost.c:secref_whitelist()
kbuild: preperly align SYSMAP output
kbuild: make -rR is now default
kbuild: make V=2 tell why a target is rebuild
kbuild: modpost on vmlinux regardless of CONFIG_MODULES
kbuild: ignore references from ".pci_fixup" to ".init.text"
kbuild: linguistic fixes for Documentation/kbuild/makefiles.txt
...
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 134 |
1 files changed, 88 insertions, 46 deletions
@@ -41,9 +41,15 @@ ifndef KBUILD_VERBOSE | |||
41 | KBUILD_VERBOSE = 0 | 41 | KBUILD_VERBOSE = 0 |
42 | endif | 42 | endif |
43 | 43 | ||
44 | # Call checker as part of compilation of C files | 44 | # Call a source code checker (by default, "sparse") as part of the |
45 | # Use 'make C=1' to enable checking (sparse, by default) | 45 | # C compilation. |
46 | # Override with 'make C=1 CHECK=checker_executable CHECKFLAGS=....' | 46 | # |
47 | # Use 'make C=1' to enable checking of only re-compiled files. | ||
48 | # Use 'make C=2' to enable checking of *all* source files, regardless | ||
49 | # of whether they are re-compiled or not. | ||
50 | # | ||
51 | # See the file "Documentation/sparse.txt" for more details, including | ||
52 | # where to get the "sparse" utility. | ||
47 | 53 | ||
48 | ifdef C | 54 | ifdef C |
49 | ifeq ("$(origin C)", "command line") | 55 | ifeq ("$(origin C)", "command line") |
@@ -639,12 +645,12 @@ define rule_vmlinux__ | |||
639 | $(call cmd,vmlinux__) | 645 | $(call cmd,vmlinux__) |
640 | $(Q)echo 'cmd_$@ := $(cmd_vmlinux__)' > $(@D)/.$(@F).cmd | 646 | $(Q)echo 'cmd_$@ := $(cmd_vmlinux__)' > $(@D)/.$(@F).cmd |
641 | 647 | ||
642 | $(Q)$(if $($(quiet)cmd_sysmap), \ | 648 | $(Q)$(if $($(quiet)cmd_sysmap), \ |
643 | echo ' $($(quiet)cmd_sysmap) System.map' &&) \ | 649 | echo ' $($(quiet)cmd_sysmap) System.map' &&) \ |
644 | $(cmd_sysmap) $@ System.map; \ | 650 | $(cmd_sysmap) $@ System.map; \ |
645 | if [ $$? -ne 0 ]; then \ | 651 | if [ $$? -ne 0 ]; then \ |
646 | rm -f $@; \ | 652 | rm -f $@; \ |
647 | /bin/false; \ | 653 | /bin/false; \ |
648 | fi; | 654 | fi; |
649 | $(verify_kallsyms) | 655 | $(verify_kallsyms) |
650 | endef | 656 | endef |
@@ -677,12 +683,12 @@ endif | |||
677 | kallsyms.o := .tmp_kallsyms$(last_kallsyms).o | 683 | kallsyms.o := .tmp_kallsyms$(last_kallsyms).o |
678 | 684 | ||
679 | define verify_kallsyms | 685 | define verify_kallsyms |
680 | $(Q)$(if $($(quiet)cmd_sysmap), \ | 686 | $(Q)$(if $($(quiet)cmd_sysmap), \ |
681 | echo ' $($(quiet)cmd_sysmap) .tmp_System.map' &&) \ | 687 | echo ' $($(quiet)cmd_sysmap) .tmp_System.map' &&) \ |
682 | $(cmd_sysmap) .tmp_vmlinux$(last_kallsyms) .tmp_System.map | 688 | $(cmd_sysmap) .tmp_vmlinux$(last_kallsyms) .tmp_System.map |
683 | $(Q)cmp -s System.map .tmp_System.map || \ | 689 | $(Q)cmp -s System.map .tmp_System.map || \ |
684 | (echo Inconsistent kallsyms data; \ | 690 | (echo Inconsistent kallsyms data; \ |
685 | echo Try setting CONFIG_KALLSYMS_EXTRA_PASS; \ | 691 | echo Try setting CONFIG_KALLSYMS_EXTRA_PASS; \ |
686 | rm .tmp_kallsyms* ; /bin/false ) | 692 | rm .tmp_kallsyms* ; /bin/false ) |
687 | endef | 693 | endef |
688 | 694 | ||
@@ -736,6 +742,7 @@ endif # ifdef CONFIG_KALLSYMS | |||
736 | # vmlinux image - including updated kernel symbols | 742 | # vmlinux image - including updated kernel symbols |
737 | vmlinux: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) $(kallsyms.o) FORCE | 743 | vmlinux: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) $(kallsyms.o) FORCE |
738 | $(call if_changed_rule,vmlinux__) | 744 | $(call if_changed_rule,vmlinux__) |
745 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost $@ | ||
739 | $(Q)rm -f .old_version | 746 | $(Q)rm -f .old_version |
740 | 747 | ||
741 | # The actual objects are generated when descending, | 748 | # The actual objects are generated when descending, |
@@ -753,12 +760,34 @@ $(vmlinux-dirs): prepare scripts | |||
753 | $(Q)$(MAKE) $(build)=$@ | 760 | $(Q)$(MAKE) $(build)=$@ |
754 | 761 | ||
755 | # Build the kernel release string | 762 | # Build the kernel release string |
756 | # The KERNELRELEASE is stored in a file named include/config/kernel.release | ||
757 | # to be used when executing for example make install or make modules_install | ||
758 | # | 763 | # |
759 | # Take the contents of any files called localversion* and the config | 764 | # The KERNELRELEASE value built here is stored in the file |
760 | # variable CONFIG_LOCALVERSION and append them to KERNELRELEASE. | 765 | # include/config/kernel.release, and is used when executing several |
761 | # LOCALVERSION from the command line override all of this | 766 | # make targets, such as "make install" or "make modules_install." |
767 | # | ||
768 | # The eventual kernel release string consists of the following fields, | ||
769 | # shown in a hierarchical format to show how smaller parts are concatenated | ||
770 | # to form the larger and final value, with values coming from places like | ||
771 | # the Makefile, kernel config options, make command line options and/or | ||
772 | # SCM tag information. | ||
773 | # | ||
774 | # $(KERNELVERSION) | ||
775 | # $(VERSION) eg, 2 | ||
776 | # $(PATCHLEVEL) eg, 6 | ||
777 | # $(SUBLEVEL) eg, 18 | ||
778 | # $(EXTRAVERSION) eg, -rc6 | ||
779 | # $(localver-full) | ||
780 | # $(localver) | ||
781 | # localversion* (all localversion* files) | ||
782 | # $(CONFIG_LOCALVERSION) (from kernel config setting) | ||
783 | # $(localver-auto) (only if CONFIG_LOCALVERSION_AUTO is set) | ||
784 | # ./scripts/setlocalversion (SCM tag, if one exists) | ||
785 | # $(LOCALVERSION) (from make command line if provided) | ||
786 | # | ||
787 | # Note how the final $(localver-auto) string is included *only* if the | ||
788 | # kernel config option CONFIG_LOCALVERSION_AUTO is selected. Also, at the | ||
789 | # moment, only git is supported but other SCMs can edit the script | ||
790 | # scripts/setlocalversion and add the appropriate checks as needed. | ||
762 | 791 | ||
763 | nullstring := | 792 | nullstring := |
764 | space := $(nullstring) # end of line | 793 | space := $(nullstring) # end of line |
@@ -893,14 +922,14 @@ INSTALL_HDR_PATH=$(objtree)/usr | |||
893 | export INSTALL_HDR_PATH | 922 | export INSTALL_HDR_PATH |
894 | 923 | ||
895 | PHONY += headers_install | 924 | PHONY += headers_install |
896 | headers_install: include/linux/version.h | 925 | headers_install: include/linux/version.h scripts_basic FORCE |
897 | $(Q)unifdef -Ux /dev/null | 926 | $(Q)$(MAKE) $(build)=scripts scripts/unifdef |
898 | $(Q)rm -rf $(INSTALL_HDR_PATH)/include | 927 | $(Q)rm -rf $(INSTALL_HDR_PATH)/include |
899 | $(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.headersinst obj=include | 928 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.headersinst obj=include |
900 | 929 | ||
901 | PHONY += headers_check | 930 | PHONY += headers_check |
902 | headers_check: headers_install | 931 | headers_check: headers_install |
903 | $(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.headersinst obj=include HDRCHECK=1 | 932 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.headersinst obj=include HDRCHECK=1 |
904 | 933 | ||
905 | # --------------------------------------------------------------------------- | 934 | # --------------------------------------------------------------------------- |
906 | # Modules | 935 | # Modules |
@@ -916,7 +945,7 @@ all: modules | |||
916 | PHONY += modules | 945 | PHONY += modules |
917 | modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux) | 946 | modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux) |
918 | @echo ' Building modules, stage 2.'; | 947 | @echo ' Building modules, stage 2.'; |
919 | $(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modpost | 948 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost |
920 | 949 | ||
921 | 950 | ||
922 | # Target to prepare building external modules | 951 | # Target to prepare building external modules |
@@ -942,7 +971,7 @@ _modinst_: | |||
942 | rm -f $(MODLIB)/build ; \ | 971 | rm -f $(MODLIB)/build ; \ |
943 | ln -s $(objtree) $(MODLIB)/build ; \ | 972 | ln -s $(objtree) $(MODLIB)/build ; \ |
944 | fi | 973 | fi |
945 | $(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modinst | 974 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst |
946 | 975 | ||
947 | # If System.map exists, run depmod. This deliberately does not have a | 976 | # If System.map exists, run depmod. This deliberately does not have a |
948 | # dependency on System.map since that would run the dependency tree on | 977 | # dependency on System.map since that would run the dependency tree on |
@@ -1057,8 +1086,10 @@ boards := $(notdir $(boards)) | |||
1057 | 1086 | ||
1058 | help: | 1087 | help: |
1059 | @echo 'Cleaning targets:' | 1088 | @echo 'Cleaning targets:' |
1060 | @echo ' clean - remove most generated files but keep the config' | 1089 | @echo ' clean - remove most generated files but keep the config and' |
1090 | @echo ' enough build support to build external modules' | ||
1061 | @echo ' mrproper - remove all generated files + config + various backup files' | 1091 | @echo ' mrproper - remove all generated files + config + various backup files' |
1092 | @echo ' distclean - mrproper + remove editor backup and patch files' | ||
1062 | @echo '' | 1093 | @echo '' |
1063 | @echo 'Configuration targets:' | 1094 | @echo 'Configuration targets:' |
1064 | @$(MAKE) -f $(srctree)/scripts/kconfig/Makefile help | 1095 | @$(MAKE) -f $(srctree)/scripts/kconfig/Makefile help |
@@ -1100,6 +1131,7 @@ help: | |||
1100 | echo '') | 1131 | echo '') |
1101 | 1132 | ||
1102 | @echo ' make V=0|1 [targets] 0 => quiet build (default), 1 => verbose build' | 1133 | @echo ' make V=0|1 [targets] 0 => quiet build (default), 1 => verbose build' |
1134 | @echo ' make V=2 [targets] 2 => give reason for rebuild of target' | ||
1103 | @echo ' make O=dir [targets] Locate all output files in "dir", including .config' | 1135 | @echo ' make O=dir [targets] Locate all output files in "dir", including .config' |
1104 | @echo ' make C=1 [targets] Check all c source with $$CHECK (sparse by default)' | 1136 | @echo ' make C=1 [targets] Check all c source with $$CHECK (sparse by default)' |
1105 | @echo ' make C=2 [targets] Force check of all c source with $$CHECK' | 1137 | @echo ' make C=2 [targets] Force check of all c source with $$CHECK' |
@@ -1154,7 +1186,7 @@ $(module-dirs): crmodverdir $(objtree)/Module.symvers | |||
1154 | 1186 | ||
1155 | modules: $(module-dirs) | 1187 | modules: $(module-dirs) |
1156 | @echo ' Building modules, stage 2.'; | 1188 | @echo ' Building modules, stage 2.'; |
1157 | $(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modpost | 1189 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost |
1158 | 1190 | ||
1159 | PHONY += modules_install | 1191 | PHONY += modules_install |
1160 | modules_install: _emodinst_ _emodinst_post | 1192 | modules_install: _emodinst_ _emodinst_post |
@@ -1163,7 +1195,7 @@ install-dir := $(if $(INSTALL_MOD_DIR),$(INSTALL_MOD_DIR),extra) | |||
1163 | PHONY += _emodinst_ | 1195 | PHONY += _emodinst_ |
1164 | _emodinst_: | 1196 | _emodinst_: |
1165 | $(Q)mkdir -p $(MODLIB)/$(install-dir) | 1197 | $(Q)mkdir -p $(MODLIB)/$(install-dir) |
1166 | $(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modinst | 1198 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst |
1167 | 1199 | ||
1168 | # Run depmod only is we have System.map and depmod is executable | 1200 | # Run depmod only is we have System.map and depmod is executable |
1169 | quiet_cmd_depmod = DEPMOD $(KERNELRELEASE) | 1201 | quiet_cmd_depmod = DEPMOD $(KERNELRELEASE) |
@@ -1264,6 +1296,31 @@ define all-defconfigs | |||
1264 | $(call find-sources,'defconfig') | 1296 | $(call find-sources,'defconfig') |
1265 | endef | 1297 | endef |
1266 | 1298 | ||
1299 | define xtags | ||
1300 | if $1 --version 2>&1 | grep -iq exuberant; then \ | ||
1301 | $(all-sources) | xargs $1 -a \ | ||
1302 | -I __initdata,__exitdata,__acquires,__releases \ | ||
1303 | -I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL \ | ||
1304 | --extra=+f --c-kinds=+px; \ | ||
1305 | $(all-kconfigs) | xargs $1 -a \ | ||
1306 | --langdef=kconfig \ | ||
1307 | --language-force=kconfig \ | ||
1308 | --regex-kconfig='/^[[:blank:]]*config[[:blank:]]+([[:alnum:]_]+)/\1/'; \ | ||
1309 | $(all-defconfigs) | xargs $1 -a \ | ||
1310 | --langdef=dotconfig \ | ||
1311 | --language-force=dotconfig \ | ||
1312 | --regex-dotconfig='/^#?[[:blank:]]*(CONFIG_[[:alnum:]_]+)/\1/'; \ | ||
1313 | elif $1 --version 2>&1 | grep -iq emacs; then \ | ||
1314 | $(all-sources) | xargs $1 -a; \ | ||
1315 | $(all-kconfigs) | xargs $1 -a \ | ||
1316 | --regex='/^[ \t]*config[ \t]+\([a-zA-Z0-9_]+\)/\1/'; \ | ||
1317 | $(all-defconfigs) | xargs $1 -a \ | ||
1318 | --regex='/^#?[ \t]?\(CONFIG_[a-zA-Z0-9_]+\)/\1/'; \ | ||
1319 | else \ | ||
1320 | $(all-sources) | xargs $1 -a; \ | ||
1321 | fi | ||
1322 | endef | ||
1323 | |||
1267 | quiet_cmd_cscope-file = FILELST cscope.files | 1324 | quiet_cmd_cscope-file = FILELST cscope.files |
1268 | cmd_cscope-file = (echo \-k; echo \-q; $(all-sources)) > cscope.files | 1325 | cmd_cscope-file = (echo \-k; echo \-q; $(all-sources)) > cscope.files |
1269 | 1326 | ||
@@ -1277,31 +1334,16 @@ cscope: FORCE | |||
1277 | quiet_cmd_TAGS = MAKE $@ | 1334 | quiet_cmd_TAGS = MAKE $@ |
1278 | define cmd_TAGS | 1335 | define cmd_TAGS |
1279 | rm -f $@; \ | 1336 | rm -f $@; \ |
1280 | ETAGSF=`etags --version | grep -i exuberant >/dev/null && \ | 1337 | $(call xtags,etags) |
1281 | echo "-I __initdata,__exitdata,__acquires,__releases \ | ||
1282 | -I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL \ | ||
1283 | --extra=+f --c-kinds=+px"`; \ | ||
1284 | $(all-sources) | xargs etags $$ETAGSF -a; \ | ||
1285 | if test "x$$ETAGSF" = x; then \ | ||
1286 | $(all-kconfigs) | xargs etags -a \ | ||
1287 | --regex='/^config[ \t]+\([a-zA-Z0-9_]+\)/\1/'; \ | ||
1288 | $(all-defconfigs) | xargs etags -a \ | ||
1289 | --regex='/^#?[ \t]?\(CONFIG_[a-zA-Z0-9_]+\)/\1/'; \ | ||
1290 | fi | ||
1291 | endef | 1338 | endef |
1292 | 1339 | ||
1293 | TAGS: FORCE | 1340 | TAGS: FORCE |
1294 | $(call cmd,TAGS) | 1341 | $(call cmd,TAGS) |
1295 | 1342 | ||
1296 | |||
1297 | quiet_cmd_tags = MAKE $@ | 1343 | quiet_cmd_tags = MAKE $@ |
1298 | define cmd_tags | 1344 | define cmd_tags |
1299 | rm -f $@; \ | 1345 | rm -f $@; \ |
1300 | CTAGSF=`ctags --version | grep -i exuberant >/dev/null && \ | 1346 | $(call xtags,ctags) |
1301 | echo "-I __initdata,__exitdata,__acquires,__releases \ | ||
1302 | -I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL \ | ||
1303 | --extra=+f --c-kinds=+px"`; \ | ||
1304 | $(all-sources) | xargs ctags $$CTAGSF -a | ||
1305 | endef | 1347 | endef |
1306 | 1348 | ||
1307 | tags: FORCE | 1349 | tags: FORCE |
@@ -1379,7 +1421,7 @@ endif | |||
1379 | %.ko: prepare scripts FORCE | 1421 | %.ko: prepare scripts FORCE |
1380 | $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \ | 1422 | $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \ |
1381 | $(build)=$(build-dir) $(@:.ko=.o) | 1423 | $(build)=$(build-dir) $(@:.ko=.o) |
1382 | $(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modpost | 1424 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost |
1383 | 1425 | ||
1384 | # FIXME Should go into a make.lib or something | 1426 | # FIXME Should go into a make.lib or something |
1385 | # =========================================================================== | 1427 | # =========================================================================== |