diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-25 11:48:48 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-25 11:48:48 -0500 |
commit | 2e1ca21d46aaef95101723fa402f39d3a95aba59 (patch) | |
tree | cd95efefb9ccb6ab4ac0589d01c06cdfc22cc989 /Makefile | |
parent | 315ab19a6d12d6af7b6957090822f3057ab7e80f (diff) | |
parent | eae0f536f640bb95f2ad437a57c40c7d5683d1ac (diff) |
Merge master.kernel.org:/pub/scm/linux/kernel/git/sam/kbuild
* master.kernel.org:/pub/scm/linux/kernel/git/sam/kbuild: (46 commits)
kbuild: remove obsoleted scripts/reference_* files
kbuild: fix make help & make *pkg
kconfig: fix time ordering of writes to .kconfig.d and include/linux/autoconf.h
Kconfig: remove the CONFIG_CC_ALIGN_* options
kbuild: add -fverbose-asm to i386 Makefile
kbuild: clean-up genksyms
kbuild: Lindent genksyms.c
kbuild: fix genksyms build error
kbuild: in makefile.txt note that Makefile is preferred name for kbuild files
kbuild: replace PHONY with FORCE
kbuild: Fix bug in crc symbol generating of kernel and modules
kbuild: change kbuild to not rely on incorrect GNU make behavior
kbuild: when warning symbols exported twice now tell user this is the problem
kbuild: fix make dir/file.xx when asm symlink is missing
kbuild: in the section mismatch check try harder to find symbols
kbuild: fix section mismatch check for unwind on IA64
kbuild: kill false positives from section mismatch warnings for powerpc
kbuild: kill trailing whitespace in modpost & friends
kbuild: small update of allnoconfig description
kbuild: make namespace.pl CROSS_COMPILE happy
...
Trivial conflict in arch/ppc/boot/Makefile manually fixed up
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 197 |
1 files changed, 99 insertions, 98 deletions
@@ -95,7 +95,7 @@ ifdef O | |||
95 | endif | 95 | endif |
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 | 98 | PHONY := _all |
99 | _all: | 99 | _all: |
100 | 100 | ||
101 | ifneq ($(KBUILD_OUTPUT),) | 101 | ifneq ($(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) | 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) \ |
@@ -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 | 126 | PHONY += all |
127 | ifeq ($(KBUILD_EXTMOD),) | 127 | ifeq ($(KBUILD_EXTMOD),) |
128 | _all: all | 128 | _all: all |
129 | else | 129 | else |
@@ -137,7 +137,7 @@ objtree := $(CURDIR) | |||
137 | src := $(srctree) | 137 | src := $(srctree) |
138 | obj := $(objtree) | 138 | obj := $(objtree) |
139 | 139 | ||
140 | VPATH := $(srctree) | 140 | VPATH := $(srctree)$(if $(KBUILD_EXTMOD),:$(KBUILD_EXTMOD)) |
141 | 141 | ||
142 | export srctree objtree VPATH TOPDIR | 142 | export srctree objtree VPATH TOPDIR |
143 | 143 | ||
@@ -151,7 +151,7 @@ export srctree objtree VPATH TOPDIR | |||
151 | SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \ | 151 | SUBARCH := $(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 | ||
259 | export quiet Q KBUILD_VERBOSE | 259 | export 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 | |||
268 | as-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 | |||
275 | cc-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) | ||
280 | cc-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 | ||
285 | cc-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)) | ||
290 | cc-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 |
295 | MAKEFLAGS += --include-dir=$(srctree) | 263 | MAKEFLAGS += --include-dir=$(srctree) |
@@ -369,14 +337,14 @@ export RCS_TAR_IGNORE := --exclude SCCS --exclude BitKeeper --exclude .svn --exc | |||
369 | # Rules shared between *config targets and build targets | 337 | # Rules shared between *config targets and build targets |
370 | 338 | ||
371 | # Basic helpers built in scripts/ | 339 | # Basic helpers built in scripts/ |
372 | .PHONY: scripts_basic | 340 | PHONY += scripts_basic |
373 | scripts_basic: | 341 | scripts_basic: |
374 | $(Q)$(MAKE) $(build)=scripts/basic | 342 | $(Q)$(MAKE) $(build)=scripts/basic |
375 | 343 | ||
376 | # To avoid any implicit rule to kick in, define an empty command. | 344 | # To avoid any implicit rule to kick in, define an empty command. |
377 | scripts/basic/%: scripts_basic ; | 345 | scripts/basic/%: scripts_basic ; |
378 | 346 | ||
379 | .PHONY: outputmakefile | 347 | PHONY += outputmakefile |
380 | # outputmakefile generate a Makefile to be placed in output directory, if | 348 | # outputmakefile generate a Makefile to be placed in output directory, if |
381 | # using a seperate output directory. This allows convinient use | 349 | # using a seperate output directory. This allows convinient use |
382 | # of make in output directory | 350 | # of make in output directory |
@@ -452,7 +420,7 @@ ifeq ($(KBUILD_EXTMOD),) | |||
452 | # Additional helpers built in scripts/ | 420 | # Additional helpers built in scripts/ |
453 | # Carefully list dependencies so we do not try to build scripts twice | 421 | # Carefully list dependencies so we do not try to build scripts twice |
454 | # in parrallel | 422 | # in parrallel |
455 | .PHONY: scripts | 423 | PHONY += scripts |
456 | scripts: scripts_basic include/config/MARKER | 424 | scripts: scripts_basic include/config/MARKER |
457 | $(Q)$(MAKE) $(build)=$(@) | 425 | $(Q)$(MAKE) $(build)=$(@) |
458 | 426 | ||
@@ -504,13 +472,6 @@ else | |||
504 | CFLAGS += -O2 | 472 | CFLAGS += -O2 |
505 | endif | 473 | endif |
506 | 474 | ||
507 | #Add align options if CONFIG_CC_* is not equal to 0 | ||
508 | add-align = $(if $(filter-out 0,$($(1))),$(cc-option-align)$(2)=$($(1))) | ||
509 | CFLAGS += $(call add-align,CONFIG_CC_ALIGN_FUNCTIONS,-functions) | ||
510 | CFLAGS += $(call add-align,CONFIG_CC_ALIGN_LABELS,-labels) | ||
511 | CFLAGS += $(call add-align,CONFIG_CC_ALIGN_LOOPS,-loops) | ||
512 | CFLAGS += $(call add-align,CONFIG_CC_ALIGN_JUMPS,-jumps) | ||
513 | |||
514 | ifdef CONFIG_FRAME_POINTER | 475 | ifdef CONFIG_FRAME_POINTER |
515 | CFLAGS += -fno-omit-frame-pointer $(call cc-option,-fno-optimize-sibling-calls,) | 476 | CFLAGS += -fno-omit-frame-pointer $(call cc-option,-fno-optimize-sibling-calls,) |
516 | else | 477 | else |
@@ -756,7 +717,7 @@ $(sort $(vmlinux-init) $(vmlinux-main)) $(vmlinux-lds): $(vmlinux-dirs) ; | |||
756 | # make menuconfig etc. | 717 | # make menuconfig etc. |
757 | # Error messages still appears in the original language | 718 | # Error messages still appears in the original language |
758 | 719 | ||
759 | .PHONY: $(vmlinux-dirs) | 720 | PHONY += $(vmlinux-dirs) |
760 | $(vmlinux-dirs): prepare scripts | 721 | $(vmlinux-dirs): prepare scripts |
761 | $(Q)$(MAKE) $(build)=$@ | 722 | $(Q)$(MAKE) $(build)=$@ |
762 | 723 | ||
@@ -809,10 +770,10 @@ kernelrelease = $(KERNELVERSION)$(localver-full) | |||
809 | # version.h and scripts_basic is processed / created. | 770 | # version.h and scripts_basic is processed / created. |
810 | 771 | ||
811 | # Listed in dependency order | 772 | # Listed in dependency order |
812 | .PHONY: prepare archprepare prepare0 prepare1 prepare2 prepare3 | 773 | PHONY += prepare archprepare prepare0 prepare1 prepare2 prepare3 |
813 | 774 | ||
814 | # prepare-all is deprecated, use prepare as valid replacement | 775 | # prepare-all is deprecated, use prepare as valid replacement |
815 | .PHONY: prepare-all | 776 | PHONY += prepare-all |
816 | 777 | ||
817 | # prepare3 is used to check if we are building in a separate output directory, | 778 | # prepare3 is used to check if we are building in a separate output directory, |
818 | # and if so do: | 779 | # and if so do: |
@@ -853,27 +814,6 @@ prepare prepare-all: prepare0 | |||
853 | 814 | ||
854 | export CPPFLAGS_vmlinux.lds += -P -C -U$(ARCH) | 815 | export CPPFLAGS_vmlinux.lds += -P -C -U$(ARCH) |
855 | 816 | ||
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 | 817 | # FIXME: The asm symlink changes when $(ARCH) changes. That's |
878 | # hard to detect, but I suppose "make mrproper" is a good idea | 818 | # hard to detect, but I suppose "make mrproper" is a good idea |
879 | # before switching between archs anyway. | 819 | # before switching between archs anyway. |
@@ -914,7 +854,7 @@ include/linux/version.h: $(srctree)/Makefile .config .kernelrelease FORCE | |||
914 | 854 | ||
915 | # --------------------------------------------------------------------------- | 855 | # --------------------------------------------------------------------------- |
916 | 856 | ||
917 | .PHONY: depend dep | 857 | PHONY += depend dep |
918 | depend dep: | 858 | depend dep: |
919 | @echo '*** Warning: make $@ is unnecessary now.' | 859 | @echo '*** Warning: make $@ is unnecessary now.' |
920 | 860 | ||
@@ -929,21 +869,21 @@ all: modules | |||
929 | 869 | ||
930 | # Build modules | 870 | # Build modules |
931 | 871 | ||
932 | .PHONY: modules | 872 | PHONY += modules |
933 | modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux) | 873 | modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux) |
934 | @echo ' Building modules, stage 2.'; | 874 | @echo ' Building modules, stage 2.'; |
935 | $(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modpost | 875 | $(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modpost |
936 | 876 | ||
937 | 877 | ||
938 | # Target to prepare building external modules | 878 | # Target to prepare building external modules |
939 | .PHONY: modules_prepare | 879 | PHONY += modules_prepare |
940 | modules_prepare: prepare scripts | 880 | modules_prepare: prepare scripts |
941 | 881 | ||
942 | # Target to install modules | 882 | # Target to install modules |
943 | .PHONY: modules_install | 883 | PHONY += modules_install |
944 | modules_install: _modinst_ _modinst_post | 884 | modules_install: _modinst_ _modinst_post |
945 | 885 | ||
946 | .PHONY: _modinst_ | 886 | PHONY += _modinst_ |
947 | _modinst_: | 887 | _modinst_: |
948 | @if [ -z "`$(DEPMOD) -V 2>/dev/null | grep module-init-tools`" ]; then \ | 888 | @if [ -z "`$(DEPMOD) -V 2>/dev/null | grep module-init-tools`" ]; then \ |
949 | echo "Warning: you may need to install module-init-tools"; \ | 889 | echo "Warning: you may need to install module-init-tools"; \ |
@@ -970,7 +910,7 @@ depmod_opts := | |||
970 | else | 910 | else |
971 | depmod_opts := -b $(INSTALL_MOD_PATH) -r | 911 | depmod_opts := -b $(INSTALL_MOD_PATH) -r |
972 | endif | 912 | endif |
973 | .PHONY: _modinst_post | 913 | PHONY += _modinst_post |
974 | _modinst_post: _modinst_ | 914 | _modinst_post: _modinst_ |
975 | if [ -r System.map -a -x $(DEPMOD) ]; then $(DEPMOD) -ae -F System.map $(depmod_opts) $(KERNELRELEASE); fi | 915 | if [ -r System.map -a -x $(DEPMOD) ]; then $(DEPMOD) -ae -F System.map $(depmod_opts) $(KERNELRELEASE); fi |
976 | 916 | ||
@@ -1013,7 +953,7 @@ clean: rm-dirs := $(CLEAN_DIRS) | |||
1013 | clean: rm-files := $(CLEAN_FILES) | 953 | clean: rm-files := $(CLEAN_FILES) |
1014 | clean-dirs := $(addprefix _clean_,$(srctree) $(vmlinux-alldirs)) | 954 | clean-dirs := $(addprefix _clean_,$(srctree) $(vmlinux-alldirs)) |
1015 | 955 | ||
1016 | .PHONY: $(clean-dirs) clean archclean | 956 | PHONY += $(clean-dirs) clean archclean |
1017 | $(clean-dirs): | 957 | $(clean-dirs): |
1018 | $(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@) | 958 | $(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@) |
1019 | 959 | ||
@@ -1031,7 +971,7 @@ mrproper: rm-dirs := $(wildcard $(MRPROPER_DIRS)) | |||
1031 | mrproper: rm-files := $(wildcard $(MRPROPER_FILES)) | 971 | mrproper: rm-files := $(wildcard $(MRPROPER_FILES)) |
1032 | mrproper-dirs := $(addprefix _mrproper_,Documentation/DocBook scripts) | 972 | mrproper-dirs := $(addprefix _mrproper_,Documentation/DocBook scripts) |
1033 | 973 | ||
1034 | .PHONY: $(mrproper-dirs) mrproper archmrproper | 974 | PHONY += $(mrproper-dirs) mrproper archmrproper |
1035 | $(mrproper-dirs): | 975 | $(mrproper-dirs): |
1036 | $(Q)$(MAKE) $(clean)=$(patsubst _mrproper_%,%,$@) | 976 | $(Q)$(MAKE) $(clean)=$(patsubst _mrproper_%,%,$@) |
1037 | 977 | ||
@@ -1041,7 +981,7 @@ mrproper: clean archmrproper $(mrproper-dirs) | |||
1041 | 981 | ||
1042 | # distclean | 982 | # distclean |
1043 | # | 983 | # |
1044 | .PHONY: distclean | 984 | PHONY += distclean |
1045 | 985 | ||
1046 | distclean: mrproper | 986 | distclean: mrproper |
1047 | @find $(srctree) $(RCS_FIND_IGNORE) \ | 987 | @find $(srctree) $(RCS_FIND_IGNORE) \ |
@@ -1057,12 +997,10 @@ distclean: mrproper | |||
1057 | # rpm target kept for backward compatibility | 997 | # rpm target kept for backward compatibility |
1058 | package-dir := $(srctree)/scripts/package | 998 | package-dir := $(srctree)/scripts/package |
1059 | 999 | ||
1060 | .PHONY: %-pkg rpm | ||
1061 | |||
1062 | %pkg: FORCE | 1000 | %pkg: FORCE |
1063 | $(Q)$(MAKE) -f $(package-dir)/Makefile $@ | 1001 | $(Q)$(MAKE) $(build)=$(package-dir) $@ |
1064 | rpm: FORCE | 1002 | rpm: FORCE |
1065 | $(Q)$(MAKE) -f $(package-dir)/Makefile $@ | 1003 | $(Q)$(MAKE) $(build)=$(package-dir) $@ |
1066 | 1004 | ||
1067 | 1005 | ||
1068 | # Brief documentation of the typical targets used | 1006 | # Brief documentation of the typical targets used |
@@ -1094,13 +1032,11 @@ help: | |||
1094 | @echo ' kernelversion - Output the version stored in Makefile' | 1032 | @echo ' kernelversion - Output the version stored in Makefile' |
1095 | @echo '' | 1033 | @echo '' |
1096 | @echo 'Static analysers' | 1034 | @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' | 1035 | @echo ' checkstack - Generate a list of stack hogs' |
1100 | @echo ' namespacecheck - Name space analysis on compiled kernel' | 1036 | @echo ' namespacecheck - Name space analysis on compiled kernel' |
1101 | @echo '' | 1037 | @echo '' |
1102 | @echo 'Kernel packaging:' | 1038 | @echo 'Kernel packaging:' |
1103 | @$(MAKE) -f $(package-dir)/Makefile help | 1039 | @$(MAKE) $(build)=$(package-dir) help |
1104 | @echo '' | 1040 | @echo '' |
1105 | @echo 'Documentation targets:' | 1041 | @echo 'Documentation targets:' |
1106 | @$(MAKE) -f $(srctree)/Documentation/DocBook/Makefile dochelp | 1042 | @$(MAKE) -f $(srctree)/Documentation/DocBook/Makefile dochelp |
@@ -1149,11 +1085,12 @@ else # KBUILD_EXTMOD | |||
1149 | 1085 | ||
1150 | # We are always building modules | 1086 | # We are always building modules |
1151 | KBUILD_MODULES := 1 | 1087 | KBUILD_MODULES := 1 |
1152 | .PHONY: crmodverdir | 1088 | PHONY += crmodverdir |
1153 | crmodverdir: | 1089 | crmodverdir: |
1090 | $(Q)rm -rf $(MODVERDIR) | ||
1154 | $(Q)mkdir -p $(MODVERDIR) | 1091 | $(Q)mkdir -p $(MODVERDIR) |
1155 | 1092 | ||
1156 | .PHONY: $(objtree)/Module.symvers | 1093 | PHONY += $(objtree)/Module.symvers |
1157 | $(objtree)/Module.symvers: | 1094 | $(objtree)/Module.symvers: |
1158 | @test -e $(objtree)/Module.symvers || ( \ | 1095 | @test -e $(objtree)/Module.symvers || ( \ |
1159 | echo; \ | 1096 | echo; \ |
@@ -1162,7 +1099,7 @@ $(objtree)/Module.symvers: | |||
1162 | echo ) | 1099 | echo ) |
1163 | 1100 | ||
1164 | module-dirs := $(addprefix _module_,$(KBUILD_EXTMOD)) | 1101 | module-dirs := $(addprefix _module_,$(KBUILD_EXTMOD)) |
1165 | .PHONY: $(module-dirs) modules | 1102 | PHONY += $(module-dirs) modules |
1166 | $(module-dirs): crmodverdir $(objtree)/Module.symvers | 1103 | $(module-dirs): crmodverdir $(objtree)/Module.symvers |
1167 | $(Q)$(MAKE) $(build)=$(patsubst _module_%,%,$@) | 1104 | $(Q)$(MAKE) $(build)=$(patsubst _module_%,%,$@) |
1168 | 1105 | ||
@@ -1170,13 +1107,32 @@ modules: $(module-dirs) | |||
1170 | @echo ' Building modules, stage 2.'; | 1107 | @echo ' Building modules, stage 2.'; |
1171 | $(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modpost | 1108 | $(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modpost |
1172 | 1109 | ||
1173 | .PHONY: modules_install | 1110 | PHONY += modules_install |
1174 | modules_install: | 1111 | modules_install: _emodinst_ _emodinst_post |
1112 | |||
1113 | install-dir := $(if $(INSTALL_MOD_DIR),$(INSTALL_MOD_DIR),extra) | ||
1114 | PHONY += _emodinst_ | ||
1115 | _emodinst_: | ||
1116 | $(Q)rm -rf $(MODLIB)/$(install-dir) | ||
1117 | $(Q)mkdir -p $(MODLIB)/$(install-dir) | ||
1175 | $(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modinst | 1118 | $(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modinst |
1176 | 1119 | ||
1120 | # Run depmod only is we have System.map and depmod is executable | ||
1121 | quiet_cmd_depmod = DEPMOD $(KERNELRELEASE) | ||
1122 | cmd_depmod = if [ -r System.map -a -x $(DEPMOD) ]; then \ | ||
1123 | $(DEPMOD) -ae -F System.map \ | ||
1124 | $(if $(strip $(INSTALL_MOD_PATH)), \ | ||
1125 | -b $(INSTALL_MOD_PATH) -r) \ | ||
1126 | $(KERNELRELEASE); \ | ||
1127 | fi | ||
1128 | |||
1129 | PHONY += _emodinst_post | ||
1130 | _emodinst_post: _emodinst_ | ||
1131 | $(call cmd,depmod) | ||
1132 | |||
1177 | clean-dirs := $(addprefix _clean_,$(KBUILD_EXTMOD)) | 1133 | clean-dirs := $(addprefix _clean_,$(KBUILD_EXTMOD)) |
1178 | 1134 | ||
1179 | .PHONY: $(clean-dirs) clean | 1135 | PHONY += $(clean-dirs) clean |
1180 | $(clean-dirs): | 1136 | $(clean-dirs): |
1181 | $(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@) | 1137 | $(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@) |
1182 | 1138 | ||
@@ -1196,6 +1152,11 @@ help: | |||
1196 | @echo ' modules_install - install the module' | 1152 | @echo ' modules_install - install the module' |
1197 | @echo ' clean - remove generated files in module directory only' | 1153 | @echo ' clean - remove generated files in module directory only' |
1198 | @echo '' | 1154 | @echo '' |
1155 | |||
1156 | # Dummies... | ||
1157 | PHONY += prepare scripts | ||
1158 | prepare: ; | ||
1159 | scripts: ; | ||
1199 | endif # KBUILD_EXTMOD | 1160 | endif # KBUILD_EXTMOD |
1200 | 1161 | ||
1201 | # Generate tags for editors | 1162 | # Generate tags for editors |
@@ -1296,17 +1257,13 @@ versioncheck: | |||
1296 | -name '*.[hcS]' -type f -print | sort \ | 1257 | -name '*.[hcS]' -type f -print | sort \ |
1297 | | xargs $(PERL) -w scripts/checkversion.pl | 1258 | | xargs $(PERL) -w scripts/checkversion.pl |
1298 | 1259 | ||
1299 | buildcheck: | ||
1300 | $(PERL) $(srctree)/scripts/reference_discarded.pl | ||
1301 | $(PERL) $(srctree)/scripts/reference_init.pl | ||
1302 | |||
1303 | namespacecheck: | 1260 | namespacecheck: |
1304 | $(PERL) $(srctree)/scripts/namespace.pl | 1261 | $(PERL) $(srctree)/scripts/namespace.pl |
1305 | 1262 | ||
1306 | endif #ifeq ($(config-targets),1) | 1263 | endif #ifeq ($(config-targets),1) |
1307 | endif #ifeq ($(mixed-targets),1) | 1264 | endif #ifeq ($(mixed-targets),1) |
1308 | 1265 | ||
1309 | .PHONY: checkstack | 1266 | PHONY += checkstack |
1310 | checkstack: | 1267 | checkstack: |
1311 | $(OBJDUMP) -d vmlinux $$(find . -name '*.ko') | \ | 1268 | $(OBJDUMP) -d vmlinux $$(find . -name '*.ko') | \ |
1312 | $(PERL) $(src)/scripts/checkstack.pl $(ARCH) | 1269 | $(PERL) $(src)/scripts/checkstack.pl $(ARCH) |
@@ -1317,6 +1274,44 @@ kernelrelease: | |||
1317 | kernelversion: | 1274 | kernelversion: |
1318 | @echo $(KERNELVERSION) | 1275 | @echo $(KERNELVERSION) |
1319 | 1276 | ||
1277 | # Single targets | ||
1278 | # --------------------------------------------------------------------------- | ||
1279 | # The directory part is taken from first prerequisite, so this | ||
1280 | # works even with external modules | ||
1281 | %.s: %.c prepare scripts FORCE | ||
1282 | $(Q)$(MAKE) $(build)=$(dir $<) $(dir $<)$(notdir $@) | ||
1283 | %.i: %.c prepare scripts FORCE | ||
1284 | $(Q)$(MAKE) $(build)=$(dir $<) $(dir $<)$(notdir $@) | ||
1285 | %.o: %.c prepare scripts FORCE | ||
1286 | $(Q)$(MAKE) $(build)=$(dir $<) $(dir $<)$(notdir $@) | ||
1287 | %.lst: %.c prepare scripts FORCE | ||
1288 | $(Q)$(MAKE) $(build)=$(dir $<) $(dir $<)$(notdir $@) | ||
1289 | %.s: %.S prepare scripts FORCE | ||
1290 | $(Q)$(MAKE) $(build)=$(dir $<) $(dir $<)$(notdir $@) | ||
1291 | %.o: %.S prepare scripts FORCE | ||
1292 | $(Q)$(MAKE) $(build)=$(dir $<) $(dir $<)$(notdir $@) | ||
1293 | |||
1294 | # For external modules we shall include any directory of the target, | ||
1295 | # but usual case there is no directory part. | ||
1296 | # make M=`pwd` module.o => $(dir $@)=./ | ||
1297 | # make M=`pwd` foo/module.o => $(dir $@)=foo/ | ||
1298 | # make M=`pwd` / => $(dir $@)=/ | ||
1299 | |||
1300 | ifeq ($(KBUILD_EXTMOD),) | ||
1301 | target-dir = $(@D) | ||
1302 | else | ||
1303 | zap-slash=$(filter-out .,$(patsubst %/,%,$(dir $@))) | ||
1304 | target-dir = $(KBUILD_EXTMOD)$(if $(zap-slash),/$(zap-slash)) | ||
1305 | endif | ||
1306 | |||
1307 | / %/: scripts prepare FORCE | ||
1308 | $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \ | ||
1309 | $(build)=$(target-dir) | ||
1310 | %.ko: scripts FORCE | ||
1311 | $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \ | ||
1312 | $(build)=$(target-dir) $(@:.ko=.o) | ||
1313 | $(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modpost | ||
1314 | |||
1320 | # FIXME Should go into a make.lib or something | 1315 | # FIXME Should go into a make.lib or something |
1321 | # =========================================================================== | 1316 | # =========================================================================== |
1322 | 1317 | ||
@@ -1351,4 +1346,10 @@ clean := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.clean obj | |||
1351 | 1346 | ||
1352 | endif # skip-makefile | 1347 | endif # skip-makefile |
1353 | 1348 | ||
1349 | PHONY += FORCE | ||
1354 | FORCE: | 1350 | FORCE: |
1351 | |||
1352 | |||
1353 | # Declare the contents of the .PHONY variable as phony. We keep that | ||
1354 | # information in a variable se we can use it in if_changed and friends. | ||
1355 | .PHONY: $(PHONY) | ||