diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 200 |
1 files changed, 100 insertions, 100 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) |
@@ -338,8 +306,7 @@ LINUXINCLUDE := -Iinclude \ | |||
338 | CPPFLAGS := -D__KERNEL__ $(LINUXINCLUDE) | 306 | CPPFLAGS := -D__KERNEL__ $(LINUXINCLUDE) |
339 | 307 | ||
340 | CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ | 308 | CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ |
341 | -fno-strict-aliasing -fno-common \ | 309 | -fno-strict-aliasing -fno-common |
342 | -ffreestanding | ||
343 | AFLAGS := -D__ASSEMBLY__ | 310 | AFLAGS := -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 | 339 | PHONY += scripts_basic |
373 | scripts_basic: | 340 | scripts_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. |
377 | scripts/basic/%: scripts_basic ; | 344 | scripts/basic/%: scripts_basic ; |
378 | 345 | ||
379 | .PHONY: outputmakefile | 346 | PHONY += 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 | 422 | PHONY += scripts |
456 | scripts: scripts_basic include/config/MARKER | 423 | scripts: scripts_basic include/config/MARKER |
457 | $(Q)$(MAKE) $(build)=$(@) | 424 | $(Q)$(MAKE) $(build)=$(@) |
458 | 425 | ||
@@ -504,13 +471,6 @@ else | |||
504 | CFLAGS += -O2 | 471 | CFLAGS += -O2 |
505 | endif | 472 | endif |
506 | 473 | ||
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 | 474 | ifdef CONFIG_FRAME_POINTER |
515 | CFLAGS += -fno-omit-frame-pointer $(call cc-option,-fno-optimize-sibling-calls,) | 475 | CFLAGS += -fno-omit-frame-pointer $(call cc-option,-fno-optimize-sibling-calls,) |
516 | else | 476 | else |
@@ -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) | 719 | PHONY += $(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 | 772 | PHONY += 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 | 775 | PHONY += 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 | ||
854 | export CPPFLAGS_vmlinux.lds += -P -C -U$(ARCH) | 814 | export 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 | 856 | PHONY += depend dep |
918 | depend dep: | 857 | depend 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 | 871 | PHONY += modules |
933 | modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux) | 872 | modules: $(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 | 878 | PHONY += modules_prepare |
940 | modules_prepare: prepare scripts | 879 | modules_prepare: prepare scripts |
941 | 880 | ||
942 | # Target to install modules | 881 | # Target to install modules |
943 | .PHONY: modules_install | 882 | PHONY += modules_install |
944 | modules_install: _modinst_ _modinst_post | 883 | modules_install: _modinst_ _modinst_post |
945 | 884 | ||
946 | .PHONY: _modinst_ | 885 | PHONY += _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 := | |||
970 | else | 909 | else |
971 | depmod_opts := -b $(INSTALL_MOD_PATH) -r | 910 | depmod_opts := -b $(INSTALL_MOD_PATH) -r |
972 | endif | 911 | endif |
973 | .PHONY: _modinst_post | 912 | PHONY += _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) | |||
1013 | clean: rm-files := $(CLEAN_FILES) | 952 | clean: rm-files := $(CLEAN_FILES) |
1014 | clean-dirs := $(addprefix _clean_,$(srctree) $(vmlinux-alldirs)) | 953 | clean-dirs := $(addprefix _clean_,$(srctree) $(vmlinux-alldirs)) |
1015 | 954 | ||
1016 | .PHONY: $(clean-dirs) clean archclean | 955 | PHONY += $(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)) | |||
1031 | mrproper: rm-files := $(wildcard $(MRPROPER_FILES)) | 970 | mrproper: rm-files := $(wildcard $(MRPROPER_FILES)) |
1032 | mrproper-dirs := $(addprefix _mrproper_,Documentation/DocBook scripts) | 971 | mrproper-dirs := $(addprefix _mrproper_,Documentation/DocBook scripts) |
1033 | 972 | ||
1034 | .PHONY: $(mrproper-dirs) mrproper archmrproper | 973 | PHONY += $(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 | 983 | PHONY += distclean |
1045 | 984 | ||
1046 | distclean: mrproper | 985 | distclean: 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 |
1058 | package-dir := $(srctree)/scripts/package | 997 | package-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) $@ |
1064 | rpm: FORCE | 1001 | rpm: 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 |
1151 | KBUILD_MODULES := 1 | 1086 | KBUILD_MODULES := 1 |
1152 | .PHONY: crmodverdir | 1087 | PHONY += crmodverdir |
1153 | crmodverdir: | 1088 | crmodverdir: |
1089 | $(Q)rm -rf $(MODVERDIR) | ||
1154 | $(Q)mkdir -p $(MODVERDIR) | 1090 | $(Q)mkdir -p $(MODVERDIR) |
1155 | 1091 | ||
1156 | .PHONY: $(objtree)/Module.symvers | 1092 | PHONY += $(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 | ||
1164 | module-dirs := $(addprefix _module_,$(KBUILD_EXTMOD)) | 1100 | module-dirs := $(addprefix _module_,$(KBUILD_EXTMOD)) |
1165 | .PHONY: $(module-dirs) modules | 1101 | PHONY += $(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 | 1109 | PHONY += modules_install |
1174 | modules_install: | 1110 | modules_install: _emodinst_ _emodinst_post |
1111 | |||
1112 | install-dir := $(if $(INSTALL_MOD_DIR),$(INSTALL_MOD_DIR),extra) | ||
1113 | PHONY += _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 | ||
1120 | quiet_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 | |||
1128 | PHONY += _emodinst_post | ||
1129 | _emodinst_post: _emodinst_ | ||
1130 | $(call cmd,depmod) | ||
1131 | |||
1177 | clean-dirs := $(addprefix _clean_,$(KBUILD_EXTMOD)) | 1132 | clean-dirs := $(addprefix _clean_,$(KBUILD_EXTMOD)) |
1178 | 1133 | ||
1179 | .PHONY: $(clean-dirs) clean | 1134 | PHONY += $(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... | ||
1156 | PHONY += prepare scripts | ||
1157 | prepare: ; | ||
1158 | scripts: ; | ||
1199 | endif # KBUILD_EXTMOD | 1159 | endif # 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 | ||
1299 | buildcheck: | ||
1300 | $(PERL) $(srctree)/scripts/reference_discarded.pl | ||
1301 | $(PERL) $(srctree)/scripts/reference_init.pl | ||
1302 | |||
1303 | namespacecheck: | 1259 | namespacecheck: |
1304 | $(PERL) $(srctree)/scripts/namespace.pl | 1260 | $(PERL) $(srctree)/scripts/namespace.pl |
1305 | 1261 | ||
1306 | endif #ifeq ($(config-targets),1) | 1262 | endif #ifeq ($(config-targets),1) |
1307 | endif #ifeq ($(mixed-targets),1) | 1263 | endif #ifeq ($(mixed-targets),1) |
1308 | 1264 | ||
1309 | .PHONY: checkstack | 1265 | PHONY += checkstack |
1310 | checkstack: | 1266 | checkstack: |
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: | |||
1317 | kernelversion: | 1273 | kernelversion: |
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 | |||
1299 | ifeq ($(KBUILD_EXTMOD),) | ||
1300 | target-dir = $(@D) | ||
1301 | else | ||
1302 | zap-slash=$(filter-out .,$(patsubst %/,%,$(dir $@))) | ||
1303 | target-dir = $(KBUILD_EXTMOD)$(if $(zap-slash),/$(zap-slash)) | ||
1304 | endif | ||
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 | ||
1352 | endif # skip-makefile | 1346 | endif # skip-makefile |
1353 | 1347 | ||
1348 | PHONY += FORCE | ||
1354 | FORCE: | 1349 | FORCE: |
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) | ||