aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile213
1 files changed, 121 insertions, 92 deletions
diff --git a/Makefile b/Makefile
index 1700d3f6ea22..e9560c6f8156 100644
--- a/Makefile
+++ b/Makefile
@@ -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
179UTS_MACHINE := $(ARCH) 179UTS_MACHINE := $(ARCH)
180 180
181KCONFIG_CONFIG ?= .config
182
181# SHELL used by kbuild 183# SHELL used by kbuild
182CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \ 184CONFIG_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
186HOSTCC = gcc 188HOSTCC = gcc
187HOSTCXX = g++ 189HOSTCXX = g++
188HOSTCFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer 190HOSTCFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
189HOSTCXXFLAGS = -O2 191HOSTCXXFLAGS = -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
194KBUILD_MODULES := 196KBUILD_MODULES :=
195KBUILD_BUILTIN := 1 197KBUILD_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
202ifeq ($(MAKECMDGOALS),modules) 204ifeq ($(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
266include $(srctree)/scripts/Kbuild.include 268include $(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 272MAKEFLAGS += -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
306CPPFLAGS := -D__KERNEL__ $(LINUXINCLUDE) 307CPPFLAGS := -D__KERNEL__ $(LINUXINCLUDE)
307 308
308CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ 309CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
309 -fno-strict-aliasing -fno-common 310 -fno-strict-aliasing -fno-common
310AFLAGS := -D__ASSEMBLY__ 311AFLAGS := -D__ASSEMBLY__
311 312
312# Read KERNELRELEASE from .kernelrelease (if it exists) 313# Read KERNELRELEASE from include/config/kernel.release (if it exists)
313KERNELRELEASE = $(shell cat .kernelrelease 2> /dev/null) 314KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null)
314KERNELVERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) 315KERNELVERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
315 316
316export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION \ 317export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION
317 ARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC \ 318export ARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC
318 CPP AR NM STRIP OBJCOPY OBJDUMP MAKE AWK GENKSYMS PERL UTS_MACHINE \ 319export CPP AR NM STRIP OBJCOPY OBJDUMP MAKE AWK GENKSYMS PERL UTS_MACHINE
319 HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS 320export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS
320 321
321export CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS 322export CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS
322export CFLAGS CFLAGS_KERNEL CFLAGS_MODULE 323export CFLAGS CFLAGS_KERNEL CFLAGS_MODULE
323export AFLAGS AFLAGS_KERNEL AFLAGS_MODULE 324export 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
364no-dot-config-targets := clean mrproper distclean \ 365no-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
367config-targets := 0 369config-targets := 0
368mixed-targets := 0 370mixed-targets := 0
@@ -404,9 +406,8 @@ include $(srctree)/arch/$(ARCH)/Makefile
404export KBUILD_DEFCONFIG 406export KBUILD_DEFCONFIG
405 407
406config %config: scripts_basic outputmakefile FORCE 408config %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
411else 412else
412# =========================================================================== 413# ===========================================================================
@@ -416,13 +417,11 @@ else
416ifeq ($(KBUILD_EXTMOD),) 417ifeq ($(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
420PHONY += scripts 421PHONY += scripts
421scripts: scripts_basic include/config/MARKER 422scripts: scripts_basic include/config/auto.conf
422 $(Q)$(MAKE) $(build)=$(@) 423 $(Q)$(MAKE) $(build)=$(@)
423 424
424scripts_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
427init-y := init/ 426init-y := init/
428drivers-y := drivers/ sound/ 427drivers-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
441include .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
452include/linux/autoconf.h: .kconfig.d .config 448include/config/auto.conf: $(KCONFIG_CONFIG) include/config/auto.conf.cmd
453 $(Q)mkdir -p include/linux 449ifeq ($(KBUILD_EXTMOD),)
454 $(Q)$(MAKE) -f $(srctree)/Makefile silentoldconfig 450 $(Q)$(MAKE) -f $(srctree)/Makefile silentoldconfig
455else 451else
452 $(error kernel configuration not valid - run 'make prepare' in $(srctree) to update it)
453endif
454
455else
456# Dummy target needed, because used as prerequisite 456# Dummy target needed, because used as prerequisite
457include/linux/autoconf.h: ; 457include/config/auto.conf: ;
458endif 458endif
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
464all: vmlinux 464all: vmlinux
465 465
466ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE 466ifdef 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
493CFLAGS += $(call cc-option,-Wdeclaration-after-statement,) 493CFLAGS += $(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
496CFLAGS += $(call cc-option,-Wno-pointer-sign,) 496CFLAGS += $(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
516MODLIB = $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE) 516MODLIB = $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE)
517export MODLIB 517export 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
525ifdef INSTALL_MOD_STRIP
526ifeq ($(INSTALL_MOD_STRIP),1)
527mod_strip_cmd = $STRIP) --strip-debug
528else
529mod_strip_cmd = $(STRIP) $(INSTALL_MOD_STRIP)
530endif # INSTALL_MOD_STRIP=1
531else
532mod_strip_cmd = true
533endif # INSTALL_MOD_STRIP
534export mod_strip_cmd
535
519 536
520ifeq ($(KBUILD_EXTMOD),) 537ifeq ($(KBUILD_EXTMOD),)
521core-y += kernel/ mm/ fs/ ipc/ security/ crypto/ block/ 538core-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
593quiet_cmd_sysmap = SYSMAP 610quiet_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)))
737localver = $(subst $(space),, \ 754localver = $(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
754localver-full = $(localver)$(localver-auto) 771localver-full = $(localver)$(localver-auto)
755 772
756# Store (new) KERNELRELASE string in .kernelrelease 773# Store (new) KERNELRELASE string in include/config/kernel.release
757kernelrelease = $(KERNELVERSION)$(localver-full) 774kernelrelease = $(KERNELVERSION)$(localver-full)
758.kernelrelease: FORCE 775include/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
779prepare3: .kernelrelease 796prepare3: include/config/kernel.release
780ifneq ($(KBUILD_SRC),) 797ifneq ($(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
792prepare2: prepare3 outputmakefile 809prepare2: prepare3 outputmakefile
793 810
794prepare1: prepare2 include/linux/version.h include/asm \ 811prepare1: prepare2 include/linux/version.h include/asm \
795 include/config/MARKER 812 include/config/auto.conf
796ifneq ($(KBUILD_MODULES),) 813ifneq ($(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..
807prepare prepare-all: prepare0 824prepare 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
812export CPPFLAGS_vmlinux.lds += -P -C -U$(ARCH) 829export 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
818include/asm: 835include/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
825include/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 )
847endef 857endef
848 858
849include/linux/version.h: $(srctree)/Makefile .config .kernelrelease FORCE 859include/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
861ifdef CONFIG_MODULES 871ifdef CONFIG_MODULES
862 872
863# By default, build modules as well 873# By default, build modules as well
864 874
865all: modules 875all: modules
866 876
@@ -942,7 +952,7 @@ CLEAN_FILES += vmlinux System.map \
942MRPROPER_DIRS += include/config include2 952MRPROPER_DIRS += include/config include2
943MRPROPER_FILES += .config .config.old include/asm .version .old_version \ 953MRPROPER_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
983distclean: mrproper 994distclean: 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
995package-dir := $(srctree)/scripts/package 1006package-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) $@
999rpm: FORCE 1010rpm: 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)
1136clean: $(clean-dirs) 1147clean: $(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
1175ALLINCLUDE_ARCHS := $(ARCH) 1186ALLINCLUDE_ARCHS := $(ARCH)
1176endif 1187endif
1177else 1188else
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.
1179ALLINCLUDE_ARCHS := $(ALLSOURCE_ARCHS) 1190ALLINCLUDE_ARCHS := $(ALLSOURCE_ARCHS)
1180endif 1191endif
1181 1192
1182ALLSOURCE_ARCHS := $(ARCH) 1193ALLSOURCE_ARCHS := $(ARCH)
1183 1194
1184define all-sources 1195define 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 )
1214endef
1215
1216define all-sources
1217 $(call find-sources,'*.[chS]')
1218endef
1219define all-kconfigs
1220 $(call find-sources,'Kconfig*')
1221endef
1222define all-defconfigs
1223 $(call find-sources,'defconfig')
1203endef 1224endef
1204 1225
1205quiet_cmd_cscope-file = FILELST cscope.files 1226quiet_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
1223endef 1250endef
1224 1251
1225TAGS: FORCE 1252TAGS: FORCE
@@ -1259,14 +1286,14 @@ namespacecheck:
1259endif #ifeq ($(config-targets),1) 1286endif #ifeq ($(config-targets),1)
1260endif #ifeq ($(mixed-targets),1) 1287endif #ifeq ($(mixed-targets),1)
1261 1288
1262PHONY += checkstack 1289PHONY += checkstack kernelrelease kernelversion
1263checkstack: 1290checkstack:
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
1267kernelrelease: 1294kernelrelease:
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))
1270kernelversion: 1297kernelversion:
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