aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2006-03-29 17:18:49 -0500
committerJeff Garzik <jeff@garzik.org>2006-03-29 17:18:49 -0500
commite02a4cabfcb9a999b74a2e2e6f13ffcb7ff2d606 (patch)
tree2f3db60be4c57eca2a4c3ab3f3122dcf1ec0c624 /Makefile
parent600511e86babe3727264a0883a3a264f6fb6caf5 (diff)
parentf3cab8a0b1a772dc8b055b7affa567a366627c9e (diff)
Merge branch 'master'
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile200
1 files changed, 100 insertions, 100 deletions
diff --git a/Makefile b/Makefile
index 14781f36e327..af6210d48836 100644
--- a/Makefile
+++ b/Makefile
@@ -95,7 +95,7 @@ ifdef O
95endif 95endif
96 96
97# That's our default target when none is given on the command line 97# That's our default target when none is given on the command line
98.PHONY: _all 98PHONY := _all
99_all: 99_all:
100 100
101ifneq ($(KBUILD_OUTPUT),) 101ifneq ($(KBUILD_OUTPUT),)
@@ -106,7 +106,7 @@ KBUILD_OUTPUT := $(shell cd $(KBUILD_OUTPUT) && /bin/pwd)
106$(if $(KBUILD_OUTPUT),, \ 106$(if $(KBUILD_OUTPUT),, \
107 $(error output directory "$(saved-output)" does not exist)) 107 $(error output directory "$(saved-output)" does not exist))
108 108
109.PHONY: $(MAKECMDGOALS) 109PHONY += $(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) \
@@ -123,7 +123,7 @@ ifeq ($(skip-makefile),)
123 123
124# If building an external module we do not care about the all: rule 124# If building an external module we do not care about the all: rule
125# but instead _all depend on modules 125# but instead _all depend on modules
126.PHONY: all 126PHONY += all
127ifeq ($(KBUILD_EXTMOD),) 127ifeq ($(KBUILD_EXTMOD),)
128_all: all 128_all: all
129else 129else
@@ -137,7 +137,7 @@ objtree := $(CURDIR)
137src := $(srctree) 137src := $(srctree)
138obj := $(objtree) 138obj := $(objtree)
139 139
140VPATH := $(srctree) 140VPATH := $(srctree)$(if $(KBUILD_EXTMOD),:$(KBUILD_EXTMOD))
141 141
142export srctree objtree VPATH TOPDIR 142export srctree objtree VPATH TOPDIR
143 143
@@ -151,7 +151,7 @@ export srctree objtree VPATH TOPDIR
151SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \ 151SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
152 -e s/arm.*/arm/ -e s/sa110/arm/ \ 152 -e s/arm.*/arm/ -e s/sa110/arm/ \
153 -e s/s390x/s390/ -e s/parisc64/parisc/ \ 153 -e s/s390x/s390/ -e s/parisc64/parisc/ \
154 -e s/ppc.*/powerpc/ ) 154 -e s/ppc.*/powerpc/ -e s/mips.*/mips/ )
155 155
156# Cross compiling and selecting different set of gcc/bin-utils 156# Cross compiling and selecting different set of gcc/bin-utils
157# --------------------------------------------------------------------------- 157# ---------------------------------------------------------------------------
@@ -258,38 +258,6 @@ endif
258 258
259export quiet Q KBUILD_VERBOSE 259export quiet Q KBUILD_VERBOSE
260 260
261######
262# cc support functions to be used (only) in arch/$(ARCH)/Makefile
263# See documentation in Documentation/kbuild/makefiles.txt
264
265# as-option
266# Usage: cflags-y += $(call as-option, -Wa$(comma)-isa=foo,)
267
268as-option = $(shell if $(CC) $(CFLAGS) $(1) -Wa,-Z -c -o /dev/null \
269 -xassembler /dev/null > /dev/null 2>&1; then echo "$(1)"; \
270 else echo "$(2)"; fi ;)
271
272# cc-option
273# Usage: cflags-y += $(call cc-option, -march=winchip-c6, -march=i586)
274
275cc-option = $(shell if $(CC) $(CFLAGS) $(1) -S -o /dev/null -xc /dev/null \
276 > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;)
277
278# cc-option-yn
279# Usage: flag := $(call cc-option-yn, -march=winchip-c6)
280cc-option-yn = $(shell if $(CC) $(CFLAGS) $(1) -S -o /dev/null -xc /dev/null \
281 > /dev/null 2>&1; then echo "y"; else echo "n"; fi;)
282
283# cc-option-align
284# Prefix align with either -falign or -malign
285cc-option-align = $(subst -functions=0,,\
286 $(call cc-option,-falign-functions=0,-malign-functions=0))
287
288# cc-version
289# Usage gcc-ver := $(call cc-version $(CC))
290cc-version = $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-version.sh \
291 $(if $(1), $(1), $(CC)))
292
293 261
294# Look for make include files relative to root of kernel src 262# Look for make include files relative to root of kernel src
295MAKEFLAGS += --include-dir=$(srctree) 263MAKEFLAGS += --include-dir=$(srctree)
@@ -338,8 +306,7 @@ LINUXINCLUDE := -Iinclude \
338CPPFLAGS := -D__KERNEL__ $(LINUXINCLUDE) 306CPPFLAGS := -D__KERNEL__ $(LINUXINCLUDE)
339 307
340CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ 308CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
341 -fno-strict-aliasing -fno-common \ 309 -fno-strict-aliasing -fno-common
342 -ffreestanding
343AFLAGS := -D__ASSEMBLY__ 310AFLAGS := -D__ASSEMBLY__
344 311
345# Read KERNELRELEASE from .kernelrelease (if it exists) 312# Read KERNELRELEASE from .kernelrelease (if it exists)
@@ -369,14 +336,14 @@ export RCS_TAR_IGNORE := --exclude SCCS --exclude BitKeeper --exclude .svn --exc
369# Rules shared between *config targets and build targets 336# Rules shared between *config targets and build targets
370 337
371# Basic helpers built in scripts/ 338# Basic helpers built in scripts/
372.PHONY: scripts_basic 339PHONY += scripts_basic
373scripts_basic: 340scripts_basic:
374 $(Q)$(MAKE) $(build)=scripts/basic 341 $(Q)$(MAKE) $(build)=scripts/basic
375 342
376# To avoid any implicit rule to kick in, define an empty command. 343# To avoid any implicit rule to kick in, define an empty command.
377scripts/basic/%: scripts_basic ; 344scripts/basic/%: scripts_basic ;
378 345
379.PHONY: outputmakefile 346PHONY += outputmakefile
380# outputmakefile generate a Makefile to be placed in output directory, if 347# outputmakefile generate a Makefile to be placed in output directory, if
381# using a seperate output directory. This allows convinient use 348# using a seperate output directory. This allows convinient use
382# of make in output directory 349# of make in output directory
@@ -452,7 +419,7 @@ ifeq ($(KBUILD_EXTMOD),)
452# Additional helpers built in scripts/ 419# Additional helpers built in scripts/
453# Carefully list dependencies so we do not try to build scripts twice 420# Carefully list dependencies so we do not try to build scripts twice
454# in parrallel 421# in parrallel
455.PHONY: scripts 422PHONY += scripts
456scripts: scripts_basic include/config/MARKER 423scripts: scripts_basic include/config/MARKER
457 $(Q)$(MAKE) $(build)=$(@) 424 $(Q)$(MAKE) $(build)=$(@)
458 425
@@ -504,13 +471,6 @@ else
504CFLAGS += -O2 471CFLAGS += -O2
505endif 472endif
506 473
507#Add align options if CONFIG_CC_* is not equal to 0
508add-align = $(if $(filter-out 0,$($(1))),$(cc-option-align)$(2)=$($(1)))
509CFLAGS += $(call add-align,CONFIG_CC_ALIGN_FUNCTIONS,-functions)
510CFLAGS += $(call add-align,CONFIG_CC_ALIGN_LABELS,-labels)
511CFLAGS += $(call add-align,CONFIG_CC_ALIGN_LOOPS,-loops)
512CFLAGS += $(call add-align,CONFIG_CC_ALIGN_JUMPS,-jumps)
513
514ifdef CONFIG_FRAME_POINTER 474ifdef CONFIG_FRAME_POINTER
515CFLAGS += -fno-omit-frame-pointer $(call cc-option,-fno-optimize-sibling-calls,) 475CFLAGS += -fno-omit-frame-pointer $(call cc-option,-fno-optimize-sibling-calls,)
516else 476else
@@ -756,7 +716,7 @@ $(sort $(vmlinux-init) $(vmlinux-main)) $(vmlinux-lds): $(vmlinux-dirs) ;
756# make menuconfig etc. 716# make menuconfig etc.
757# Error messages still appears in the original language 717# Error messages still appears in the original language
758 718
759.PHONY: $(vmlinux-dirs) 719PHONY += $(vmlinux-dirs)
760$(vmlinux-dirs): prepare scripts 720$(vmlinux-dirs): prepare scripts
761 $(Q)$(MAKE) $(build)=$@ 721 $(Q)$(MAKE) $(build)=$@
762 722
@@ -809,10 +769,10 @@ kernelrelease = $(KERNELVERSION)$(localver-full)
809# version.h and scripts_basic is processed / created. 769# version.h and scripts_basic is processed / created.
810 770
811# Listed in dependency order 771# Listed in dependency order
812.PHONY: prepare archprepare prepare0 prepare1 prepare2 prepare3 772PHONY += prepare archprepare prepare0 prepare1 prepare2 prepare3
813 773
814# prepare-all is deprecated, use prepare as valid replacement 774# prepare-all is deprecated, use prepare as valid replacement
815.PHONY: prepare-all 775PHONY += prepare-all
816 776
817# prepare3 is used to check if we are building in a separate output directory, 777# prepare3 is used to check if we are building in a separate output directory,
818# and if so do: 778# and if so do:
@@ -853,27 +813,6 @@ prepare prepare-all: prepare0
853 813
854export CPPFLAGS_vmlinux.lds += -P -C -U$(ARCH) 814export CPPFLAGS_vmlinux.lds += -P -C -U$(ARCH)
855 815
856# Single targets
857# ---------------------------------------------------------------------------
858
859%.s: %.c scripts FORCE
860 $(Q)$(MAKE) $(build)=$(@D) $@
861%.i: %.c scripts FORCE
862 $(Q)$(MAKE) $(build)=$(@D) $@
863%.o: %.c scripts FORCE
864 $(Q)$(MAKE) $(build)=$(@D) $@
865%.ko: scripts FORCE
866 $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) $(build)=$(@D) $(@:.ko=.o)
867 $(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modpost
868%/: scripts prepare FORCE
869 $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) $(build)=$(@D)
870%.lst: %.c scripts FORCE
871 $(Q)$(MAKE) $(build)=$(@D) $@
872%.s: %.S scripts FORCE
873 $(Q)$(MAKE) $(build)=$(@D) $@
874%.o: %.S scripts FORCE
875 $(Q)$(MAKE) $(build)=$(@D) $@
876
877# FIXME: The asm symlink changes when $(ARCH) changes. That's 816# FIXME: The asm symlink changes when $(ARCH) changes. That's
878# hard to detect, but I suppose "make mrproper" is a good idea 817# hard to detect, but I suppose "make mrproper" is a good idea
879# before switching between archs anyway. 818# before switching between archs anyway.
@@ -914,7 +853,7 @@ include/linux/version.h: $(srctree)/Makefile .config .kernelrelease FORCE
914 853
915# --------------------------------------------------------------------------- 854# ---------------------------------------------------------------------------
916 855
917.PHONY: depend dep 856PHONY += depend dep
918depend dep: 857depend dep:
919 @echo '*** Warning: make $@ is unnecessary now.' 858 @echo '*** Warning: make $@ is unnecessary now.'
920 859
@@ -929,21 +868,21 @@ all: modules
929 868
930# Build modules 869# Build modules
931 870
932.PHONY: modules 871PHONY += modules
933modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux) 872modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux)
934 @echo ' Building modules, stage 2.'; 873 @echo ' Building modules, stage 2.';
935 $(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modpost 874 $(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modpost
936 875
937 876
938# Target to prepare building external modules 877# Target to prepare building external modules
939.PHONY: modules_prepare 878PHONY += modules_prepare
940modules_prepare: prepare scripts 879modules_prepare: prepare scripts
941 880
942# Target to install modules 881# Target to install modules
943.PHONY: modules_install 882PHONY += modules_install
944modules_install: _modinst_ _modinst_post 883modules_install: _modinst_ _modinst_post
945 884
946.PHONY: _modinst_ 885PHONY += _modinst_
947_modinst_: 886_modinst_:
948 @if [ -z "`$(DEPMOD) -V 2>/dev/null | grep module-init-tools`" ]; then \ 887 @if [ -z "`$(DEPMOD) -V 2>/dev/null | grep module-init-tools`" ]; then \
949 echo "Warning: you may need to install module-init-tools"; \ 888 echo "Warning: you may need to install module-init-tools"; \
@@ -970,7 +909,7 @@ depmod_opts :=
970else 909else
971depmod_opts := -b $(INSTALL_MOD_PATH) -r 910depmod_opts := -b $(INSTALL_MOD_PATH) -r
972endif 911endif
973.PHONY: _modinst_post 912PHONY += _modinst_post
974_modinst_post: _modinst_ 913_modinst_post: _modinst_
975 if [ -r System.map -a -x $(DEPMOD) ]; then $(DEPMOD) -ae -F System.map $(depmod_opts) $(KERNELRELEASE); fi 914 if [ -r System.map -a -x $(DEPMOD) ]; then $(DEPMOD) -ae -F System.map $(depmod_opts) $(KERNELRELEASE); fi
976 915
@@ -1013,7 +952,7 @@ clean: rm-dirs := $(CLEAN_DIRS)
1013clean: rm-files := $(CLEAN_FILES) 952clean: rm-files := $(CLEAN_FILES)
1014clean-dirs := $(addprefix _clean_,$(srctree) $(vmlinux-alldirs)) 953clean-dirs := $(addprefix _clean_,$(srctree) $(vmlinux-alldirs))
1015 954
1016.PHONY: $(clean-dirs) clean archclean 955PHONY += $(clean-dirs) clean archclean
1017$(clean-dirs): 956$(clean-dirs):
1018 $(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@) 957 $(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@)
1019 958
@@ -1031,7 +970,7 @@ mrproper: rm-dirs := $(wildcard $(MRPROPER_DIRS))
1031mrproper: rm-files := $(wildcard $(MRPROPER_FILES)) 970mrproper: rm-files := $(wildcard $(MRPROPER_FILES))
1032mrproper-dirs := $(addprefix _mrproper_,Documentation/DocBook scripts) 971mrproper-dirs := $(addprefix _mrproper_,Documentation/DocBook scripts)
1033 972
1034.PHONY: $(mrproper-dirs) mrproper archmrproper 973PHONY += $(mrproper-dirs) mrproper archmrproper
1035$(mrproper-dirs): 974$(mrproper-dirs):
1036 $(Q)$(MAKE) $(clean)=$(patsubst _mrproper_%,%,$@) 975 $(Q)$(MAKE) $(clean)=$(patsubst _mrproper_%,%,$@)
1037 976
@@ -1041,7 +980,7 @@ mrproper: clean archmrproper $(mrproper-dirs)
1041 980
1042# distclean 981# distclean
1043# 982#
1044.PHONY: distclean 983PHONY += distclean
1045 984
1046distclean: mrproper 985distclean: mrproper
1047 @find $(srctree) $(RCS_FIND_IGNORE) \ 986 @find $(srctree) $(RCS_FIND_IGNORE) \
@@ -1057,12 +996,10 @@ distclean: mrproper
1057# rpm target kept for backward compatibility 996# rpm target kept for backward compatibility
1058package-dir := $(srctree)/scripts/package 997package-dir := $(srctree)/scripts/package
1059 998
1060.PHONY: %-pkg rpm
1061
1062%pkg: FORCE 999%pkg: FORCE
1063 $(Q)$(MAKE) -f $(package-dir)/Makefile $@ 1000 $(Q)$(MAKE) $(build)=$(package-dir) $@
1064rpm: FORCE 1001rpm: FORCE
1065 $(Q)$(MAKE) -f $(package-dir)/Makefile $@ 1002 $(Q)$(MAKE) $(build)=$(package-dir) $@
1066 1003
1067 1004
1068# Brief documentation of the typical targets used 1005# Brief documentation of the typical targets used
@@ -1094,13 +1031,11 @@ help:
1094 @echo ' kernelversion - Output the version stored in Makefile' 1031 @echo ' kernelversion - Output the version stored in Makefile'
1095 @echo '' 1032 @echo ''
1096 @echo 'Static analysers' 1033 @echo 'Static analysers'
1097 @echo ' buildcheck - List dangling references to vmlinux discarded sections'
1098 @echo ' and init sections from non-init sections'
1099 @echo ' checkstack - Generate a list of stack hogs' 1034 @echo ' checkstack - Generate a list of stack hogs'
1100 @echo ' namespacecheck - Name space analysis on compiled kernel' 1035 @echo ' namespacecheck - Name space analysis on compiled kernel'
1101 @echo '' 1036 @echo ''
1102 @echo 'Kernel packaging:' 1037 @echo 'Kernel packaging:'
1103 @$(MAKE) -f $(package-dir)/Makefile help 1038 @$(MAKE) $(build)=$(package-dir) help
1104 @echo '' 1039 @echo ''
1105 @echo 'Documentation targets:' 1040 @echo 'Documentation targets:'
1106 @$(MAKE) -f $(srctree)/Documentation/DocBook/Makefile dochelp 1041 @$(MAKE) -f $(srctree)/Documentation/DocBook/Makefile dochelp
@@ -1149,11 +1084,12 @@ else # KBUILD_EXTMOD
1149 1084
1150# We are always building modules 1085# We are always building modules
1151KBUILD_MODULES := 1 1086KBUILD_MODULES := 1
1152.PHONY: crmodverdir 1087PHONY += crmodverdir
1153crmodverdir: 1088crmodverdir:
1089 $(Q)rm -rf $(MODVERDIR)
1154 $(Q)mkdir -p $(MODVERDIR) 1090 $(Q)mkdir -p $(MODVERDIR)
1155 1091
1156.PHONY: $(objtree)/Module.symvers 1092PHONY += $(objtree)/Module.symvers
1157$(objtree)/Module.symvers: 1093$(objtree)/Module.symvers:
1158 @test -e $(objtree)/Module.symvers || ( \ 1094 @test -e $(objtree)/Module.symvers || ( \
1159 echo; \ 1095 echo; \
@@ -1162,7 +1098,7 @@ $(objtree)/Module.symvers:
1162 echo ) 1098 echo )
1163 1099
1164module-dirs := $(addprefix _module_,$(KBUILD_EXTMOD)) 1100module-dirs := $(addprefix _module_,$(KBUILD_EXTMOD))
1165.PHONY: $(module-dirs) modules 1101PHONY += $(module-dirs) modules
1166$(module-dirs): crmodverdir $(objtree)/Module.symvers 1102$(module-dirs): crmodverdir $(objtree)/Module.symvers
1167 $(Q)$(MAKE) $(build)=$(patsubst _module_%,%,$@) 1103 $(Q)$(MAKE) $(build)=$(patsubst _module_%,%,$@)
1168 1104
@@ -1170,13 +1106,32 @@ modules: $(module-dirs)
1170 @echo ' Building modules, stage 2.'; 1106 @echo ' Building modules, stage 2.';
1171 $(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modpost 1107 $(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modpost
1172 1108
1173.PHONY: modules_install 1109PHONY += modules_install
1174modules_install: 1110modules_install: _emodinst_ _emodinst_post
1111
1112install-dir := $(if $(INSTALL_MOD_DIR),$(INSTALL_MOD_DIR),extra)
1113PHONY += _emodinst_
1114_emodinst_:
1115 $(Q)rm -rf $(MODLIB)/$(install-dir)
1116 $(Q)mkdir -p $(MODLIB)/$(install-dir)
1175 $(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modinst 1117 $(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modinst
1176 1118
1119# Run depmod only is we have System.map and depmod is executable
1120quiet_cmd_depmod = DEPMOD $(KERNELRELEASE)
1121 cmd_depmod = if [ -r System.map -a -x $(DEPMOD) ]; then \
1122 $(DEPMOD) -ae -F System.map \
1123 $(if $(strip $(INSTALL_MOD_PATH)), \
1124 -b $(INSTALL_MOD_PATH) -r) \
1125 $(KERNELRELEASE); \
1126 fi
1127
1128PHONY += _emodinst_post
1129_emodinst_post: _emodinst_
1130 $(call cmd,depmod)
1131
1177clean-dirs := $(addprefix _clean_,$(KBUILD_EXTMOD)) 1132clean-dirs := $(addprefix _clean_,$(KBUILD_EXTMOD))
1178 1133
1179.PHONY: $(clean-dirs) clean 1134PHONY += $(clean-dirs) clean
1180$(clean-dirs): 1135$(clean-dirs):
1181 $(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@) 1136 $(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@)
1182 1137
@@ -1196,6 +1151,11 @@ help:
1196 @echo ' modules_install - install the module' 1151 @echo ' modules_install - install the module'
1197 @echo ' clean - remove generated files in module directory only' 1152 @echo ' clean - remove generated files in module directory only'
1198 @echo '' 1153 @echo ''
1154
1155# Dummies...
1156PHONY += prepare scripts
1157prepare: ;
1158scripts: ;
1199endif # KBUILD_EXTMOD 1159endif # KBUILD_EXTMOD
1200 1160
1201# Generate tags for editors 1161# Generate tags for editors
@@ -1296,17 +1256,13 @@ versioncheck:
1296 -name '*.[hcS]' -type f -print | sort \ 1256 -name '*.[hcS]' -type f -print | sort \
1297 | xargs $(PERL) -w scripts/checkversion.pl 1257 | xargs $(PERL) -w scripts/checkversion.pl
1298 1258
1299buildcheck:
1300 $(PERL) $(srctree)/scripts/reference_discarded.pl
1301 $(PERL) $(srctree)/scripts/reference_init.pl
1302
1303namespacecheck: 1259namespacecheck:
1304 $(PERL) $(srctree)/scripts/namespace.pl 1260 $(PERL) $(srctree)/scripts/namespace.pl
1305 1261
1306endif #ifeq ($(config-targets),1) 1262endif #ifeq ($(config-targets),1)
1307endif #ifeq ($(mixed-targets),1) 1263endif #ifeq ($(mixed-targets),1)
1308 1264
1309.PHONY: checkstack 1265PHONY += checkstack
1310checkstack: 1266checkstack:
1311 $(OBJDUMP) -d vmlinux $$(find . -name '*.ko') | \ 1267 $(OBJDUMP) -d vmlinux $$(find . -name '*.ko') | \
1312 $(PERL) $(src)/scripts/checkstack.pl $(ARCH) 1268 $(PERL) $(src)/scripts/checkstack.pl $(ARCH)
@@ -1317,6 +1273,44 @@ kernelrelease:
1317kernelversion: 1273kernelversion:
1318 @echo $(KERNELVERSION) 1274 @echo $(KERNELVERSION)
1319 1275
1276# Single targets
1277# ---------------------------------------------------------------------------
1278# The directory part is taken from first prerequisite, so this
1279# works even with external modules
1280%.s: %.c prepare scripts FORCE
1281 $(Q)$(MAKE) $(build)=$(dir $<) $(dir $<)$(notdir $@)
1282%.i: %.c prepare scripts FORCE
1283 $(Q)$(MAKE) $(build)=$(dir $<) $(dir $<)$(notdir $@)
1284%.o: %.c prepare scripts FORCE
1285 $(Q)$(MAKE) $(build)=$(dir $<) $(dir $<)$(notdir $@)
1286%.lst: %.c prepare scripts FORCE
1287 $(Q)$(MAKE) $(build)=$(dir $<) $(dir $<)$(notdir $@)
1288%.s: %.S prepare scripts FORCE
1289 $(Q)$(MAKE) $(build)=$(dir $<) $(dir $<)$(notdir $@)
1290%.o: %.S prepare scripts FORCE
1291 $(Q)$(MAKE) $(build)=$(dir $<) $(dir $<)$(notdir $@)
1292
1293# For external modules we shall include any directory of the target,
1294# but usual case there is no directory part.
1295# make M=`pwd` module.o => $(dir $@)=./
1296# make M=`pwd` foo/module.o => $(dir $@)=foo/
1297# make M=`pwd` / => $(dir $@)=/
1298
1299ifeq ($(KBUILD_EXTMOD),)
1300 target-dir = $(@D)
1301else
1302 zap-slash=$(filter-out .,$(patsubst %/,%,$(dir $@)))
1303 target-dir = $(KBUILD_EXTMOD)$(if $(zap-slash),/$(zap-slash))
1304endif
1305
1306/ %/: scripts prepare FORCE
1307 $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
1308 $(build)=$(target-dir)
1309%.ko: scripts FORCE
1310 $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
1311 $(build)=$(target-dir) $(@:.ko=.o)
1312 $(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modpost
1313
1320# FIXME Should go into a make.lib or something 1314# FIXME Should go into a make.lib or something
1321# =========================================================================== 1315# ===========================================================================
1322 1316
@@ -1351,4 +1345,10 @@ clean := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.clean obj
1351 1345
1352endif # skip-makefile 1346endif # skip-makefile
1353 1347
1348PHONY += FORCE
1354FORCE: 1349FORCE:
1350
1351
1352# Declare the contents of the .PHONY variable as phony. We keep that
1353# information in a variable se we can use it in if_changed and friends.
1354.PHONY: $(PHONY)