diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 160 |
1 files changed, 64 insertions, 96 deletions
@@ -109,10 +109,9 @@ $(if $(KBUILD_OUTPUT),, \ | |||
109 | .PHONY: $(MAKECMDGOALS) | 109 | .PHONY: $(MAKECMDGOALS) |
110 | 110 | ||
111 | $(filter-out _all,$(MAKECMDGOALS)) _all: | 111 | $(filter-out _all,$(MAKECMDGOALS)) _all: |
112 | $(if $(KBUILD_VERBOSE:1=),@)$(MAKE) -C $(KBUILD_OUTPUT) \ | 112 | $(if $(KBUILD_VERBOSE:1=),@)$(MAKE) -C $(KBUILD_OUTPUT) \ |
113 | KBUILD_SRC=$(CURDIR) KBUILD_VERBOSE=$(KBUILD_VERBOSE) \ | 113 | KBUILD_SRC=$(CURDIR) \ |
114 | KBUILD_CHECK=$(KBUILD_CHECK) KBUILD_EXTMOD="$(KBUILD_EXTMOD)" \ | 114 | KBUILD_EXTMOD="$(KBUILD_EXTMOD)" -f $(CURDIR)/Makefile $@ |
115 | -f $(CURDIR)/Makefile $@ | ||
116 | 115 | ||
117 | # Leave processing to above invocation of make | 116 | # Leave processing to above invocation of make |
118 | skip-makefile := 1 | 117 | skip-makefile := 1 |
@@ -233,7 +232,7 @@ ifeq ($(MAKECMDGOALS),) | |||
233 | KBUILD_MODULES := 1 | 232 | KBUILD_MODULES := 1 |
234 | endif | 233 | endif |
235 | 234 | ||
236 | export KBUILD_MODULES KBUILD_BUILTIN KBUILD_VERBOSE | 235 | export KBUILD_MODULES KBUILD_BUILTIN |
237 | export KBUILD_CHECKSRC KBUILD_SRC KBUILD_EXTMOD | 236 | export KBUILD_CHECKSRC KBUILD_SRC KBUILD_EXTMOD |
238 | 237 | ||
239 | # Beautify output | 238 | # Beautify output |
@@ -309,6 +308,9 @@ cc-version = $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-version.sh \ | |||
309 | # Look for make include files relative to root of kernel src | 308 | # Look for make include files relative to root of kernel src |
310 | MAKEFLAGS += --include-dir=$(srctree) | 309 | MAKEFLAGS += --include-dir=$(srctree) |
311 | 310 | ||
311 | # We need some generic definitions | ||
312 | include $(srctree)/scripts/Kbuild.include | ||
313 | |||
312 | # For maximum performance (+ possibly random breakage, uncomment | 314 | # For maximum performance (+ possibly random breakage, uncomment |
313 | # the following) | 315 | # the following) |
314 | 316 | ||
@@ -348,7 +350,7 @@ LINUXINCLUDE := -Iinclude \ | |||
348 | 350 | ||
349 | CPPFLAGS := -D__KERNEL__ $(LINUXINCLUDE) | 351 | CPPFLAGS := -D__KERNEL__ $(LINUXINCLUDE) |
350 | 352 | ||
351 | CFLAGS := -Wall -Wstrict-prototypes -Wno-trigraphs \ | 353 | CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ |
352 | -fno-strict-aliasing -fno-common \ | 354 | -fno-strict-aliasing -fno-common \ |
353 | -ffreestanding | 355 | -ffreestanding |
354 | AFLAGS := -D__ASSEMBLY__ | 356 | AFLAGS := -D__ASSEMBLY__ |
@@ -367,11 +369,6 @@ export AFLAGS AFLAGS_KERNEL AFLAGS_MODULE | |||
367 | # even be read-only. | 369 | # even be read-only. |
368 | export MODVERDIR := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/).tmp_versions | 370 | export MODVERDIR := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/).tmp_versions |
369 | 371 | ||
370 | # The temporary file to save gcc -MD generated dependencies must not | ||
371 | # contain a comma | ||
372 | comma := , | ||
373 | depfile = $(subst $(comma),_,$(@D)/.$(@F).d) | ||
374 | |||
375 | # Files to ignore in find ... statements | 372 | # Files to ignore in find ... statements |
376 | 373 | ||
377 | RCS_FIND_IGNORE := \( -name SCCS -o -name BitKeeper -o -name .svn -o -name CVS -o -name .pc -o -name .hg \) -prune -o | 374 | RCS_FIND_IGNORE := \( -name SCCS -o -name BitKeeper -o -name .svn -o -name CVS -o -name .pc -o -name .hg \) -prune -o |
@@ -551,6 +548,26 @@ export KBUILD_IMAGE ?= vmlinux | |||
551 | # images. Default is /boot, but you can set it to other values | 548 | # images. Default is /boot, but you can set it to other values |
552 | export INSTALL_PATH ?= /boot | 549 | export INSTALL_PATH ?= /boot |
553 | 550 | ||
551 | # If CONFIG_LOCALVERSION_AUTO is set, we automatically perform some tests | ||
552 | # and try to determine if the current source tree is a release tree, of any sort, | ||
553 | # or if is a pure development tree. | ||
554 | # | ||
555 | # A 'release tree' is any tree with a git TAG associated | ||
556 | # with it. The primary goal of this is to make it safe for a native | ||
557 | # git/CVS/SVN user to build a release tree (i.e, 2.6.9) and also to | ||
558 | # continue developing against the current Linus tree, without having the Linus | ||
559 | # tree overwrite the 2.6.9 tree when installed. | ||
560 | # | ||
561 | # Currently, only git is supported. | ||
562 | # Other SCMs can edit scripts/setlocalversion and add the appropriate | ||
563 | # checks as needed. | ||
564 | |||
565 | |||
566 | ifdef CONFIG_LOCALVERSION_AUTO | ||
567 | localversion-auto := $(shell $(PERL) $(srctree)/scripts/setlocalversion $(srctree)) | ||
568 | LOCALVERSION := $(LOCALVERSION)$(localversion-auto) | ||
569 | endif | ||
570 | |||
554 | # | 571 | # |
555 | # INSTALL_MOD_PATH specifies a prefix to MODLIB for module directory | 572 | # INSTALL_MOD_PATH specifies a prefix to MODLIB for module directory |
556 | # relocations required by build roots. This is not defined in the | 573 | # relocations required by build roots. This is not defined in the |
@@ -691,8 +708,10 @@ endef | |||
691 | 708 | ||
692 | # Update vmlinux version before link | 709 | # Update vmlinux version before link |
693 | # Use + in front of this rule to silent warning about make -j1 | 710 | # Use + in front of this rule to silent warning about make -j1 |
711 | # First command is ':' to allow us to use + in front of this rule | ||
694 | cmd_ksym_ld = $(cmd_vmlinux__) | 712 | cmd_ksym_ld = $(cmd_vmlinux__) |
695 | define rule_ksym_ld | 713 | define rule_ksym_ld |
714 | : | ||
696 | +$(call cmd,vmlinux_version) | 715 | +$(call cmd,vmlinux_version) |
697 | $(call cmd,vmlinux__) | 716 | $(call cmd,vmlinux__) |
698 | $(Q)echo 'cmd_$@ := $(cmd_vmlinux__)' > $(@D)/.$(@F).cmd | 717 | $(Q)echo 'cmd_$@ := $(cmd_vmlinux__)' > $(@D)/.$(@F).cmd |
@@ -722,6 +741,16 @@ quiet_cmd_kallsyms = KSYM $@ | |||
722 | # Needs to visit scripts/ before $(KALLSYMS) can be used. | 741 | # Needs to visit scripts/ before $(KALLSYMS) can be used. |
723 | $(KALLSYMS): scripts ; | 742 | $(KALLSYMS): scripts ; |
724 | 743 | ||
744 | # Generate some data for debugging strange kallsyms problems | ||
745 | debug_kallsyms: .tmp_map$(last_kallsyms) | ||
746 | |||
747 | .tmp_map%: .tmp_vmlinux% FORCE | ||
748 | ($(OBJDUMP) -h $< | $(AWK) '/^ +[0-9]/{print $$4 " 0 " $$2}'; $(NM) $<) | sort > $@ | ||
749 | |||
750 | .tmp_map3: .tmp_map2 | ||
751 | |||
752 | .tmp_map2: .tmp_map1 | ||
753 | |||
725 | endif # ifdef CONFIG_KALLSYMS | 754 | endif # ifdef CONFIG_KALLSYMS |
726 | 755 | ||
727 | # vmlinux image - including updated kernel symbols | 756 | # vmlinux image - including updated kernel symbols |
@@ -757,7 +786,7 @@ $(vmlinux-dirs): prepare-all scripts | |||
757 | prepare2: | 786 | prepare2: |
758 | ifneq ($(KBUILD_SRC),) | 787 | ifneq ($(KBUILD_SRC),) |
759 | @echo ' Using $(srctree) as source for kernel' | 788 | @echo ' Using $(srctree) as source for kernel' |
760 | $(Q)if [ -h $(srctree)/include/asm -o -f $(srctree)/.config ]; then \ | 789 | $(Q)if [ -f $(srctree)/.config ]; then \ |
761 | echo " $(srctree) is not clean, please run 'make mrproper'";\ | 790 | echo " $(srctree) is not clean, please run 'make mrproper'";\ |
762 | echo " in the '$(srctree)' directory.";\ | 791 | echo " in the '$(srctree)' directory.";\ |
763 | /bin/false; \ | 792 | /bin/false; \ |
@@ -769,7 +798,8 @@ endif | |||
769 | # prepare1 creates a makefile if using a separate output directory | 798 | # prepare1 creates a makefile if using a separate output directory |
770 | prepare1: prepare2 outputmakefile | 799 | prepare1: prepare2 outputmakefile |
771 | 800 | ||
772 | prepare0: prepare1 include/linux/version.h include/asm include/config/MARKER | 801 | prepare0: prepare1 include/linux/version.h include/asm \ |
802 | include/config/MARKER | ||
773 | ifneq ($(KBUILD_MODULES),) | 803 | ifneq ($(KBUILD_MODULES),) |
774 | $(Q)rm -rf $(MODVERDIR) | 804 | $(Q)rm -rf $(MODVERDIR) |
775 | $(Q)mkdir -p $(MODVERDIR) | 805 | $(Q)mkdir -p $(MODVERDIR) |
@@ -875,7 +905,7 @@ modules_install: _modinst_ _modinst_post | |||
875 | 905 | ||
876 | .PHONY: _modinst_ | 906 | .PHONY: _modinst_ |
877 | _modinst_: | 907 | _modinst_: |
878 | @if [ -z "`$(DEPMOD) -V | grep module-init-tools`" ]; then \ | 908 | @if [ -z "`$(DEPMOD) -V 2>/dev/null | grep module-init-tools`" ]; then \ |
879 | echo "Warning: you may need to install module-init-tools"; \ | 909 | echo "Warning: you may need to install module-init-tools"; \ |
880 | echo "See http://www.codemonkey.org.uk/docs/post-halloween-2.6.txt";\ | 910 | echo "See http://www.codemonkey.org.uk/docs/post-halloween-2.6.txt";\ |
881 | sleep 1; \ | 911 | sleep 1; \ |
@@ -1159,37 +1189,49 @@ else | |||
1159 | __srctree = $(srctree)/ | 1189 | __srctree = $(srctree)/ |
1160 | endif | 1190 | endif |
1161 | 1191 | ||
1192 | ALLSOURCE_ARCHS := $(ARCH) | ||
1193 | |||
1162 | define all-sources | 1194 | define all-sources |
1163 | ( find $(__srctree) $(RCS_FIND_IGNORE) \ | 1195 | ( find $(__srctree) $(RCS_FIND_IGNORE) \ |
1164 | \( -name include -o -name arch \) -prune -o \ | 1196 | \( -name include -o -name arch \) -prune -o \ |
1165 | -name '*.[chS]' -print; \ | 1197 | -name '*.[chS]' -print; \ |
1166 | find $(__srctree)arch/$(ARCH) $(RCS_FIND_IGNORE) \ | 1198 | for ARCH in $(ALLSOURCE_ARCHS) ; do \ |
1167 | -name '*.[chS]' -print; \ | 1199 | find $(__srctree)arch/$${ARCH} $(RCS_FIND_IGNORE) \ |
1200 | -name '*.[chS]' -print; \ | ||
1201 | done ; \ | ||
1168 | find $(__srctree)security/selinux/include $(RCS_FIND_IGNORE) \ | 1202 | find $(__srctree)security/selinux/include $(RCS_FIND_IGNORE) \ |
1169 | -name '*.[chS]' -print; \ | 1203 | -name '*.[chS]' -print; \ |
1170 | find $(__srctree)include $(RCS_FIND_IGNORE) \ | 1204 | find $(__srctree)include $(RCS_FIND_IGNORE) \ |
1171 | \( -name config -o -name 'asm-*' \) -prune \ | 1205 | \( -name config -o -name 'asm-*' \) -prune \ |
1172 | -o -name '*.[chS]' -print; \ | 1206 | -o -name '*.[chS]' -print; \ |
1173 | find $(__srctree)include/asm-$(ARCH) $(RCS_FIND_IGNORE) \ | 1207 | for ARCH in $(ALLSOURCE_ARCHS) ; do \ |
1174 | -name '*.[chS]' -print; \ | 1208 | find $(__srctree)include/asm-$${ARCH} $(RCS_FIND_IGNORE) \ |
1209 | -name '*.[chS]' -print; \ | ||
1210 | done ; \ | ||
1175 | find $(__srctree)include/asm-generic $(RCS_FIND_IGNORE) \ | 1211 | find $(__srctree)include/asm-generic $(RCS_FIND_IGNORE) \ |
1176 | -name '*.[chS]' -print ) | 1212 | -name '*.[chS]' -print ) |
1177 | endef | 1213 | endef |
1178 | 1214 | ||
1179 | quiet_cmd_cscope-file = FILELST cscope.files | 1215 | quiet_cmd_cscope-file = FILELST cscope.files |
1180 | cmd_cscope-file = $(all-sources) > cscope.files | 1216 | cmd_cscope-file = (echo \-k; echo \-q; $(all-sources)) > cscope.files |
1181 | 1217 | ||
1182 | quiet_cmd_cscope = MAKE cscope.out | 1218 | quiet_cmd_cscope = MAKE cscope.out |
1183 | cmd_cscope = cscope -k -b -q | 1219 | cmd_cscope = cscope -b |
1184 | 1220 | ||
1185 | cscope: FORCE | 1221 | cscope: FORCE |
1186 | $(call cmd,cscope-file) | 1222 | $(call cmd,cscope-file) |
1187 | $(call cmd,cscope) | 1223 | $(call cmd,cscope) |
1188 | 1224 | ||
1189 | quiet_cmd_TAGS = MAKE $@ | 1225 | quiet_cmd_TAGS = MAKE $@ |
1190 | cmd_TAGS = $(all-sources) | etags - | 1226 | define cmd_TAGS |
1227 | rm -f $@; \ | ||
1228 | ETAGSF=`etags --version | grep -i exuberant >/dev/null && echo "-I __initdata,__exitdata,EXPORT_SYMBOL,EXPORT_SYMBOL_GPL --extra=+f"`; \ | ||
1229 | $(all-sources) | xargs etags $$ETAGSF -a | ||
1230 | endef | ||
1231 | |||
1232 | TAGS: FORCE | ||
1233 | $(call cmd,TAGS) | ||
1191 | 1234 | ||
1192 | # Exuberant ctags works better with -I | ||
1193 | 1235 | ||
1194 | quiet_cmd_tags = MAKE $@ | 1236 | quiet_cmd_tags = MAKE $@ |
1195 | define cmd_tags | 1237 | define cmd_tags |
@@ -1198,9 +1240,6 @@ define cmd_tags | |||
1198 | $(all-sources) | xargs ctags $$CTAGSF -a | 1240 | $(all-sources) | xargs ctags $$CTAGSF -a |
1199 | endef | 1241 | endef |
1200 | 1242 | ||
1201 | TAGS: FORCE | ||
1202 | $(call cmd,TAGS) | ||
1203 | |||
1204 | tags: FORCE | 1243 | tags: FORCE |
1205 | $(call cmd,tags) | 1244 | $(call cmd,tags) |
1206 | 1245 | ||
@@ -1268,82 +1307,11 @@ ifneq ($(cmd_files),) | |||
1268 | include $(cmd_files) | 1307 | include $(cmd_files) |
1269 | endif | 1308 | endif |
1270 | 1309 | ||
1271 | # Execute command and generate cmd file | ||
1272 | if_changed = $(if $(strip $? \ | ||
1273 | $(filter-out $(cmd_$(1)),$(cmd_$@))\ | ||
1274 | $(filter-out $(cmd_$@),$(cmd_$(1)))),\ | ||
1275 | @set -e; \ | ||
1276 | $(if $($(quiet)cmd_$(1)),echo ' $(subst ','\'',$($(quiet)cmd_$(1)))';) \ | ||
1277 | $(cmd_$(1)); \ | ||
1278 | echo 'cmd_$@ := $(subst $$,$$$$,$(subst ','\'',$(cmd_$(1))))' > $(@D)/.$(@F).cmd) | ||
1279 | |||
1280 | |||
1281 | # execute the command and also postprocess generated .d dependencies | ||
1282 | # file | ||
1283 | if_changed_dep = $(if $(strip $? $(filter-out FORCE $(wildcard $^),$^)\ | ||
1284 | $(filter-out $(cmd_$(1)),$(cmd_$@))\ | ||
1285 | $(filter-out $(cmd_$@),$(cmd_$(1)))),\ | ||
1286 | $(Q)set -e; \ | ||
1287 | $(if $($(quiet)cmd_$(1)),echo ' $(subst ','\'',$($(quiet)cmd_$(1)))';) \ | ||
1288 | $(cmd_$(1)); \ | ||
1289 | scripts/basic/fixdep $(depfile) $@ '$(subst $$,$$$$,$(subst ','\'',$(cmd_$(1))))' > $(@D)/.$(@F).tmp; \ | ||
1290 | rm -f $(depfile); \ | ||
1291 | mv -f $(@D)/.$(@F).tmp $(@D)/.$(@F).cmd) | ||
1292 | |||
1293 | # Usage: $(call if_changed_rule,foo) | ||
1294 | # will check if $(cmd_foo) changed, or any of the prequisites changed, | ||
1295 | # and if so will execute $(rule_foo) | ||
1296 | |||
1297 | if_changed_rule = $(if $(strip $? \ | ||
1298 | $(filter-out $(cmd_$(1)),$(cmd_$(@F)))\ | ||
1299 | $(filter-out $(cmd_$(@F)),$(cmd_$(1)))),\ | ||
1300 | $(Q)$(rule_$(1))) | ||
1301 | |||
1302 | # If quiet is set, only print short version of command | ||
1303 | |||
1304 | cmd = @$(if $($(quiet)cmd_$(1)),echo ' $($(quiet)cmd_$(1))' &&) $(cmd_$(1)) | ||
1305 | |||
1306 | # filechk is used to check if the content of a generated file is updated. | ||
1307 | # Sample usage: | ||
1308 | # define filechk_sample | ||
1309 | # echo $KERNELRELEASE | ||
1310 | # endef | ||
1311 | # version.h : Makefile | ||
1312 | # $(call filechk,sample) | ||
1313 | # The rule defined shall write to stdout the content of the new file. | ||
1314 | # The existing file will be compared with the new one. | ||
1315 | # - If no file exist it is created | ||
1316 | # - If the content differ the new file is used | ||
1317 | # - If they are equal no change, and no timestamp update | ||
1318 | |||
1319 | define filechk | ||
1320 | @set -e; \ | ||
1321 | echo ' CHK $@'; \ | ||
1322 | mkdir -p $(dir $@); \ | ||
1323 | $(filechk_$(1)) < $< > $@.tmp; \ | ||
1324 | if [ -r $@ ] && cmp -s $@ $@.tmp; then \ | ||
1325 | rm -f $@.tmp; \ | ||
1326 | else \ | ||
1327 | echo ' UPD $@'; \ | ||
1328 | mv -f $@.tmp $@; \ | ||
1329 | fi | ||
1330 | endef | ||
1331 | |||
1332 | # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.build obj=dir | ||
1333 | # Usage: | ||
1334 | # $(Q)$(MAKE) $(build)=dir | ||
1335 | build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj | ||
1336 | |||
1337 | # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.clean obj=dir | 1310 | # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.clean obj=dir |
1338 | # Usage: | 1311 | # Usage: |
1339 | # $(Q)$(MAKE) $(clean)=dir | 1312 | # $(Q)$(MAKE) $(clean)=dir |
1340 | clean := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.clean obj | 1313 | clean := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.clean obj |
1341 | 1314 | ||
1342 | # $(call descend,<dir>,<target>) | ||
1343 | # Recursively call a sub-make in <dir> with target <target> | ||
1344 | # Usage is deprecated, because make does not see this as an invocation of make. | ||
1345 | descend =$(Q)$(MAKE) -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj=$(1) $(2) | ||
1346 | |||
1347 | endif # skip-makefile | 1315 | endif # skip-makefile |
1348 | 1316 | ||
1349 | FORCE: | 1317 | FORCE: |