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