diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 257 |
1 files changed, 148 insertions, 109 deletions
@@ -1,8 +1,8 @@ | |||
1 | VERSION = 2 | 1 | VERSION = 2 |
2 | PATCHLEVEL = 6 | 2 | PATCHLEVEL = 6 |
3 | SUBLEVEL = 17 | 3 | SUBLEVEL = 17 |
4 | EXTRAVERSION =-rc4 | 4 | EXTRAVERSION = |
5 | NAME=Sliding Snow Leopard | 5 | NAME=Crazed Snow-Weasel |
6 | 6 | ||
7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
8 | # To see a list of typical targets execute "make help" | 8 | # To see a list of typical targets execute "make help" |
@@ -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,24 @@ 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 | # Force gcc to behave correct even for buggy distributions |
313 | CFLAGS += $(call cc-option, -fno-stack-protector-all \ | ||
314 | -fno-stack-protector) | ||
315 | AFLAGS := -D__ASSEMBLY__ | ||
311 | 316 | ||
312 | # Read KERNELRELEASE from .kernelrelease (if it exists) | 317 | # Read KERNELRELEASE from include/config/kernel.release (if it exists) |
313 | KERNELRELEASE = $(shell cat .kernelrelease 2> /dev/null) | 318 | KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null) |
314 | KERNELVERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) | 319 | KERNELVERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) |
315 | 320 | ||
316 | export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION \ | 321 | export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION |
317 | ARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC \ | 322 | export ARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC |
318 | CPP AR NM STRIP OBJCOPY OBJDUMP MAKE AWK GENKSYMS PERL UTS_MACHINE \ | 323 | export CPP AR NM STRIP OBJCOPY OBJDUMP MAKE AWK GENKSYMS PERL UTS_MACHINE |
319 | HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS | 324 | export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS |
320 | 325 | ||
321 | export CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS | 326 | export CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS |
322 | export CFLAGS CFLAGS_KERNEL CFLAGS_MODULE | 327 | export CFLAGS CFLAGS_KERNEL CFLAGS_MODULE |
323 | export AFLAGS AFLAGS_KERNEL AFLAGS_MODULE | 328 | export AFLAGS AFLAGS_KERNEL AFLAGS_MODULE |
324 | 329 | ||
325 | # When compiling out-of-tree modules, put MODVERDIR in the module | 330 | # When compiling out-of-tree modules, put MODVERDIR in the module |
@@ -357,12 +362,13 @@ endif | |||
357 | # catch them early, and hand them over to scripts/kconfig/Makefile | 362 | # catch them early, and hand them over to scripts/kconfig/Makefile |
358 | # It is allowed to specify more targets when calling make, including | 363 | # It is allowed to specify more targets when calling make, including |
359 | # mixing *config targets and build targets. | 364 | # mixing *config targets and build targets. |
360 | # For example 'make oldconfig all'. | 365 | # For example 'make oldconfig all'. |
361 | # Detect when mixed targets is specified, and make a second invocation | 366 | # 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). | 367 | # of make so .config is not included in this case either (for *config). |
363 | 368 | ||
364 | no-dot-config-targets := clean mrproper distclean \ | 369 | no-dot-config-targets := clean mrproper distclean \ |
365 | cscope TAGS tags help %docs check% | 370 | cscope TAGS tags help %docs check% \ |
371 | kernelrelease kernelversion | ||
366 | 372 | ||
367 | config-targets := 0 | 373 | config-targets := 0 |
368 | mixed-targets := 0 | 374 | mixed-targets := 0 |
@@ -404,9 +410,8 @@ include $(srctree)/arch/$(ARCH)/Makefile | |||
404 | export KBUILD_DEFCONFIG | 410 | export KBUILD_DEFCONFIG |
405 | 411 | ||
406 | config %config: scripts_basic outputmakefile FORCE | 412 | config %config: scripts_basic outputmakefile FORCE |
407 | $(Q)mkdir -p include/linux | 413 | $(Q)mkdir -p include/linux include/config |
408 | $(Q)$(MAKE) $(build)=scripts/kconfig $@ | 414 | $(Q)$(MAKE) $(build)=scripts/kconfig $@ |
409 | $(Q)$(MAKE) -C $(srctree) KBUILD_SRC= .kernelrelease | ||
410 | 415 | ||
411 | else | 416 | else |
412 | # =========================================================================== | 417 | # =========================================================================== |
@@ -416,13 +421,11 @@ else | |||
416 | ifeq ($(KBUILD_EXTMOD),) | 421 | ifeq ($(KBUILD_EXTMOD),) |
417 | # Additional helpers built in scripts/ | 422 | # Additional helpers built in scripts/ |
418 | # Carefully list dependencies so we do not try to build scripts twice | 423 | # Carefully list dependencies so we do not try to build scripts twice |
419 | # in parrallel | 424 | # in parallel |
420 | PHONY += scripts | 425 | PHONY += scripts |
421 | scripts: scripts_basic include/config/MARKER | 426 | scripts: scripts_basic include/config/auto.conf |
422 | $(Q)$(MAKE) $(build)=$(@) | 427 | $(Q)$(MAKE) $(build)=$(@) |
423 | 428 | ||
424 | scripts_basic: include/linux/autoconf.h | ||
425 | |||
426 | # Objects we will link into vmlinux / subdirs we need to visit | 429 | # Objects we will link into vmlinux / subdirs we need to visit |
427 | init-y := init/ | 430 | init-y := init/ |
428 | drivers-y := drivers/ sound/ | 431 | drivers-y := drivers/ sound/ |
@@ -436,31 +439,32 @@ ifeq ($(dot-config),1) | |||
436 | 439 | ||
437 | # Read in dependencies to all Kconfig* files, make sure to run | 440 | # Read in dependencies to all Kconfig* files, make sure to run |
438 | # oldconfig if changes are detected. | 441 | # oldconfig if changes are detected. |
439 | -include .kconfig.d | 442 | -include include/config/auto.conf.cmd |
443 | -include include/config/auto.conf | ||
440 | 444 | ||
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 | 445 | # To avoid any implicit rule to kick in, define an empty command |
446 | .config .kconfig.d: ; | 446 | $(KCONFIG_CONFIG) include/config/auto.conf.cmd: ; |
447 | 447 | ||
448 | # If .config is newer than include/linux/autoconf.h, someone tinkered | 448 | # If .config is newer than include/config/auto.conf, someone tinkered |
449 | # with it and forgot to run make oldconfig. | 449 | # with it and forgot to run make oldconfig. |
450 | # If kconfig.d is missing then we are probarly in a cleaned tree so | 450 | # 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 | 451 | # we execute the config step to be sure to catch updated Kconfig files |
452 | include/linux/autoconf.h: .kconfig.d .config | 452 | include/config/auto.conf: $(KCONFIG_CONFIG) include/config/auto.conf.cmd |
453 | $(Q)mkdir -p include/linux | 453 | ifeq ($(KBUILD_EXTMOD),) |
454 | $(Q)$(MAKE) -f $(srctree)/Makefile silentoldconfig | 454 | $(Q)$(MAKE) -f $(srctree)/Makefile silentoldconfig |
455 | else | 455 | else |
456 | $(error kernel configuration not valid - run 'make prepare' in $(srctree) to update it) | ||
457 | endif | ||
458 | |||
459 | else | ||
456 | # Dummy target needed, because used as prerequisite | 460 | # Dummy target needed, because used as prerequisite |
457 | include/linux/autoconf.h: ; | 461 | include/config/auto.conf: ; |
458 | endif | 462 | endif |
459 | 463 | ||
460 | # The all: target is the default when no target is given on the | 464 | # The all: target is the default when no target is given on the |
461 | # command line. | 465 | # command line. |
462 | # This allow a user to issue only 'make' to build a kernel including modules | 466 | # 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 | 467 | # Defaults vmlinux but it is usually overridden in the arch makefile |
464 | all: vmlinux | 468 | all: vmlinux |
465 | 469 | ||
466 | ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE | 470 | ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE |
@@ -492,11 +496,11 @@ CHECKFLAGS += $(NOSTDINC_FLAGS) | |||
492 | # warn about C99 declaration after statement | 496 | # warn about C99 declaration after statement |
493 | CFLAGS += $(call cc-option,-Wdeclaration-after-statement,) | 497 | CFLAGS += $(call cc-option,-Wdeclaration-after-statement,) |
494 | 498 | ||
495 | # disable pointer signedness warnings in gcc 4.0 | 499 | # disable pointer signed / unsigned warnings in gcc 4.0 |
496 | CFLAGS += $(call cc-option,-Wno-pointer-sign,) | 500 | CFLAGS += $(call cc-option,-Wno-pointer-sign,) |
497 | 501 | ||
498 | # Default kernel image to build when no specific target is given. | 502 | # Default kernel image to build when no specific target is given. |
499 | # KBUILD_IMAGE may be overruled on the commandline or | 503 | # KBUILD_IMAGE may be overruled on the command line or |
500 | # set in the environment | 504 | # set in the environment |
501 | # Also any assignments in arch/$(ARCH)/Makefile take precedence over | 505 | # Also any assignments in arch/$(ARCH)/Makefile take precedence over |
502 | # this default value | 506 | # this default value |
@@ -510,12 +514,29 @@ export INSTALL_PATH ?= /boot | |||
510 | # | 514 | # |
511 | # INSTALL_MOD_PATH specifies a prefix to MODLIB for module directory | 515 | # INSTALL_MOD_PATH specifies a prefix to MODLIB for module directory |
512 | # relocations required by build roots. This is not defined in the | 516 | # relocations required by build roots. This is not defined in the |
513 | # makefile but the arguement can be passed to make if needed. | 517 | # makefile but the argument can be passed to make if needed. |
514 | # | 518 | # |
515 | 519 | ||
516 | MODLIB = $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE) | 520 | MODLIB = $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE) |
517 | export MODLIB | 521 | export MODLIB |
518 | 522 | ||
523 | # | ||
524 | # INSTALL_MOD_STRIP, if defined, will cause modules to be | ||
525 | # stripped after they are installed. If INSTALL_MOD_STRIP is '1', then | ||
526 | # the default option --strip-debug will be used. Otherwise, | ||
527 | # INSTALL_MOD_STRIP will used as the options to the strip command. | ||
528 | |||
529 | ifdef INSTALL_MOD_STRIP | ||
530 | ifeq ($(INSTALL_MOD_STRIP),1) | ||
531 | mod_strip_cmd = $STRIP) --strip-debug | ||
532 | else | ||
533 | mod_strip_cmd = $(STRIP) $(INSTALL_MOD_STRIP) | ||
534 | endif # INSTALL_MOD_STRIP=1 | ||
535 | else | ||
536 | mod_strip_cmd = true | ||
537 | endif # INSTALL_MOD_STRIP | ||
538 | export mod_strip_cmd | ||
539 | |||
519 | 540 | ||
520 | ifeq ($(KBUILD_EXTMOD),) | 541 | ifeq ($(KBUILD_EXTMOD),) |
521 | core-y += kernel/ mm/ fs/ ipc/ security/ crypto/ block/ | 542 | core-y += kernel/ mm/ fs/ ipc/ security/ crypto/ block/ |
@@ -539,7 +560,7 @@ libs-y := $(libs-y1) $(libs-y2) | |||
539 | 560 | ||
540 | # Build vmlinux | 561 | # Build vmlinux |
541 | # --------------------------------------------------------------------------- | 562 | # --------------------------------------------------------------------------- |
542 | # vmlinux is build from the objects selected by $(vmlinux-init) and | 563 | # vmlinux is built from the objects selected by $(vmlinux-init) and |
543 | # $(vmlinux-main). Most are built-in.o files from top-level directories | 564 | # $(vmlinux-main). Most are built-in.o files from top-level directories |
544 | # in the kernel tree, others are specified in arch/$(ARCH)Makefile. | 565 | # in the kernel tree, others are specified in arch/$(ARCH)Makefile. |
545 | # Ordering when linking is important, and $(vmlinux-init) must be first. | 566 | # Ordering when linking is important, and $(vmlinux-init) must be first. |
@@ -590,7 +611,7 @@ quiet_cmd_vmlinux_version = GEN .version | |||
590 | $(MAKE) $(build)=init | 611 | $(MAKE) $(build)=init |
591 | 612 | ||
592 | # Generate System.map | 613 | # Generate System.map |
593 | quiet_cmd_sysmap = SYSMAP | 614 | quiet_cmd_sysmap = SYSMAP |
594 | cmd_sysmap = $(CONFIG_SHELL) $(srctree)/scripts/mksysmap | 615 | cmd_sysmap = $(CONFIG_SHELL) $(srctree)/scripts/mksysmap |
595 | 616 | ||
596 | # Link of vmlinux | 617 | # Link of vmlinux |
@@ -719,7 +740,7 @@ $(vmlinux-dirs): prepare scripts | |||
719 | $(Q)$(MAKE) $(build)=$@ | 740 | $(Q)$(MAKE) $(build)=$@ |
720 | 741 | ||
721 | # Build the kernel release string | 742 | # Build the kernel release string |
722 | # The KERNELRELEASE is stored in a file named .kernelrelease | 743 | # 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 | 744 | # to be used when executing for example make install or make modules_install |
724 | # | 745 | # |
725 | # Take the contents of any files called localversion* and the config | 746 | # Take the contents of any files called localversion* and the config |
@@ -737,10 +758,10 @@ _localver = $(foreach f, $(__localver), $(if $(findstring ~, $(f)),,$(f))) | |||
737 | localver = $(subst $(space),, \ | 758 | localver = $(subst $(space),, \ |
738 | $(shell cat /dev/null $(_localver)) \ | 759 | $(shell cat /dev/null $(_localver)) \ |
739 | $(patsubst "%",%,$(CONFIG_LOCALVERSION))) | 760 | $(patsubst "%",%,$(CONFIG_LOCALVERSION))) |
740 | 761 | ||
741 | # If CONFIG_LOCALVERSION_AUTO is set scripts/setlocalversion is called | 762 | # If CONFIG_LOCALVERSION_AUTO is set scripts/setlocalversion is called |
742 | # and if the SCM is know a tag from the SCM is appended. | 763 | # and if the SCM is know a tag from the SCM is appended. |
743 | # The appended tag is determinded by the SCM used. | 764 | # The appended tag is determined by the SCM used. |
744 | # | 765 | # |
745 | # Currently, only git is supported. | 766 | # Currently, only git is supported. |
746 | # Other SCMs can edit scripts/setlocalversion and add the appropriate | 767 | # Other SCMs can edit scripts/setlocalversion and add the appropriate |
@@ -753,9 +774,9 @@ endif | |||
753 | 774 | ||
754 | localver-full = $(localver)$(localver-auto) | 775 | localver-full = $(localver)$(localver-auto) |
755 | 776 | ||
756 | # Store (new) KERNELRELASE string in .kernelrelease | 777 | # Store (new) KERNELRELASE string in include/config/kernel.release |
757 | kernelrelease = $(KERNELVERSION)$(localver-full) | 778 | kernelrelease = $(KERNELVERSION)$(localver-full) |
758 | .kernelrelease: FORCE | 779 | include/config/kernel.release: include/config/auto.conf FORCE |
759 | $(Q)rm -f $@ | 780 | $(Q)rm -f $@ |
760 | $(Q)echo $(kernelrelease) > $@ | 781 | $(Q)echo $(kernelrelease) > $@ |
761 | 782 | ||
@@ -776,10 +797,10 @@ PHONY += prepare-all | |||
776 | # and if so do: | 797 | # and if so do: |
777 | # 1) Check that make has not been executed in the kernel src $(srctree) | 798 | # 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 | 799 | # 2) Create the include2 directory, used for the second asm symlink |
779 | prepare3: .kernelrelease | 800 | prepare3: include/config/kernel.release |
780 | ifneq ($(KBUILD_SRC),) | 801 | ifneq ($(KBUILD_SRC),) |
781 | @echo ' Using $(srctree) as source for kernel' | 802 | @echo ' Using $(srctree) as source for kernel' |
782 | $(Q)if [ -f $(srctree)/.config ]; then \ | 803 | $(Q)if [ -f $(srctree)/.config -o -d $(srctree)/include/config ]; then \ |
783 | echo " $(srctree) is not clean, please run 'make mrproper'";\ | 804 | echo " $(srctree) is not clean, please run 'make mrproper'";\ |
784 | echo " in the '$(srctree)' directory.";\ | 805 | echo " in the '$(srctree)' directory.";\ |
785 | /bin/false; \ | 806 | /bin/false; \ |
@@ -791,8 +812,8 @@ endif | |||
791 | # prepare2 creates a makefile if using a separate output directory | 812 | # prepare2 creates a makefile if using a separate output directory |
792 | prepare2: prepare3 outputmakefile | 813 | prepare2: prepare3 outputmakefile |
793 | 814 | ||
794 | prepare1: prepare2 include/linux/version.h include/asm \ | 815 | prepare1: prepare2 include/linux/version.h include/linux/utsrelease.h \ |
795 | include/config/MARKER | 816 | include/asm include/config/auto.conf |
796 | ifneq ($(KBUILD_MODULES),) | 817 | ifneq ($(KBUILD_MODULES),) |
797 | $(Q)mkdir -p $(MODVERDIR) | 818 | $(Q)mkdir -p $(MODVERDIR) |
798 | $(Q)rm -f $(MODVERDIR)/* | 819 | $(Q)rm -f $(MODVERDIR)/* |
@@ -806,27 +827,20 @@ prepare0: archprepare FORCE | |||
806 | # All the preparing.. | 827 | # All the preparing.. |
807 | prepare prepare-all: prepare0 | 828 | prepare prepare-all: prepare0 |
808 | 829 | ||
809 | # Leave this as default for preprocessing vmlinux.lds.S, which is now | 830 | # Leave this as default for preprocessing vmlinux.lds.S, which is now |
810 | # done in arch/$(ARCH)/kernel/Makefile | 831 | # done in arch/$(ARCH)/kernel/Makefile |
811 | 832 | ||
812 | export CPPFLAGS_vmlinux.lds += -P -C -U$(ARCH) | 833 | export CPPFLAGS_vmlinux.lds += -P -C -U$(ARCH) |
813 | 834 | ||
814 | # FIXME: The asm symlink changes when $(ARCH) changes. That's | 835 | # FIXME: The asm symlink changes when $(ARCH) changes. That's |
815 | # hard to detect, but I suppose "make mrproper" is a good idea | 836 | # hard to detect, but I suppose "make mrproper" is a good idea |
816 | # before switching between archs anyway. | 837 | # before switching between archs anyway. |
817 | 838 | ||
818 | include/asm: | 839 | include/asm: |
819 | @echo ' SYMLINK $@ -> include/asm-$(ARCH)' | 840 | @echo ' SYMLINK $@ -> include/asm-$(ARCH)' |
820 | $(Q)if [ ! -d include ]; then mkdir -p include; fi; | 841 | $(Q)if [ ! -d include ]; then mkdir -p include; fi; |
821 | @ln -fsn asm-$(ARCH) $@ | 842 | @ln -fsn asm-$(ARCH) $@ |
822 | 843 | ||
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 | 844 | # Generate some files |
831 | # --------------------------------------------------------------------------- | 845 | # --------------------------------------------------------------------------- |
832 | 846 | ||
@@ -834,21 +848,26 @@ include/config/MARKER: scripts/basic/split-include include/linux/autoconf.h | |||
834 | # needs to be updated, so this check is forced on all builds | 848 | # needs to be updated, so this check is forced on all builds |
835 | 849 | ||
836 | uts_len := 64 | 850 | uts_len := 64 |
851 | define filechk_utsrelease.h | ||
852 | if [ `echo -n "$(KERNELRELEASE)" | wc -c ` -gt $(uts_len) ]; then \ | ||
853 | echo '"$(KERNELRELEASE)" exceeds $(uts_len) characters' >&2; \ | ||
854 | exit 1; \ | ||
855 | fi; \ | ||
856 | (echo \#define UTS_RELEASE \"$(KERNELRELEASE)\";) | ||
857 | endef | ||
837 | 858 | ||
838 | define filechk_version.h | 859 | define filechk_version.h |
839 | if [ `echo -n "$(KERNELRELEASE)" | wc -c ` -gt $(uts_len) ]; then \ | 860 | (echo \#define LINUX_VERSION_CODE $(shell \ |
840 | echo '"$(KERNELRELEASE)" exceeds $(uts_len) characters' >&2; \ | 861 | expr $(VERSION) \* 65536 + $(PATCHLEVEL) \* 256 + $(SUBLEVEL)); \ |
841 | exit 1; \ | 862 | echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))';) |
842 | fi; \ | ||
843 | (echo \#define UTS_RELEASE \"$(KERNELRELEASE)\"; \ | ||
844 | echo \#define LINUX_VERSION_CODE `expr $(VERSION) \\* 65536 + $(PATCHLEVEL) \\* 256 + $(SUBLEVEL)`; \ | ||
845 | echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))'; \ | ||
846 | ) | ||
847 | endef | 863 | endef |
848 | 864 | ||
849 | include/linux/version.h: $(srctree)/Makefile .config .kernelrelease FORCE | 865 | include/linux/version.h: $(srctree)/Makefile FORCE |
850 | $(call filechk,version.h) | 866 | $(call filechk,version.h) |
851 | 867 | ||
868 | include/linux/utsrelease.h: include/config/kernel.release FORCE | ||
869 | $(call filechk,utsrelease.h) | ||
870 | |||
852 | # --------------------------------------------------------------------------- | 871 | # --------------------------------------------------------------------------- |
853 | 872 | ||
854 | PHONY += depend dep | 873 | PHONY += depend dep |
@@ -875,7 +894,7 @@ headers_check: headers_install | |||
875 | 894 | ||
876 | ifdef CONFIG_MODULES | 895 | ifdef CONFIG_MODULES |
877 | 896 | ||
878 | # By default, build modules as well | 897 | # By default, build modules as well |
879 | 898 | ||
880 | all: modules | 899 | all: modules |
881 | 900 | ||
@@ -956,8 +975,9 @@ CLEAN_FILES += vmlinux System.map \ | |||
956 | # Directories & files removed with 'make mrproper' | 975 | # Directories & files removed with 'make mrproper' |
957 | MRPROPER_DIRS += include/config include2 | 976 | MRPROPER_DIRS += include/config include2 |
958 | MRPROPER_FILES += .config .config.old include/asm .version .old_version \ | 977 | MRPROPER_FILES += .config .config.old include/asm .version .old_version \ |
959 | include/linux/autoconf.h include/linux/version.h \ | 978 | include/linux/autoconf.h include/linux/version.h \ |
960 | .kernelrelease Module.symvers tags TAGS cscope* | 979 | include/linux/utsrelease.h \ |
980 | Module.symvers tags TAGS cscope* | ||
961 | 981 | ||
962 | # clean - Delete most, but leave enough to build external modules | 982 | # clean - Delete most, but leave enough to build external modules |
963 | # | 983 | # |
@@ -973,8 +993,9 @@ clean: archclean $(clean-dirs) | |||
973 | $(call cmd,rmdirs) | 993 | $(call cmd,rmdirs) |
974 | $(call cmd,rmfiles) | 994 | $(call cmd,rmfiles) |
975 | @find . $(RCS_FIND_IGNORE) \ | 995 | @find . $(RCS_FIND_IGNORE) \ |
976 | \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \ | 996 | \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \ |
977 | -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \) \ | 997 | -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \ |
998 | -o -name '*.symtypes' \) \ | ||
978 | -type f -print | xargs rm -f | 999 | -type f -print | xargs rm -f |
979 | 1000 | ||
980 | # mrproper - Delete all generated files, including .config | 1001 | # mrproper - Delete all generated files, including .config |
@@ -997,9 +1018,9 @@ PHONY += distclean | |||
997 | 1018 | ||
998 | distclean: mrproper | 1019 | distclean: mrproper |
999 | @find $(srctree) $(RCS_FIND_IGNORE) \ | 1020 | @find $(srctree) $(RCS_FIND_IGNORE) \ |
1000 | \( -name '*.orig' -o -name '*.rej' -o -name '*~' \ | 1021 | \( -name '*.orig' -o -name '*.rej' -o -name '*~' \ |
1001 | -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \ | 1022 | -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \ |
1002 | -o -name '.*.rej' -o -size 0 \ | 1023 | -o -name '.*.rej' -o -size 0 \ |
1003 | -o -name '*%' -o -name '.*.cmd' -o -name 'core' \) \ | 1024 | -o -name '*%' -o -name '.*.cmd' -o -name 'core' \) \ |
1004 | -type f -print | xargs rm -f | 1025 | -type f -print | xargs rm -f |
1005 | 1026 | ||
@@ -1009,9 +1030,9 @@ distclean: mrproper | |||
1009 | # rpm target kept for backward compatibility | 1030 | # rpm target kept for backward compatibility |
1010 | package-dir := $(srctree)/scripts/package | 1031 | package-dir := $(srctree)/scripts/package |
1011 | 1032 | ||
1012 | %pkg: FORCE | 1033 | %pkg: include/config/kernel.release FORCE |
1013 | $(Q)$(MAKE) $(build)=$(package-dir) $@ | 1034 | $(Q)$(MAKE) $(build)=$(package-dir) $@ |
1014 | rpm: FORCE | 1035 | rpm: include/config/kernel.release FORCE |
1015 | $(Q)$(MAKE) $(build)=$(package-dir) $@ | 1036 | $(Q)$(MAKE) $(build)=$(package-dir) $@ |
1016 | 1037 | ||
1017 | 1038 | ||
@@ -1066,8 +1087,8 @@ help: | |||
1066 | 1087 | ||
1067 | @echo ' make V=0|1 [targets] 0 => quiet build (default), 1 => verbose build' | 1088 | @echo ' make V=0|1 [targets] 0 => quiet build (default), 1 => verbose build' |
1068 | @echo ' make O=dir [targets] Locate all output files in "dir", including .config' | 1089 | @echo ' make O=dir [targets] Locate all output files in "dir", including .config' |
1069 | @echo ' make C=1 [targets] Check all c source with $$CHECK (sparse)' | 1090 | @echo ' make C=1 [targets] Check all c source with $$CHECK (sparse by default)' |
1070 | @echo ' make C=2 [targets] Force check of all c source with $$CHECK (sparse)' | 1091 | @echo ' make C=2 [targets] Force check of all c source with $$CHECK' |
1071 | @echo '' | 1092 | @echo '' |
1072 | @echo 'Execute "make" or "make all" to build all targets marked with [*] ' | 1093 | @echo 'Execute "make" or "make all" to build all targets marked with [*] ' |
1073 | @echo 'For further info see the ./README file' | 1094 | @echo 'For further info see the ./README file' |
@@ -1094,7 +1115,7 @@ else # KBUILD_EXTMOD | |||
1094 | # make M=dir modules Make all modules in specified dir | 1115 | # make M=dir modules Make all modules in specified dir |
1095 | # make M=dir Same as 'make M=dir modules' | 1116 | # make M=dir Same as 'make M=dir modules' |
1096 | # make M=dir modules_install | 1117 | # make M=dir modules_install |
1097 | # Install the modules build in the module directory | 1118 | # Install the modules built in the module directory |
1098 | # Assumes install directory is already created | 1119 | # Assumes install directory is already created |
1099 | 1120 | ||
1100 | # We are always building modules | 1121 | # We are always building modules |
@@ -1153,7 +1174,7 @@ clean: rm-dirs := $(MODVERDIR) | |||
1153 | clean: $(clean-dirs) | 1174 | clean: $(clean-dirs) |
1154 | $(call cmd,rmdirs) | 1175 | $(call cmd,rmdirs) |
1155 | @find $(KBUILD_EXTMOD) $(RCS_FIND_IGNORE) \ | 1176 | @find $(KBUILD_EXTMOD) $(RCS_FIND_IGNORE) \ |
1156 | \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \ | 1177 | \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \ |
1157 | -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \) \ | 1178 | -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \) \ |
1158 | -type f -print | xargs rm -f | 1179 | -type f -print | xargs rm -f |
1159 | 1180 | ||
@@ -1192,31 +1213,41 @@ else | |||
1192 | ALLINCLUDE_ARCHS := $(ARCH) | 1213 | ALLINCLUDE_ARCHS := $(ARCH) |
1193 | endif | 1214 | endif |
1194 | else | 1215 | else |
1195 | #Allow user to specify only ALLSOURCE_PATHS on the command line, keeping existing behaviour. | 1216 | #Allow user to specify only ALLSOURCE_PATHS on the command line, keeping existing behavour. |
1196 | ALLINCLUDE_ARCHS := $(ALLSOURCE_ARCHS) | 1217 | ALLINCLUDE_ARCHS := $(ALLSOURCE_ARCHS) |
1197 | endif | 1218 | endif |
1198 | 1219 | ||
1199 | ALLSOURCE_ARCHS := $(ARCH) | 1220 | ALLSOURCE_ARCHS := $(ARCH) |
1200 | 1221 | ||
1201 | define all-sources | 1222 | define find-sources |
1202 | ( find $(__srctree) $(RCS_FIND_IGNORE) \ | 1223 | ( find $(__srctree) $(RCS_FIND_IGNORE) \ |
1203 | \( -name include -o -name arch \) -prune -o \ | 1224 | \( -name include -o -name arch \) -prune -o \ |
1204 | -name '*.[chS]' -print; \ | 1225 | -name $1 -print; \ |
1205 | for ARCH in $(ALLSOURCE_ARCHS) ; do \ | 1226 | for ARCH in $(ALLSOURCE_ARCHS) ; do \ |
1206 | find $(__srctree)arch/$${ARCH} $(RCS_FIND_IGNORE) \ | 1227 | find $(__srctree)arch/$${ARCH} $(RCS_FIND_IGNORE) \ |
1207 | -name '*.[chS]' -print; \ | 1228 | -name $1 -print; \ |
1208 | done ; \ | 1229 | done ; \ |
1209 | find $(__srctree)security/selinux/include $(RCS_FIND_IGNORE) \ | 1230 | find $(__srctree)security/selinux/include $(RCS_FIND_IGNORE) \ |
1210 | -name '*.[chS]' -print; \ | 1231 | -name $1 -print; \ |
1211 | find $(__srctree)include $(RCS_FIND_IGNORE) \ | 1232 | find $(__srctree)include $(RCS_FIND_IGNORE) \ |
1212 | \( -name config -o -name 'asm-*' \) -prune \ | 1233 | \( -name config -o -name 'asm-*' \) -prune \ |
1213 | -o -name '*.[chS]' -print; \ | 1234 | -o -name $1 -print; \ |
1214 | for ARCH in $(ALLINCLUDE_ARCHS) ; do \ | 1235 | for ARCH in $(ALLINCLUDE_ARCHS) ; do \ |
1215 | find $(__srctree)include/asm-$${ARCH} $(RCS_FIND_IGNORE) \ | 1236 | find $(__srctree)include/asm-$${ARCH} $(RCS_FIND_IGNORE) \ |
1216 | -name '*.[chS]' -print; \ | 1237 | -name $1 -print; \ |
1217 | done ; \ | 1238 | done ; \ |
1218 | find $(__srctree)include/asm-generic $(RCS_FIND_IGNORE) \ | 1239 | find $(__srctree)include/asm-generic $(RCS_FIND_IGNORE) \ |
1219 | -name '*.[chS]' -print ) | 1240 | -name $1 -print ) |
1241 | endef | ||
1242 | |||
1243 | define all-sources | ||
1244 | $(call find-sources,'*.[chS]') | ||
1245 | endef | ||
1246 | define all-kconfigs | ||
1247 | $(call find-sources,'Kconfig*') | ||
1248 | endef | ||
1249 | define all-defconfigs | ||
1250 | $(call find-sources,'defconfig') | ||
1220 | endef | 1251 | endef |
1221 | 1252 | ||
1222 | quiet_cmd_cscope-file = FILELST cscope.files | 1253 | quiet_cmd_cscope-file = FILELST cscope.files |
@@ -1236,7 +1267,13 @@ define cmd_TAGS | |||
1236 | echo "-I __initdata,__exitdata,__acquires,__releases \ | 1267 | echo "-I __initdata,__exitdata,__acquires,__releases \ |
1237 | -I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL \ | 1268 | -I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL \ |
1238 | --extra=+f --c-kinds=+px"`; \ | 1269 | --extra=+f --c-kinds=+px"`; \ |
1239 | $(all-sources) | xargs etags $$ETAGSF -a | 1270 | $(all-sources) | xargs etags $$ETAGSF -a; \ |
1271 | if test "x$$ETAGSF" = x; then \ | ||
1272 | $(all-kconfigs) | xargs etags -a \ | ||
1273 | --regex='/^config[ \t]+\([a-zA-Z0-9_]+\)/\1/'; \ | ||
1274 | $(all-defconfigs) | xargs etags -a \ | ||
1275 | --regex='/^#?[ \t]?\(CONFIG_[a-zA-Z0-9_]+\)/\1/'; \ | ||
1276 | fi | ||
1240 | endef | 1277 | endef |
1241 | 1278 | ||
1242 | TAGS: FORCE | 1279 | TAGS: FORCE |
@@ -1276,14 +1313,14 @@ namespacecheck: | |||
1276 | endif #ifeq ($(config-targets),1) | 1313 | endif #ifeq ($(config-targets),1) |
1277 | endif #ifeq ($(mixed-targets),1) | 1314 | endif #ifeq ($(mixed-targets),1) |
1278 | 1315 | ||
1279 | PHONY += checkstack | 1316 | PHONY += checkstack kernelrelease kernelversion |
1280 | checkstack: | 1317 | checkstack: |
1281 | $(OBJDUMP) -d vmlinux $$(find . -name '*.ko') | \ | 1318 | $(OBJDUMP) -d vmlinux $$(find . -name '*.ko') | \ |
1282 | $(PERL) $(src)/scripts/checkstack.pl $(ARCH) | 1319 | $(PERL) $(src)/scripts/checkstack.pl $(ARCH) |
1283 | 1320 | ||
1284 | kernelrelease: | 1321 | kernelrelease: |
1285 | $(if $(wildcard .kernelrelease), $(Q)echo $(KERNELRELEASE), \ | 1322 | $(if $(wildcard include/config/kernel.release), $(Q)echo $(KERNELRELEASE), \ |
1286 | $(error kernelrelease not valid - run 'make *config' to update it)) | 1323 | $(error kernelrelease not valid - run 'make prepare' to update it)) |
1287 | kernelversion: | 1324 | kernelversion: |
1288 | @echo $(KERNELVERSION) | 1325 | @echo $(KERNELVERSION) |
1289 | 1326 | ||
@@ -1318,6 +1355,8 @@ endif | |||
1318 | $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) | 1355 | $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) |
1319 | %.o: %.S prepare scripts FORCE | 1356 | %.o: %.S prepare scripts FORCE |
1320 | $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) | 1357 | $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) |
1358 | %.symtypes: %.c prepare scripts FORCE | ||
1359 | $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) | ||
1321 | 1360 | ||
1322 | # Modules | 1361 | # Modules |
1323 | / %/: prepare scripts FORCE | 1362 | / %/: prepare scripts FORCE |
@@ -1340,7 +1379,7 @@ quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),CLEAN $(wildcard $(rm-files)) | |||
1340 | 1379 | ||
1341 | a_flags = -Wp,-MD,$(depfile) $(AFLAGS) $(AFLAGS_KERNEL) \ | 1380 | a_flags = -Wp,-MD,$(depfile) $(AFLAGS) $(AFLAGS_KERNEL) \ |
1342 | $(NOSTDINC_FLAGS) $(CPPFLAGS) \ | 1381 | $(NOSTDINC_FLAGS) $(CPPFLAGS) \ |
1343 | $(modkern_aflags) $(EXTRA_AFLAGS) $(AFLAGS_$(*F).o) | 1382 | $(modkern_aflags) $(EXTRA_AFLAGS) $(AFLAGS_$(basetarget).o) |
1344 | 1383 | ||
1345 | quiet_cmd_as_o_S = AS $@ | 1384 | quiet_cmd_as_o_S = AS $@ |
1346 | cmd_as_o_S = $(CC) $(a_flags) -c -o $@ $< | 1385 | cmd_as_o_S = $(CC) $(a_flags) -c -o $@ $< |