aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@evo.osdl.org>2005-09-06 03:35:51 -0400
committerLinus Torvalds <torvalds@evo.osdl.org>2005-09-06 03:35:51 -0400
commitef88b7dba2b47c70037a34a599d383462bb74bd3 (patch)
treef50afe82c446cbf93893880878b97339fbdb8f49 /Makefile
parentf65e77693aa5a1cf688fc378bc6913a56f9ff7b7 (diff)
parentaaebf4332018980fef4e601d1b5a6e52dd9e9ae4 (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/sam/kbuild
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile160
1 files changed, 64 insertions, 96 deletions
diff --git a/Makefile b/Makefile
index 2d68adbcfa28..63e5c9f0bc7a 100644
--- a/Makefile
+++ b/Makefile
@@ -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
118skip-makefile := 1 117skip-makefile := 1
@@ -233,7 +232,7 @@ ifeq ($(MAKECMDGOALS),)
233 KBUILD_MODULES := 1 232 KBUILD_MODULES := 1
234endif 233endif
235 234
236export KBUILD_MODULES KBUILD_BUILTIN KBUILD_VERBOSE 235export KBUILD_MODULES KBUILD_BUILTIN
237export KBUILD_CHECKSRC KBUILD_SRC KBUILD_EXTMOD 236export 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
310MAKEFLAGS += --include-dir=$(srctree) 309MAKEFLAGS += --include-dir=$(srctree)
311 310
311# We need some generic definitions
312include $(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
349CPPFLAGS := -D__KERNEL__ $(LINUXINCLUDE) 351CPPFLAGS := -D__KERNEL__ $(LINUXINCLUDE)
350 352
351CFLAGS := -Wall -Wstrict-prototypes -Wno-trigraphs \ 353CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
352 -fno-strict-aliasing -fno-common \ 354 -fno-strict-aliasing -fno-common \
353 -ffreestanding 355 -ffreestanding
354AFLAGS := -D__ASSEMBLY__ 356AFLAGS := -D__ASSEMBLY__
@@ -367,11 +369,6 @@ export AFLAGS AFLAGS_KERNEL AFLAGS_MODULE
367# even be read-only. 369# even be read-only.
368export MODVERDIR := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/).tmp_versions 370export 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
372comma := ,
373depfile = $(subst $(comma),_,$(@D)/.$(@F).d)
374
375# Files to ignore in find ... statements 372# Files to ignore in find ... statements
376 373
377RCS_FIND_IGNORE := \( -name SCCS -o -name BitKeeper -o -name .svn -o -name CVS -o -name .pc -o -name .hg \) -prune -o 374RCS_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
552export INSTALL_PATH ?= /boot 549export 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
566ifdef CONFIG_LOCALVERSION_AUTO
567 localversion-auto := $(shell $(PERL) $(srctree)/scripts/setlocalversion $(srctree))
568 LOCALVERSION := $(LOCALVERSION)$(localversion-auto)
569endif
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
694cmd_ksym_ld = $(cmd_vmlinux__) 712cmd_ksym_ld = $(cmd_vmlinux__)
695define rule_ksym_ld 713define 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
745debug_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
725endif # ifdef CONFIG_KALLSYMS 754endif # 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
757prepare2: 786prepare2:
758ifneq ($(KBUILD_SRC),) 787ifneq ($(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
770prepare1: prepare2 outputmakefile 799prepare1: prepare2 outputmakefile
771 800
772prepare0: prepare1 include/linux/version.h include/asm include/config/MARKER 801prepare0: prepare1 include/linux/version.h include/asm \
802 include/config/MARKER
773ifneq ($(KBUILD_MODULES),) 803ifneq ($(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)/
1160endif 1190endif
1161 1191
1192ALLSOURCE_ARCHS := $(ARCH)
1193
1162define all-sources 1194define 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 )
1177endef 1213endef
1178 1214
1179quiet_cmd_cscope-file = FILELST cscope.files 1215quiet_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
1182quiet_cmd_cscope = MAKE cscope.out 1218quiet_cmd_cscope = MAKE cscope.out
1183 cmd_cscope = cscope -k -b -q 1219 cmd_cscope = cscope -b
1184 1220
1185cscope: FORCE 1221cscope: FORCE
1186 $(call cmd,cscope-file) 1222 $(call cmd,cscope-file)
1187 $(call cmd,cscope) 1223 $(call cmd,cscope)
1188 1224
1189quiet_cmd_TAGS = MAKE $@ 1225quiet_cmd_TAGS = MAKE $@
1190cmd_TAGS = $(all-sources) | etags - 1226define 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
1230endef
1231
1232TAGS: FORCE
1233 $(call cmd,TAGS)
1191 1234
1192# Exuberant ctags works better with -I
1193 1235
1194quiet_cmd_tags = MAKE $@ 1236quiet_cmd_tags = MAKE $@
1195define cmd_tags 1237define cmd_tags
@@ -1198,9 +1240,6 @@ define cmd_tags
1198 $(all-sources) | xargs ctags $$CTAGSF -a 1240 $(all-sources) | xargs ctags $$CTAGSF -a
1199endef 1241endef
1200 1242
1201TAGS: FORCE
1202 $(call cmd,TAGS)
1203
1204tags: FORCE 1243tags: 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)
1269endif 1308endif
1270 1309
1271# Execute command and generate cmd file
1272if_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
1283if_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
1297if_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
1304cmd = @$(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
1319define 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
1330endef
1331
1332# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.build obj=dir
1333# Usage:
1334# $(Q)$(MAKE) $(build)=dir
1335build := -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
1340clean := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.clean obj 1313clean := -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.
1345descend =$(Q)$(MAKE) -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj=$(1) $(2)
1346
1347endif # skip-makefile 1315endif # skip-makefile
1348 1316
1349FORCE: 1317FORCE: