diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 224 |
1 files changed, 127 insertions, 97 deletions
@@ -41,8 +41,9 @@ ifndef KBUILD_VERBOSE | |||
41 | KBUILD_VERBOSE = 0 | 41 | KBUILD_VERBOSE = 0 |
42 | endif | 42 | endif |
43 | 43 | ||
44 | # Call sparse as part of compilation of C files | 44 | # Call checker as part of compilation of C files |
45 | # Use 'make C=1' to enable sparse checking | 45 | # Use 'make C=1' to enable checking (sparse, by default) |
46 | # Override with 'make C=1 CHECK=checker_executable CHECKFLAGS=....' | ||
46 | 47 | ||
47 | ifdef C | 48 | ifdef C |
48 | ifeq ("$(origin C)", "command line") | 49 | ifeq ("$(origin C)", "command line") |
@@ -71,7 +72,7 @@ endif | |||
71 | # In both cases the working directory must be the root of the kernel src. | 72 | # In both cases the working directory must be the root of the kernel src. |
72 | # 1) O= | 73 | # 1) O= |
73 | # Use "make O=dir/to/store/output/files/" | 74 | # Use "make O=dir/to/store/output/files/" |
74 | # | 75 | # |
75 | # 2) Set KBUILD_OUTPUT | 76 | # 2) Set KBUILD_OUTPUT |
76 | # Set the environment variable KBUILD_OUTPUT to point to the directory | 77 | # Set the environment variable KBUILD_OUTPUT to point to the directory |
77 | # where the output files shall be placed. | 78 | # where the output files shall be placed. |
@@ -178,18 +179,20 @@ CROSS_COMPILE ?= | |||
178 | # Architecture as present in compile.h | 179 | # Architecture as present in compile.h |
179 | UTS_MACHINE := $(ARCH) | 180 | UTS_MACHINE := $(ARCH) |
180 | 181 | ||
182 | KCONFIG_CONFIG ?= .config | ||
183 | |||
181 | # SHELL used by kbuild | 184 | # SHELL used by kbuild |
182 | CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \ | 185 | CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \ |
183 | else if [ -x /bin/bash ]; then echo /bin/bash; \ | 186 | else if [ -x /bin/bash ]; then echo /bin/bash; \ |
184 | else echo sh; fi ; fi) | 187 | else echo sh; fi ; fi) |
185 | 188 | ||
186 | HOSTCC = gcc | 189 | HOSTCC = gcc |
187 | HOSTCXX = g++ | 190 | HOSTCXX = g++ |
188 | HOSTCFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer | 191 | HOSTCFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer |
189 | HOSTCXXFLAGS = -O2 | 192 | HOSTCXXFLAGS = -O2 |
190 | 193 | ||
191 | # Decide whether to build built-in, modular, or both. | 194 | # Decide whether to build built-in, modular, or both. |
192 | # Normally, just do built-in. | 195 | # Normally, just do built-in. |
193 | 196 | ||
194 | KBUILD_MODULES := | 197 | KBUILD_MODULES := |
195 | KBUILD_BUILTIN := 1 | 198 | KBUILD_BUILTIN := 1 |
@@ -197,7 +200,7 @@ KBUILD_BUILTIN := 1 | |||
197 | # If we have only "make modules", don't compile built-in objects. | 200 | # If we have only "make modules", don't compile built-in objects. |
198 | # When we're building modules with modversions, we need to consider | 201 | # When we're building modules with modversions, we need to consider |
199 | # the built-in objects during the descend as well, in order to | 202 | # the built-in objects during the descend as well, in order to |
200 | # make sure the checksums are uptodate before we record them. | 203 | # make sure the checksums are up to date before we record them. |
201 | 204 | ||
202 | ifeq ($(MAKECMDGOALS),modules) | 205 | ifeq ($(MAKECMDGOALS),modules) |
203 | KBUILD_BUILTIN := $(if $(CONFIG_MODVERSIONS),1) | 206 | KBUILD_BUILTIN := $(if $(CONFIG_MODVERSIONS),1) |
@@ -230,7 +233,7 @@ export KBUILD_CHECKSRC KBUILD_SRC KBUILD_EXTMOD | |||
230 | # | 233 | # |
231 | # If $(quiet) is empty, the whole command will be printed. | 234 | # If $(quiet) is empty, the whole command will be printed. |
232 | # If it is set to "quiet_", only the short version will be printed. | 235 | # If it is set to "quiet_", only the short version will be printed. |
233 | # If it is set to "silent_", nothing wil be printed at all, since | 236 | # If it is set to "silent_", nothing will be printed at all, since |
234 | # the variable $(silent_cmd_cc_o_c) doesn't exist. | 237 | # the variable $(silent_cmd_cc_o_c) doesn't exist. |
235 | # | 238 | # |
236 | # A simple variant is to prefix commands with $(Q) - that's useful | 239 | # A simple variant is to prefix commands with $(Q) - that's useful |
@@ -265,10 +268,9 @@ MAKEFLAGS += --include-dir=$(srctree) | |||
265 | # We need some generic definitions | 268 | # We need some generic definitions |
266 | include $(srctree)/scripts/Kbuild.include | 269 | include $(srctree)/scripts/Kbuild.include |
267 | 270 | ||
268 | # For maximum performance (+ possibly random breakage, uncomment | 271 | # Do not use make's built-in rules and variables |
269 | # the following) | 272 | # This increases performance and avoid hard-to-debug behavour |
270 | 273 | MAKEFLAGS += -rR | |
271 | #MAKEFLAGS += -rR | ||
272 | 274 | ||
273 | # Make variables (CC, etc...) | 275 | # Make variables (CC, etc...) |
274 | 276 | ||
@@ -305,21 +307,21 @@ LINUXINCLUDE := -Iinclude \ | |||
305 | 307 | ||
306 | CPPFLAGS := -D__KERNEL__ $(LINUXINCLUDE) | 308 | CPPFLAGS := -D__KERNEL__ $(LINUXINCLUDE) |
307 | 309 | ||
308 | CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ | 310 | CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ |
309 | -fno-strict-aliasing -fno-common | 311 | -fno-strict-aliasing -fno-common |
310 | AFLAGS := -D__ASSEMBLY__ | 312 | AFLAGS := -D__ASSEMBLY__ |
311 | 313 | ||
312 | # Read KERNELRELEASE from .kernelrelease (if it exists) | 314 | # Read KERNELRELEASE from include/config/kernel.release (if it exists) |
313 | KERNELRELEASE = $(shell cat .kernelrelease 2> /dev/null) | 315 | KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null) |
314 | KERNELVERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) | 316 | KERNELVERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) |
315 | 317 | ||
316 | export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION \ | 318 | export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION |
317 | ARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC \ | 319 | export ARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC |
318 | CPP AR NM STRIP OBJCOPY OBJDUMP MAKE AWK GENKSYMS PERL UTS_MACHINE \ | 320 | export CPP AR NM STRIP OBJCOPY OBJDUMP MAKE AWK GENKSYMS PERL UTS_MACHINE |
319 | HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS | 321 | export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS |
320 | 322 | ||
321 | export CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS | 323 | export CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS |
322 | export CFLAGS CFLAGS_KERNEL CFLAGS_MODULE | 324 | export CFLAGS CFLAGS_KERNEL CFLAGS_MODULE |
323 | export AFLAGS AFLAGS_KERNEL AFLAGS_MODULE | 325 | export AFLAGS AFLAGS_KERNEL AFLAGS_MODULE |
324 | 326 | ||
325 | # When compiling out-of-tree modules, put MODVERDIR in the module | 327 | # When compiling out-of-tree modules, put MODVERDIR in the module |
@@ -357,12 +359,13 @@ endif | |||
357 | # catch them early, and hand them over to scripts/kconfig/Makefile | 359 | # catch them early, and hand them over to scripts/kconfig/Makefile |
358 | # It is allowed to specify more targets when calling make, including | 360 | # It is allowed to specify more targets when calling make, including |
359 | # mixing *config targets and build targets. | 361 | # mixing *config targets and build targets. |
360 | # For example 'make oldconfig all'. | 362 | # For example 'make oldconfig all'. |
361 | # Detect when mixed targets is specified, and make a second invocation | 363 | # Detect when mixed targets is specified, and make a second invocation |
362 | # of make so .config is not included in this case either (for *config). | 364 | # of make so .config is not included in this case either (for *config). |
363 | 365 | ||
364 | no-dot-config-targets := clean mrproper distclean \ | 366 | no-dot-config-targets := clean mrproper distclean \ |
365 | cscope TAGS tags help %docs check% | 367 | cscope TAGS tags help %docs check% \ |
368 | kernelrelease kernelversion | ||
366 | 369 | ||
367 | config-targets := 0 | 370 | config-targets := 0 |
368 | mixed-targets := 0 | 371 | mixed-targets := 0 |
@@ -404,9 +407,8 @@ include $(srctree)/arch/$(ARCH)/Makefile | |||
404 | export KBUILD_DEFCONFIG | 407 | export KBUILD_DEFCONFIG |
405 | 408 | ||
406 | config %config: scripts_basic outputmakefile FORCE | 409 | config %config: scripts_basic outputmakefile FORCE |
407 | $(Q)mkdir -p include/linux | 410 | $(Q)mkdir -p include/linux include/config |
408 | $(Q)$(MAKE) $(build)=scripts/kconfig $@ | 411 | $(Q)$(MAKE) $(build)=scripts/kconfig $@ |
409 | $(Q)$(MAKE) -C $(srctree) KBUILD_SRC= .kernelrelease | ||
410 | 412 | ||
411 | else | 413 | else |
412 | # =========================================================================== | 414 | # =========================================================================== |
@@ -416,13 +418,11 @@ else | |||
416 | ifeq ($(KBUILD_EXTMOD),) | 418 | ifeq ($(KBUILD_EXTMOD),) |
417 | # Additional helpers built in scripts/ | 419 | # Additional helpers built in scripts/ |
418 | # 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 |
419 | # in parrallel | 421 | # in parallel |
420 | PHONY += scripts | 422 | PHONY += scripts |
421 | scripts: scripts_basic include/config/MARKER | 423 | scripts: scripts_basic include/config/auto.conf |
422 | $(Q)$(MAKE) $(build)=$(@) | 424 | $(Q)$(MAKE) $(build)=$(@) |
423 | 425 | ||
424 | scripts_basic: include/linux/autoconf.h | ||
425 | |||
426 | # Objects we will link into vmlinux / subdirs we need to visit | 426 | # Objects we will link into vmlinux / subdirs we need to visit |
427 | init-y := init/ | 427 | init-y := init/ |
428 | drivers-y := drivers/ sound/ | 428 | drivers-y := drivers/ sound/ |
@@ -436,31 +436,32 @@ ifeq ($(dot-config),1) | |||
436 | 436 | ||
437 | # Read in dependencies to all Kconfig* files, make sure to run | 437 | # Read in dependencies to all Kconfig* files, make sure to run |
438 | # oldconfig if changes are detected. | 438 | # oldconfig if changes are detected. |
439 | -include .kconfig.d | 439 | -include include/config/auto.conf.cmd |
440 | -include include/config/auto.conf | ||
440 | 441 | ||
441 | include .config | ||
442 | |||
443 | # If .config needs to be updated, it will be done via the dependency | ||
444 | # that autoconf has on .config. | ||
445 | # To avoid any implicit rule to kick in, define an empty command | 442 | # To avoid any implicit rule to kick in, define an empty command |
446 | .config .kconfig.d: ; | 443 | $(KCONFIG_CONFIG) include/config/auto.conf.cmd: ; |
447 | 444 | ||
448 | # If .config is newer than include/linux/autoconf.h, someone tinkered | 445 | # If .config is newer than include/config/auto.conf, someone tinkered |
449 | # with it and forgot to run make oldconfig. | 446 | # with it and forgot to run make oldconfig. |
450 | # If kconfig.d is missing then we are probarly in a cleaned tree so | 447 | # if auto.conf.cmd is missing then we are probably in a cleaned tree so |
451 | # we execute the config step to be sure to catch updated Kconfig files | 448 | # we execute the config step to be sure to catch updated Kconfig files |
452 | include/linux/autoconf.h: .kconfig.d .config | 449 | include/config/auto.conf: $(KCONFIG_CONFIG) include/config/auto.conf.cmd |
453 | $(Q)mkdir -p include/linux | 450 | ifeq ($(KBUILD_EXTMOD),) |
454 | $(Q)$(MAKE) -f $(srctree)/Makefile silentoldconfig | 451 | $(Q)$(MAKE) -f $(srctree)/Makefile silentoldconfig |
455 | else | 452 | else |
453 | $(error kernel configuration not valid - run 'make prepare' in $(srctree) to update it) | ||
454 | endif | ||
455 | |||
456 | else | ||
456 | # Dummy target needed, because used as prerequisite | 457 | # Dummy target needed, because used as prerequisite |
457 | include/linux/autoconf.h: ; | 458 | include/config/auto.conf: ; |
458 | endif | 459 | endif |
459 | 460 | ||
460 | # The all: target is the default when no target is given on the | 461 | # The all: target is the default when no target is given on the |
461 | # command line. | 462 | # command line. |
462 | # This allow a user to issue only 'make' to build a kernel including modules | 463 | # This allow a user to issue only 'make' to build a kernel including modules |
463 | # Defaults vmlinux but it is usually overriden in the arch makefile | 464 | # Defaults vmlinux but it is usually overridden in the arch makefile |
464 | all: vmlinux | 465 | all: vmlinux |
465 | 466 | ||
466 | ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE | 467 | ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE |
@@ -492,11 +493,11 @@ CHECKFLAGS += $(NOSTDINC_FLAGS) | |||
492 | # warn about C99 declaration after statement | 493 | # warn about C99 declaration after statement |
493 | CFLAGS += $(call cc-option,-Wdeclaration-after-statement,) | 494 | CFLAGS += $(call cc-option,-Wdeclaration-after-statement,) |
494 | 495 | ||
495 | # disable pointer signedness warnings in gcc 4.0 | 496 | # disable pointer signed / unsigned warnings in gcc 4.0 |
496 | CFLAGS += $(call cc-option,-Wno-pointer-sign,) | 497 | CFLAGS += $(call cc-option,-Wno-pointer-sign,) |
497 | 498 | ||
498 | # Default kernel image to build when no specific target is given. | 499 | # Default kernel image to build when no specific target is given. |
499 | # KBUILD_IMAGE may be overruled on the commandline or | 500 | # KBUILD_IMAGE may be overruled on the command line or |
500 | # set in the environment | 501 | # set in the environment |
501 | # Also any assignments in arch/$(ARCH)/Makefile take precedence over | 502 | # Also any assignments in arch/$(ARCH)/Makefile take precedence over |
502 | # this default value | 503 | # this default value |
@@ -510,12 +511,29 @@ export INSTALL_PATH ?= /boot | |||
510 | # | 511 | # |
511 | # INSTALL_MOD_PATH specifies a prefix to MODLIB for module directory | 512 | # INSTALL_MOD_PATH specifies a prefix to MODLIB for module directory |
512 | # relocations required by build roots. This is not defined in the | 513 | # relocations required by build roots. This is not defined in the |
513 | # makefile but the arguement can be passed to make if needed. | 514 | # makefile but the argument can be passed to make if needed. |
514 | # | 515 | # |
515 | 516 | ||
516 | MODLIB = $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE) | 517 | MODLIB = $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE) |
517 | export MODLIB | 518 | export MODLIB |
518 | 519 | ||
520 | # | ||
521 | # INSTALL_MOD_STRIP, if defined, will cause modules to be | ||
522 | # stripped after they are installed. If INSTALL_MOD_STRIP is '1', then | ||
523 | # the default option --strip-debug will be used. Otherwise, | ||
524 | # INSTALL_MOD_STRIP will used as the options to the strip command. | ||
525 | |||
526 | ifdef INSTALL_MOD_STRIP | ||
527 | ifeq ($(INSTALL_MOD_STRIP),1) | ||
528 | mod_strip_cmd = $STRIP) --strip-debug | ||
529 | else | ||
530 | mod_strip_cmd = $(STRIP) $(INSTALL_MOD_STRIP) | ||
531 | endif # INSTALL_MOD_STRIP=1 | ||
532 | else | ||
533 | mod_strip_cmd = true | ||
534 | endif # INSTALL_MOD_STRIP | ||
535 | export mod_strip_cmd | ||
536 | |||
519 | 537 | ||
520 | ifeq ($(KBUILD_EXTMOD),) | 538 | ifeq ($(KBUILD_EXTMOD),) |
521 | core-y += kernel/ mm/ fs/ ipc/ security/ crypto/ block/ | 539 | core-y += kernel/ mm/ fs/ ipc/ security/ crypto/ block/ |
@@ -539,7 +557,7 @@ libs-y := $(libs-y1) $(libs-y2) | |||
539 | 557 | ||
540 | # Build vmlinux | 558 | # Build vmlinux |
541 | # --------------------------------------------------------------------------- | 559 | # --------------------------------------------------------------------------- |
542 | # vmlinux is build from the objects selected by $(vmlinux-init) and | 560 | # vmlinux is built from the objects selected by $(vmlinux-init) and |
543 | # $(vmlinux-main). Most are built-in.o files from top-level directories | 561 | # $(vmlinux-main). Most are built-in.o files from top-level directories |
544 | # in the kernel tree, others are specified in arch/$(ARCH)Makefile. | 562 | # in the kernel tree, others are specified in arch/$(ARCH)Makefile. |
545 | # Ordering when linking is important, and $(vmlinux-init) must be first. | 563 | # Ordering when linking is important, and $(vmlinux-init) must be first. |
@@ -590,7 +608,7 @@ quiet_cmd_vmlinux_version = GEN .version | |||
590 | $(MAKE) $(build)=init | 608 | $(MAKE) $(build)=init |
591 | 609 | ||
592 | # Generate System.map | 610 | # Generate System.map |
593 | quiet_cmd_sysmap = SYSMAP | 611 | quiet_cmd_sysmap = SYSMAP |
594 | cmd_sysmap = $(CONFIG_SHELL) $(srctree)/scripts/mksysmap | 612 | cmd_sysmap = $(CONFIG_SHELL) $(srctree)/scripts/mksysmap |
595 | 613 | ||
596 | # Link of vmlinux | 614 | # Link of vmlinux |
@@ -719,7 +737,7 @@ $(vmlinux-dirs): prepare scripts | |||
719 | $(Q)$(MAKE) $(build)=$@ | 737 | $(Q)$(MAKE) $(build)=$@ |
720 | 738 | ||
721 | # Build the kernel release string | 739 | # Build the kernel release string |
722 | # The KERNELRELEASE is stored in a file named .kernelrelease | 740 | # The KERNELRELEASE is stored in a file named include/config/kernel.release |
723 | # to be used when executing for example make install or make modules_install | 741 | # to be used when executing for example make install or make modules_install |
724 | # | 742 | # |
725 | # Take the contents of any files called localversion* and the config | 743 | # Take the contents of any files called localversion* and the config |
@@ -737,10 +755,10 @@ _localver = $(foreach f, $(__localver), $(if $(findstring ~, $(f)),,$(f))) | |||
737 | localver = $(subst $(space),, \ | 755 | localver = $(subst $(space),, \ |
738 | $(shell cat /dev/null $(_localver)) \ | 756 | $(shell cat /dev/null $(_localver)) \ |
739 | $(patsubst "%",%,$(CONFIG_LOCALVERSION))) | 757 | $(patsubst "%",%,$(CONFIG_LOCALVERSION))) |
740 | 758 | ||
741 | # If CONFIG_LOCALVERSION_AUTO is set scripts/setlocalversion is called | 759 | # If CONFIG_LOCALVERSION_AUTO is set scripts/setlocalversion is called |
742 | # and if the SCM is know a tag from the SCM is appended. | 760 | # and if the SCM is know a tag from the SCM is appended. |
743 | # The appended tag is determinded by the SCM used. | 761 | # The appended tag is determined by the SCM used. |
744 | # | 762 | # |
745 | # Currently, only git is supported. | 763 | # Currently, only git is supported. |
746 | # Other SCMs can edit scripts/setlocalversion and add the appropriate | 764 | # Other SCMs can edit scripts/setlocalversion and add the appropriate |
@@ -753,9 +771,9 @@ endif | |||
753 | 771 | ||
754 | localver-full = $(localver)$(localver-auto) | 772 | localver-full = $(localver)$(localver-auto) |
755 | 773 | ||
756 | # Store (new) KERNELRELASE string in .kernelrelease | 774 | # Store (new) KERNELRELASE string in include/config/kernel.release |
757 | kernelrelease = $(KERNELVERSION)$(localver-full) | 775 | kernelrelease = $(KERNELVERSION)$(localver-full) |
758 | .kernelrelease: FORCE | 776 | include/config/kernel.release: include/config/auto.conf FORCE |
759 | $(Q)rm -f $@ | 777 | $(Q)rm -f $@ |
760 | $(Q)echo $(kernelrelease) > $@ | 778 | $(Q)echo $(kernelrelease) > $@ |
761 | 779 | ||
@@ -776,10 +794,10 @@ PHONY += prepare-all | |||
776 | # and if so do: | 794 | # and if so do: |
777 | # 1) Check that make has not been executed in the kernel src $(srctree) | 795 | # 1) Check that make has not been executed in the kernel src $(srctree) |
778 | # 2) Create the include2 directory, used for the second asm symlink | 796 | # 2) Create the include2 directory, used for the second asm symlink |
779 | prepare3: .kernelrelease | 797 | prepare3: include/config/kernel.release |
780 | ifneq ($(KBUILD_SRC),) | 798 | ifneq ($(KBUILD_SRC),) |
781 | @echo ' Using $(srctree) as source for kernel' | 799 | @echo ' Using $(srctree) as source for kernel' |
782 | $(Q)if [ -f $(srctree)/.config ]; then \ | 800 | $(Q)if [ -f $(srctree)/.config -o -d $(srctree)/include/config ]; then \ |
783 | echo " $(srctree) is not clean, please run 'make mrproper'";\ | 801 | echo " $(srctree) is not clean, please run 'make mrproper'";\ |
784 | echo " in the '$(srctree)' directory.";\ | 802 | echo " in the '$(srctree)' directory.";\ |
785 | /bin/false; \ | 803 | /bin/false; \ |
@@ -792,7 +810,7 @@ endif | |||
792 | prepare2: prepare3 outputmakefile | 810 | prepare2: prepare3 outputmakefile |
793 | 811 | ||
794 | prepare1: prepare2 include/linux/version.h include/asm \ | 812 | prepare1: prepare2 include/linux/version.h include/asm \ |
795 | include/config/MARKER | 813 | include/config/auto.conf |
796 | ifneq ($(KBUILD_MODULES),) | 814 | ifneq ($(KBUILD_MODULES),) |
797 | $(Q)mkdir -p $(MODVERDIR) | 815 | $(Q)mkdir -p $(MODVERDIR) |
798 | $(Q)rm -f $(MODVERDIR)/* | 816 | $(Q)rm -f $(MODVERDIR)/* |
@@ -806,27 +824,20 @@ prepare0: archprepare FORCE | |||
806 | # All the preparing.. | 824 | # All the preparing.. |
807 | prepare prepare-all: prepare0 | 825 | prepare prepare-all: prepare0 |
808 | 826 | ||
809 | # Leave this as default for preprocessing vmlinux.lds.S, which is now | 827 | # Leave this as default for preprocessing vmlinux.lds.S, which is now |
810 | # done in arch/$(ARCH)/kernel/Makefile | 828 | # done in arch/$(ARCH)/kernel/Makefile |
811 | 829 | ||
812 | export CPPFLAGS_vmlinux.lds += -P -C -U$(ARCH) | 830 | export CPPFLAGS_vmlinux.lds += -P -C -U$(ARCH) |
813 | 831 | ||
814 | # FIXME: The asm symlink changes when $(ARCH) changes. That's | 832 | # FIXME: The asm symlink changes when $(ARCH) changes. That's |
815 | # hard to detect, but I suppose "make mrproper" is a good idea | 833 | # hard to detect, but I suppose "make mrproper" is a good idea |
816 | # before switching between archs anyway. | 834 | # before switching between archs anyway. |
817 | 835 | ||
818 | include/asm: | 836 | include/asm: |
819 | @echo ' SYMLINK $@ -> include/asm-$(ARCH)' | 837 | @echo ' SYMLINK $@ -> include/asm-$(ARCH)' |
820 | $(Q)if [ ! -d include ]; then mkdir -p include; fi; | 838 | $(Q)if [ ! -d include ]; then mkdir -p include; fi; |
821 | @ln -fsn asm-$(ARCH) $@ | 839 | @ln -fsn asm-$(ARCH) $@ |
822 | 840 | ||
823 | # Split autoconf.h into include/linux/config/* | ||
824 | |||
825 | include/config/MARKER: scripts/basic/split-include include/linux/autoconf.h | ||
826 | @echo ' SPLIT include/linux/autoconf.h -> include/config/*' | ||
827 | @scripts/basic/split-include include/linux/autoconf.h include/config | ||
828 | @touch $@ | ||
829 | |||
830 | # Generate some files | 841 | # Generate some files |
831 | # --------------------------------------------------------------------------- | 842 | # --------------------------------------------------------------------------- |
832 | 843 | ||
@@ -846,7 +857,7 @@ define filechk_version.h | |||
846 | ) | 857 | ) |
847 | endef | 858 | endef |
848 | 859 | ||
849 | include/linux/version.h: $(srctree)/Makefile .config .kernelrelease FORCE | 860 | include/linux/version.h: $(srctree)/Makefile include/config/kernel.release FORCE |
850 | $(call filechk,version.h) | 861 | $(call filechk,version.h) |
851 | 862 | ||
852 | # --------------------------------------------------------------------------- | 863 | # --------------------------------------------------------------------------- |
@@ -860,7 +871,7 @@ depend dep: | |||
860 | 871 | ||
861 | ifdef CONFIG_MODULES | 872 | ifdef CONFIG_MODULES |
862 | 873 | ||
863 | # By default, build modules as well | 874 | # By default, build modules as well |
864 | 875 | ||
865 | all: modules | 876 | all: modules |
866 | 877 | ||
@@ -942,7 +953,7 @@ CLEAN_FILES += vmlinux System.map \ | |||
942 | MRPROPER_DIRS += include/config include2 | 953 | MRPROPER_DIRS += include/config include2 |
943 | MRPROPER_FILES += .config .config.old include/asm .version .old_version \ | 954 | MRPROPER_FILES += .config .config.old include/asm .version .old_version \ |
944 | include/linux/autoconf.h include/linux/version.h \ | 955 | include/linux/autoconf.h include/linux/version.h \ |
945 | .kernelrelease Module.symvers tags TAGS cscope* | 956 | Module.symvers tags TAGS cscope* |
946 | 957 | ||
947 | # clean - Delete most, but leave enough to build external modules | 958 | # clean - Delete most, but leave enough to build external modules |
948 | # | 959 | # |
@@ -958,8 +969,9 @@ clean: archclean $(clean-dirs) | |||
958 | $(call cmd,rmdirs) | 969 | $(call cmd,rmdirs) |
959 | $(call cmd,rmfiles) | 970 | $(call cmd,rmfiles) |
960 | @find . $(RCS_FIND_IGNORE) \ | 971 | @find . $(RCS_FIND_IGNORE) \ |
961 | \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \ | 972 | \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \ |
962 | -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \) \ | 973 | -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \ |
974 | -o -name '*.symtypes' \) \ | ||
963 | -type f -print | xargs rm -f | 975 | -type f -print | xargs rm -f |
964 | 976 | ||
965 | # mrproper - Delete all generated files, including .config | 977 | # mrproper - Delete all generated files, including .config |
@@ -982,9 +994,9 @@ PHONY += distclean | |||
982 | 994 | ||
983 | distclean: mrproper | 995 | distclean: mrproper |
984 | @find $(srctree) $(RCS_FIND_IGNORE) \ | 996 | @find $(srctree) $(RCS_FIND_IGNORE) \ |
985 | \( -name '*.orig' -o -name '*.rej' -o -name '*~' \ | 997 | \( -name '*.orig' -o -name '*.rej' -o -name '*~' \ |
986 | -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \ | 998 | -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \ |
987 | -o -name '.*.rej' -o -size 0 \ | 999 | -o -name '.*.rej' -o -size 0 \ |
988 | -o -name '*%' -o -name '.*.cmd' -o -name 'core' \) \ | 1000 | -o -name '*%' -o -name '.*.cmd' -o -name 'core' \) \ |
989 | -type f -print | xargs rm -f | 1001 | -type f -print | xargs rm -f |
990 | 1002 | ||
@@ -994,9 +1006,9 @@ distclean: mrproper | |||
994 | # rpm target kept for backward compatibility | 1006 | # rpm target kept for backward compatibility |
995 | package-dir := $(srctree)/scripts/package | 1007 | package-dir := $(srctree)/scripts/package |
996 | 1008 | ||
997 | %pkg: FORCE | 1009 | %pkg: include/config/kernel.release FORCE |
998 | $(Q)$(MAKE) $(build)=$(package-dir) $@ | 1010 | $(Q)$(MAKE) $(build)=$(package-dir) $@ |
999 | rpm: FORCE | 1011 | rpm: include/config/kernel.release FORCE |
1000 | $(Q)$(MAKE) $(build)=$(package-dir) $@ | 1012 | $(Q)$(MAKE) $(build)=$(package-dir) $@ |
1001 | 1013 | ||
1002 | 1014 | ||
@@ -1049,8 +1061,8 @@ help: | |||
1049 | 1061 | ||
1050 | @echo ' make V=0|1 [targets] 0 => quiet build (default), 1 => verbose build' | 1062 | @echo ' make V=0|1 [targets] 0 => quiet build (default), 1 => verbose build' |
1051 | @echo ' make O=dir [targets] Locate all output files in "dir", including .config' | 1063 | @echo ' make O=dir [targets] Locate all output files in "dir", including .config' |
1052 | @echo ' make C=1 [targets] Check all c source with $$CHECK (sparse)' | 1064 | @echo ' make C=1 [targets] Check all c source with $$CHECK (sparse by default)' |
1053 | @echo ' make C=2 [targets] Force check of all c source with $$CHECK (sparse)' | 1065 | @echo ' make C=2 [targets] Force check of all c source with $$CHECK' |
1054 | @echo '' | 1066 | @echo '' |
1055 | @echo 'Execute "make" or "make all" to build all targets marked with [*] ' | 1067 | @echo 'Execute "make" or "make all" to build all targets marked with [*] ' |
1056 | @echo 'For further info see the ./README file' | 1068 | @echo 'For further info see the ./README file' |
@@ -1077,7 +1089,7 @@ else # KBUILD_EXTMOD | |||
1077 | # make M=dir modules Make all modules in specified dir | 1089 | # make M=dir modules Make all modules in specified dir |
1078 | # make M=dir Same as 'make M=dir modules' | 1090 | # make M=dir Same as 'make M=dir modules' |
1079 | # make M=dir modules_install | 1091 | # make M=dir modules_install |
1080 | # Install the modules build in the module directory | 1092 | # Install the modules built in the module directory |
1081 | # Assumes install directory is already created | 1093 | # Assumes install directory is already created |
1082 | 1094 | ||
1083 | # We are always building modules | 1095 | # We are always building modules |
@@ -1136,7 +1148,7 @@ clean: rm-dirs := $(MODVERDIR) | |||
1136 | clean: $(clean-dirs) | 1148 | clean: $(clean-dirs) |
1137 | $(call cmd,rmdirs) | 1149 | $(call cmd,rmdirs) |
1138 | @find $(KBUILD_EXTMOD) $(RCS_FIND_IGNORE) \ | 1150 | @find $(KBUILD_EXTMOD) $(RCS_FIND_IGNORE) \ |
1139 | \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \ | 1151 | \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \ |
1140 | -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \) \ | 1152 | -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \) \ |
1141 | -type f -print | xargs rm -f | 1153 | -type f -print | xargs rm -f |
1142 | 1154 | ||
@@ -1175,31 +1187,41 @@ else | |||
1175 | ALLINCLUDE_ARCHS := $(ARCH) | 1187 | ALLINCLUDE_ARCHS := $(ARCH) |
1176 | endif | 1188 | endif |
1177 | else | 1189 | else |
1178 | #Allow user to specify only ALLSOURCE_PATHS on the command line, keeping existing behaviour. | 1190 | #Allow user to specify only ALLSOURCE_PATHS on the command line, keeping existing behavour. |
1179 | ALLINCLUDE_ARCHS := $(ALLSOURCE_ARCHS) | 1191 | ALLINCLUDE_ARCHS := $(ALLSOURCE_ARCHS) |
1180 | endif | 1192 | endif |
1181 | 1193 | ||
1182 | ALLSOURCE_ARCHS := $(ARCH) | 1194 | ALLSOURCE_ARCHS := $(ARCH) |
1183 | 1195 | ||
1184 | define all-sources | 1196 | define find-sources |
1185 | ( find $(__srctree) $(RCS_FIND_IGNORE) \ | 1197 | ( find $(__srctree) $(RCS_FIND_IGNORE) \ |
1186 | \( -name include -o -name arch \) -prune -o \ | 1198 | \( -name include -o -name arch \) -prune -o \ |
1187 | -name '*.[chS]' -print; \ | 1199 | -name $1 -print; \ |
1188 | for ARCH in $(ALLSOURCE_ARCHS) ; do \ | 1200 | for ARCH in $(ALLSOURCE_ARCHS) ; do \ |
1189 | find $(__srctree)arch/$${ARCH} $(RCS_FIND_IGNORE) \ | 1201 | find $(__srctree)arch/$${ARCH} $(RCS_FIND_IGNORE) \ |
1190 | -name '*.[chS]' -print; \ | 1202 | -name $1 -print; \ |
1191 | done ; \ | 1203 | done ; \ |
1192 | find $(__srctree)security/selinux/include $(RCS_FIND_IGNORE) \ | 1204 | find $(__srctree)security/selinux/include $(RCS_FIND_IGNORE) \ |
1193 | -name '*.[chS]' -print; \ | 1205 | -name $1 -print; \ |
1194 | find $(__srctree)include $(RCS_FIND_IGNORE) \ | 1206 | find $(__srctree)include $(RCS_FIND_IGNORE) \ |
1195 | \( -name config -o -name 'asm-*' \) -prune \ | 1207 | \( -name config -o -name 'asm-*' \) -prune \ |
1196 | -o -name '*.[chS]' -print; \ | 1208 | -o -name $1 -print; \ |
1197 | for ARCH in $(ALLINCLUDE_ARCHS) ; do \ | 1209 | for ARCH in $(ALLINCLUDE_ARCHS) ; do \ |
1198 | find $(__srctree)include/asm-$${ARCH} $(RCS_FIND_IGNORE) \ | 1210 | find $(__srctree)include/asm-$${ARCH} $(RCS_FIND_IGNORE) \ |
1199 | -name '*.[chS]' -print; \ | 1211 | -name $1 -print; \ |
1200 | done ; \ | 1212 | done ; \ |
1201 | find $(__srctree)include/asm-generic $(RCS_FIND_IGNORE) \ | 1213 | find $(__srctree)include/asm-generic $(RCS_FIND_IGNORE) \ |
1202 | -name '*.[chS]' -print ) | 1214 | -name $1 -print ) |
1215 | endef | ||
1216 | |||
1217 | define all-sources | ||
1218 | $(call find-sources,'*.[chS]') | ||
1219 | endef | ||
1220 | define all-kconfigs | ||
1221 | $(call find-sources,'Kconfig*') | ||
1222 | endef | ||
1223 | define all-defconfigs | ||
1224 | $(call find-sources,'defconfig') | ||
1203 | endef | 1225 | endef |
1204 | 1226 | ||
1205 | quiet_cmd_cscope-file = FILELST cscope.files | 1227 | quiet_cmd_cscope-file = FILELST cscope.files |
@@ -1219,7 +1241,13 @@ define cmd_TAGS | |||
1219 | echo "-I __initdata,__exitdata,__acquires,__releases \ | 1241 | echo "-I __initdata,__exitdata,__acquires,__releases \ |
1220 | -I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL \ | 1242 | -I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL \ |
1221 | --extra=+f --c-kinds=+px"`; \ | 1243 | --extra=+f --c-kinds=+px"`; \ |
1222 | $(all-sources) | xargs etags $$ETAGSF -a | 1244 | $(all-sources) | xargs etags $$ETAGSF -a; \ |
1245 | if test "x$$ETAGSF" = x; then \ | ||
1246 | $(all-kconfigs) | xargs etags -a \ | ||
1247 | --regex='/^config[ \t]+\([a-zA-Z0-9_]+\)/\1/'; \ | ||
1248 | $(all-defconfigs) | xargs etags -a \ | ||
1249 | --regex='/^#?[ \t]?\(CONFIG_[a-zA-Z0-9_]+\)/\1/'; \ | ||
1250 | fi | ||
1223 | endef | 1251 | endef |
1224 | 1252 | ||
1225 | TAGS: FORCE | 1253 | TAGS: FORCE |
@@ -1259,14 +1287,14 @@ namespacecheck: | |||
1259 | endif #ifeq ($(config-targets),1) | 1287 | endif #ifeq ($(config-targets),1) |
1260 | endif #ifeq ($(mixed-targets),1) | 1288 | endif #ifeq ($(mixed-targets),1) |
1261 | 1289 | ||
1262 | PHONY += checkstack | 1290 | PHONY += checkstack kernelrelease kernelversion |
1263 | checkstack: | 1291 | checkstack: |
1264 | $(OBJDUMP) -d vmlinux $$(find . -name '*.ko') | \ | 1292 | $(OBJDUMP) -d vmlinux $$(find . -name '*.ko') | \ |
1265 | $(PERL) $(src)/scripts/checkstack.pl $(ARCH) | 1293 | $(PERL) $(src)/scripts/checkstack.pl $(ARCH) |
1266 | 1294 | ||
1267 | kernelrelease: | 1295 | kernelrelease: |
1268 | $(if $(wildcard .kernelrelease), $(Q)echo $(KERNELRELEASE), \ | 1296 | $(if $(wildcard include/config/kernel.release), $(Q)echo $(KERNELRELEASE), \ |
1269 | $(error kernelrelease not valid - run 'make *config' to update it)) | 1297 | $(error kernelrelease not valid - run 'make prepare' to update it)) |
1270 | kernelversion: | 1298 | kernelversion: |
1271 | @echo $(KERNELVERSION) | 1299 | @echo $(KERNELVERSION) |
1272 | 1300 | ||
@@ -1301,6 +1329,8 @@ endif | |||
1301 | $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) | 1329 | $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) |
1302 | %.o: %.S prepare scripts FORCE | 1330 | %.o: %.S prepare scripts FORCE |
1303 | $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) | 1331 | $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) |
1332 | %.symtypes: %.c prepare scripts FORCE | ||
1333 | $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) | ||
1304 | 1334 | ||
1305 | # Modules | 1335 | # Modules |
1306 | / %/: prepare scripts FORCE | 1336 | / %/: prepare scripts FORCE |
@@ -1323,7 +1353,7 @@ quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),CLEAN $(wildcard $(rm-files)) | |||
1323 | 1353 | ||
1324 | a_flags = -Wp,-MD,$(depfile) $(AFLAGS) $(AFLAGS_KERNEL) \ | 1354 | a_flags = -Wp,-MD,$(depfile) $(AFLAGS) $(AFLAGS_KERNEL) \ |
1325 | $(NOSTDINC_FLAGS) $(CPPFLAGS) \ | 1355 | $(NOSTDINC_FLAGS) $(CPPFLAGS) \ |
1326 | $(modkern_aflags) $(EXTRA_AFLAGS) $(AFLAGS_$(*F).o) | 1356 | $(modkern_aflags) $(EXTRA_AFLAGS) $(AFLAGS_$(basetarget).o) |
1327 | 1357 | ||
1328 | quiet_cmd_as_o_S = AS $@ | 1358 | quiet_cmd_as_o_S = AS $@ |
1329 | cmd_as_o_S = $(CC) $(a_flags) -c -o $@ $< | 1359 | cmd_as_o_S = $(CC) $(a_flags) -c -o $@ $< |