ia64/xen-unstable

changeset 3087:f0d6fa2867c5

bitkeeper revision 1.1159.187.2 (41a270c1UPbV2BI-dBs9cyad-p32tQ)

Add patch from Rik van Riel to delete include/.asm-ignore from the top-level Linux Makefile during a mkae mrproper.
I think we'll wait until things settle down before sending this one upstream...
author iap10@labyrinth.cl.cam.ac.uk
date Mon Nov 22 23:05:37 2004 +0000 (2004-11-22)
parents b7cbbc4c7a3e
children 7ef582b6c9c4 50eaaedc0d3c f5685b2bcb25 624548f0c77b
files .rootkeys linux-2.6.9-xen-sparse/Makefile
line diff
     1.1 --- a/.rootkeys	Mon Nov 22 22:57:05 2004 +0000
     1.2 +++ b/.rootkeys	Mon Nov 22 23:05:37 2004 +0000
     1.3 @@ -127,6 +127,7 @@ 409ba2e7akOFqQUg6Qyg2s28xcXiMg linux-2.4
     1.4  3e5a4e683HKVU-sxtagrDasRB8eBVw linux-2.4.27-xen-sparse/mm/swapfile.c
     1.5  41180721bNns9Na7w1nJ0ZVt8bhUNA linux-2.4.27-xen-sparse/mm/vmalloc.c
     1.6  41505c57WAd5l1rlfCLNSCpx9J13vA linux-2.4.27-xen-sparse/net/core/skbuff.c
     1.7 +41a270bfmh73b5G5UMWfoUZhxoIjTg linux-2.6.9-xen-sparse/Makefile
     1.8  40f562372u3A7_kfbYYixPHJJxYUxA linux-2.6.9-xen-sparse/arch/xen/Kconfig
     1.9  40f56237utH41NPukqHksuNf29IC9A linux-2.6.9-xen-sparse/arch/xen/Kconfig.drivers
    1.10  40f56237penAAlWVBVDpeQZNFIg8CA linux-2.6.9-xen-sparse/arch/xen/Makefile
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/linux-2.6.9-xen-sparse/Makefile	Mon Nov 22 23:05:37 2004 +0000
     2.3 @@ -0,0 +1,1293 @@
     2.4 +VERSION = 2
     2.5 +PATCHLEVEL = 6
     2.6 +SUBLEVEL = 9
     2.7 +EXTRAVERSION =
     2.8 +NAME=Zonked Quokka
     2.9 +
    2.10 +# *DOCUMENTATION*
    2.11 +# To see a list of typical targets execute "make help"
    2.12 +# More info can be located in ./README
    2.13 +# Comments in this file are targeted only to the developer, do not
    2.14 +# expect to learn how to build the kernel reading this file.
    2.15 +
    2.16 +# Do not print "Entering directory ..."
    2.17 +MAKEFLAGS += --no-print-directory
    2.18 +
    2.19 +# We are using a recursive build, so we need to do a little thinking
    2.20 +# to get the ordering right.
    2.21 +#
    2.22 +# Most importantly: sub-Makefiles should only ever modify files in
    2.23 +# their own directory. If in some directory we have a dependency on
    2.24 +# a file in another dir (which doesn't happen often, but it's of
    2.25 +# unavoidable when linking the built-in.o targets which finally
    2.26 +# turn into vmlinux), we will call a sub make in that other dir, and
    2.27 +# after that we are sure that everything which is in that other dir
    2.28 +# is now up to date.
    2.29 +#
    2.30 +# The only cases where we need to modify files which have global
    2.31 +# effects are thus separated out and done before the recursive
    2.32 +# descending is started. They are now explicitly listed as the
    2.33 +# prepare rule.
    2.34 +
    2.35 +# To put more focus on warnings, be less verbose as default
    2.36 +# Use 'make V=1' to see the full commands
    2.37 +
    2.38 +ifdef V
    2.39 +  ifeq ("$(origin V)", "command line")
    2.40 +    KBUILD_VERBOSE = $(V)
    2.41 +  endif
    2.42 +endif
    2.43 +ifndef KBUILD_VERBOSE
    2.44 +  KBUILD_VERBOSE = 0
    2.45 +endif
    2.46 +
    2.47 +# Call sparse as part of compilation of C files
    2.48 +# Use 'make C=1' to enable sparse checking
    2.49 +
    2.50 +ifdef C
    2.51 +  ifeq ("$(origin C)", "command line")
    2.52 +    KBUILD_CHECKSRC = $(C)
    2.53 +  endif
    2.54 +endif
    2.55 +ifndef KBUILD_CHECKSRC
    2.56 +  KBUILD_CHECKSRC = 0
    2.57 +endif
    2.58 +
    2.59 +# Use make M=dir to specify directory of external module to build
    2.60 +# Old syntax make ... SUBDIRS=$PWD is still supported
    2.61 +# Setting the environment variable KBUILD_EXTMOD take precedence
    2.62 +ifdef SUBDIRS
    2.63 +  KBUILD_EXTMOD ?= $(SUBDIRS)
    2.64 +endif
    2.65 +ifdef M
    2.66 +  ifeq ("$(origin M)", "command line")
    2.67 +    KBUILD_EXTMOD := $(M)
    2.68 +  endif
    2.69 +endif
    2.70 +
    2.71 +
    2.72 +# kbuild supports saving output files in a separate directory.
    2.73 +# To locate output files in a separate directory two syntax'es are supported.
    2.74 +# In both cases the working directory must be the root of the kernel src.
    2.75 +# 1) O=
    2.76 +# Use "make O=dir/to/store/output/files/"
    2.77 +# 
    2.78 +# 2) Set KBUILD_OUTPUT
    2.79 +# Set the environment variable KBUILD_OUTPUT to point to the directory
    2.80 +# where the output files shall be placed.
    2.81 +# export KBUILD_OUTPUT=dir/to/store/output/files/
    2.82 +# make
    2.83 +#
    2.84 +# The O= assigment takes precedence over the KBUILD_OUTPUT environment variable.
    2.85 +
    2.86 +
    2.87 +# KBUILD_SRC is set on invocation of make in OBJ directory
    2.88 +# KBUILD_SRC is not intended to be used by the regular user (for now)
    2.89 +ifeq ($(KBUILD_SRC),)
    2.90 +
    2.91 +# OK, Make called in directory where kernel src resides
    2.92 +# Do we want to locate output files in a separate directory?
    2.93 +ifdef O
    2.94 +  ifeq ("$(origin O)", "command line")
    2.95 +    KBUILD_OUTPUT := $(O)
    2.96 +  endif
    2.97 +endif
    2.98 +
    2.99 +# That's our default target when none is given on the command line
   2.100 +.PHONY: _all
   2.101 +_all:
   2.102 +
   2.103 +ifneq ($(KBUILD_OUTPUT),)
   2.104 +# Invoke a second make in the output directory, passing relevant variables
   2.105 +# check that the output directory actually exists
   2.106 +saved-output := $(KBUILD_OUTPUT)
   2.107 +KBUILD_OUTPUT := $(shell cd $(KBUILD_OUTPUT) && /bin/pwd)
   2.108 +$(if $(KBUILD_OUTPUT),, \
   2.109 +     $(error output directory "$(saved-output)" does not exist))
   2.110 +
   2.111 +.PHONY: $(MAKECMDGOALS)
   2.112 +
   2.113 +$(filter-out _all,$(MAKECMDGOALS)) _all:
   2.114 +	$(if $(KBUILD_VERBOSE:1=),@)$(MAKE) -C $(KBUILD_OUTPUT)		\
   2.115 +	KBUILD_SRC=$(CURDIR)	     KBUILD_VERBOSE=$(KBUILD_VERBOSE)	\
   2.116 +	KBUILD_CHECK=$(KBUILD_CHECK) KBUILD_EXTMOD="$(KBUILD_EXTMOD)"	\
   2.117 +        -f $(CURDIR)/Makefile $@
   2.118 +
   2.119 +# Leave processing to above invocation of make
   2.120 +skip-makefile := 1
   2.121 +endif # ifneq ($(KBUILD_OUTPUT),)
   2.122 +endif # ifeq ($(KBUILD_SRC),)
   2.123 +
   2.124 +# We process the rest of the Makefile if this is the final invocation of make
   2.125 +ifeq ($(skip-makefile),)
   2.126 +
   2.127 +# If building an external module we do not care about the all: rule
   2.128 +# but instead _all depend on modules
   2.129 +.PHONY: all
   2.130 +ifeq ($(KBUILD_EXTMOD),)
   2.131 +_all: all
   2.132 +else
   2.133 +_all: modules
   2.134 +endif
   2.135 +
   2.136 +srctree		:= $(if $(KBUILD_SRC),$(KBUILD_SRC),$(CURDIR))
   2.137 +TOPDIR		:= $(srctree)
   2.138 +# FIXME - TOPDIR is obsolete, use srctree/objtree
   2.139 +objtree		:= $(CURDIR)
   2.140 +src		:= $(srctree)
   2.141 +obj		:= $(objtree)
   2.142 +
   2.143 +VPATH		:= $(srctree)
   2.144 +
   2.145 +export srctree objtree VPATH TOPDIR
   2.146 +
   2.147 +nullstring :=
   2.148 +space      := $(nullstring) # end of line
   2.149 +
   2.150 +# Take the contents of any files called localversion* and the config
   2.151 +# variable CONFIG_LOCALVERSION and append them to KERNELRELEASE. Be
   2.152 +# careful not to include files twice if building in the source
   2.153 +# directory. LOCALVERSION from the command line override all of this
   2.154 +
   2.155 +ifeq ($(objtree),$(srctree))
   2.156 +localversion-files := $(wildcard $(srctree)/localversion*)
   2.157 +else
   2.158 +localversion-files := $(wildcard $(objtree)/localversion* $(srctree)/localversion*)
   2.159 +endif
   2.160 +
   2.161 +LOCALVERSION = $(subst $(space),, \
   2.162 +	       $(shell cat /dev/null $(localversion-files)) \
   2.163 +	       $(subst ",,$(CONFIG_LOCALVERSION)))
   2.164 +
   2.165 +KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)$(LOCALVERSION)
   2.166 +
   2.167 +# SUBARCH tells the usermode build what the underlying arch is.  That is set
   2.168 +# first, and if a usermode build is happening, the "ARCH=um" on the command
   2.169 +# line overrides the setting of ARCH below.  If a native build is happening,
   2.170 +# then ARCH is assigned, getting whatever value it gets normally, and 
   2.171 +# SUBARCH is subsequently ignored.
   2.172 +
   2.173 +SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
   2.174 +				  -e s/arm.*/arm/ -e s/sa110/arm/ \
   2.175 +				  -e s/s390x/s390/ -e s/parisc64/parisc/ )
   2.176 +
   2.177 +# Cross compiling and selecting different set of gcc/bin-utils
   2.178 +# ---------------------------------------------------------------------------
   2.179 +#
   2.180 +# When performing cross compilation for other architectures ARCH shall be set
   2.181 +# to the target architecture. (See arch/* for the possibilities).
   2.182 +# ARCH can be set during invocation of make:
   2.183 +# make ARCH=ia64
   2.184 +# Another way is to have ARCH set in the environment.
   2.185 +# The default ARCH is the host where make is executed.
   2.186 +
   2.187 +# CROSS_COMPILE specify the prefix used for all executables used
   2.188 +# during compilation. Only gcc and related bin-utils executables
   2.189 +# are prefixed with $(CROSS_COMPILE).
   2.190 +# CROSS_COMPILE can be set on the command line
   2.191 +# make CROSS_COMPILE=ia64-linux-
   2.192 +# Alternatively CROSS_COMPILE can be set in the environment.
   2.193 +# Default value for CROSS_COMPILE is not to prefix executables
   2.194 +# Note: Some architectures assign CROSS_COMPILE in their arch/*/Makefile
   2.195 +
   2.196 +ARCH		?= $(SUBARCH)
   2.197 +CROSS_COMPILE	?=
   2.198 +
   2.199 +# Architecture as present in compile.h
   2.200 +UTS_MACHINE := $(ARCH)
   2.201 +
   2.202 +# SHELL used by kbuild
   2.203 +CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
   2.204 +	  else if [ -x /bin/bash ]; then echo /bin/bash; \
   2.205 +	  else echo sh; fi ; fi)
   2.206 +
   2.207 +HOSTCC  	= gcc
   2.208 +HOSTCXX  	= g++
   2.209 +HOSTCFLAGS	= -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
   2.210 +HOSTCXXFLAGS	= -O2
   2.211 +
   2.212 +# 	Decide whether to build built-in, modular, or both.
   2.213 +#	Normally, just do built-in.
   2.214 +
   2.215 +KBUILD_MODULES :=
   2.216 +KBUILD_BUILTIN := 1
   2.217 +
   2.218 +#	If we have only "make modules", don't compile built-in objects.
   2.219 +#	When we're building modules with modversions, we need to consider
   2.220 +#	the built-in objects during the descend as well, in order to
   2.221 +#	make sure the checksums are uptodate before we record them.
   2.222 +
   2.223 +ifeq ($(MAKECMDGOALS),modules)
   2.224 +  KBUILD_BUILTIN := $(if $(CONFIG_MODVERSIONS),1)
   2.225 +endif
   2.226 +
   2.227 +#	If we have "make <whatever> modules", compile modules
   2.228 +#	in addition to whatever we do anyway.
   2.229 +#	Just "make" or "make all" shall build modules as well
   2.230 +
   2.231 +ifneq ($(filter all _all modules,$(MAKECMDGOALS)),)
   2.232 +  KBUILD_MODULES := 1
   2.233 +endif
   2.234 +
   2.235 +ifeq ($(MAKECMDGOALS),)
   2.236 +  KBUILD_MODULES := 1
   2.237 +endif
   2.238 +
   2.239 +export KBUILD_MODULES KBUILD_BUILTIN KBUILD_VERBOSE
   2.240 +export KBUILD_CHECKSRC KBUILD_SRC KBUILD_EXTMOD
   2.241 +
   2.242 +# Beautify output
   2.243 +# ---------------------------------------------------------------------------
   2.244 +#
   2.245 +# Normally, we echo the whole command before executing it. By making
   2.246 +# that echo $($(quiet)$(cmd)), we now have the possibility to set
   2.247 +# $(quiet) to choose other forms of output instead, e.g.
   2.248 +#
   2.249 +#         quiet_cmd_cc_o_c = Compiling $(RELDIR)/$@
   2.250 +#         cmd_cc_o_c       = $(CC) $(c_flags) -c -o $@ $<
   2.251 +#
   2.252 +# If $(quiet) is empty, the whole command will be printed.
   2.253 +# If it is set to "quiet_", only the short version will be printed. 
   2.254 +# If it is set to "silent_", nothing wil be printed at all, since
   2.255 +# the variable $(silent_cmd_cc_o_c) doesn't exist.
   2.256 +#
   2.257 +# A simple variant is to prefix commands with $(Q) - that's usefull
   2.258 +# for commands that shall be hidden in non-verbose mode.
   2.259 +#
   2.260 +#	$(Q)ln $@ :<
   2.261 +#
   2.262 +# If KBUILD_VERBOSE equals 0 then the above command will be hidden.
   2.263 +# If KBUILD_VERBOSE equals 1 then the above command is displayed.
   2.264 +
   2.265 +ifeq ($(KBUILD_VERBOSE),1)
   2.266 +  quiet =
   2.267 +  Q =
   2.268 +else
   2.269 +  quiet=quiet_
   2.270 +  Q = @
   2.271 +endif
   2.272 +
   2.273 +# If the user is running make -s (silent mode), suppress echoing of
   2.274 +# commands
   2.275 +
   2.276 +ifneq ($(findstring s,$(MAKEFLAGS)),)
   2.277 +  quiet=silent_
   2.278 +endif
   2.279 +
   2.280 +export quiet Q KBUILD_VERBOSE
   2.281 +
   2.282 +######
   2.283 +# cc support functions to be used (only) in arch/$(ARCH)/Makefile
   2.284 +# See documentation in Documentation/kbuild/makefiles.txt
   2.285 +
   2.286 +# cc-option
   2.287 +# Usage: cflags-y += $(call gcc-option, -march=winchip-c6, -march=i586)
   2.288 +
   2.289 +cc-option = $(shell if $(CC) $(CFLAGS) $(1) -S -o /dev/null -xc /dev/null \
   2.290 +             > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;)
   2.291 +
   2.292 +# For backward compatibility
   2.293 +check_gcc = $(warning check_gcc is deprecated - use cc-option) \
   2.294 +            $(call cc-option, $(1),$(2))
   2.295 +
   2.296 +# cc-option-yn
   2.297 +# Usage: flag := $(call gcc-option-yn, -march=winchip-c6)
   2.298 +cc-option-yn = $(shell if $(CC) $(CFLAGS) $(1) -S -o /dev/null -xc /dev/null \
   2.299 +                > /dev/null 2>&1; then echo "y"; else echo "n"; fi;)
   2.300 +
   2.301 +# cc-version
   2.302 +# Usage gcc-ver := $(call cc-version $(CC))
   2.303 +cc-version = $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-version.sh \
   2.304 +              $(if $(1), $(1), $(CC)))
   2.305 +
   2.306 +
   2.307 +# Look for make include files relative to root of kernel src
   2.308 +MAKEFLAGS += --include-dir=$(srctree)
   2.309 +
   2.310 +# For maximum performance (+ possibly random breakage, uncomment
   2.311 +# the following)
   2.312 +
   2.313 +#MAKEFLAGS += -rR
   2.314 +
   2.315 +# Make variables (CC, etc...)
   2.316 +
   2.317 +AS		= $(CROSS_COMPILE)as
   2.318 +LD		= $(CROSS_COMPILE)ld
   2.319 +CC		= $(CROSS_COMPILE)gcc
   2.320 +CPP		= $(CC) -E
   2.321 +AR		= $(CROSS_COMPILE)ar
   2.322 +NM		= $(CROSS_COMPILE)nm
   2.323 +STRIP		= $(CROSS_COMPILE)strip
   2.324 +OBJCOPY		= $(CROSS_COMPILE)objcopy
   2.325 +OBJDUMP		= $(CROSS_COMPILE)objdump
   2.326 +AWK		= awk
   2.327 +GENKSYMS	= scripts/genksyms/genksyms
   2.328 +DEPMOD		= /sbin/depmod
   2.329 +KALLSYMS	= scripts/kallsyms
   2.330 +PERL		= perl
   2.331 +CHECK		= sparse
   2.332 +CHECKFLAGS     := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__
   2.333 +MODFLAGS	= -DMODULE
   2.334 +CFLAGS_MODULE   = $(MODFLAGS)
   2.335 +AFLAGS_MODULE   = $(MODFLAGS)
   2.336 +LDFLAGS_MODULE  = -r
   2.337 +CFLAGS_KERNEL	=
   2.338 +AFLAGS_KERNEL	=
   2.339 +
   2.340 +NOSTDINC_FLAGS  = -nostdinc -iwithprefix include
   2.341 +
   2.342 +# Use LINUXINCLUDE when you must reference the include/ directory.
   2.343 +# Needed to be compatible with the O= option
   2.344 +LINUXINCLUDE    := -Iinclude \
   2.345 +                   $(if $(KBUILD_SRC),-Iinclude2 -I$(srctree)/include)
   2.346 +
   2.347 +CPPFLAGS        := -D__KERNEL__ $(LINUXINCLUDE)
   2.348 +
   2.349 +CFLAGS 		:= -Wall -Wstrict-prototypes -Wno-trigraphs \
   2.350 +	  	   -fno-strict-aliasing -fno-common
   2.351 +AFLAGS		:= -D__ASSEMBLY__
   2.352 +
   2.353 +export	VERSION PATCHLEVEL SUBLEVEL EXTRAVERSION LOCALVERSION KERNELRELEASE \
   2.354 +	ARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC \
   2.355 +	CPP AR NM STRIP OBJCOPY OBJDUMP MAKE AWK GENKSYMS PERL UTS_MACHINE \
   2.356 +	HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS
   2.357 +
   2.358 +export CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS
   2.359 +export CFLAGS CFLAGS_KERNEL CFLAGS_MODULE 
   2.360 +export AFLAGS AFLAGS_KERNEL AFLAGS_MODULE
   2.361 +
   2.362 +# When compiling out-of-tree modules, put MODVERDIR in the module
   2.363 +# tree rather than in the kernel tree. The kernel tree might
   2.364 +# even be read-only.
   2.365 +export MODVERDIR := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/).tmp_versions
   2.366 +
   2.367 +# The temporary file to save gcc -MD generated dependencies must not
   2.368 +# contain a comma
   2.369 +comma := ,
   2.370 +depfile = $(subst $(comma),_,$(@D)/.$(@F).d)
   2.371 +
   2.372 +# Files to ignore in find ... statements
   2.373 +
   2.374 +RCS_FIND_IGNORE := \( -name SCCS -o -name BitKeeper -o -name .svn -o -name CVS -o -name .pc \) -prune -o
   2.375 +RCS_TAR_IGNORE := --exclude SCCS --exclude BitKeeper --exclude .svn --exclude CVS --exclude .pc
   2.376 +
   2.377 +# ===========================================================================
   2.378 +# Rules shared between *config targets and build targets
   2.379 +
   2.380 +# Basic helpers built in scripts/
   2.381 +.PHONY: scripts_basic
   2.382 +scripts_basic:
   2.383 +	$(Q)$(MAKE) $(build)=scripts/basic
   2.384 +
   2.385 +# To make sure we do not include .config for any of the *config targets
   2.386 +# catch them early, and hand them over to scripts/kconfig/Makefile
   2.387 +# It is allowed to specify more targets when calling make, including
   2.388 +# mixing *config targets and build targets.
   2.389 +# For example 'make oldconfig all'. 
   2.390 +# Detect when mixed targets is specified, and make a second invocation
   2.391 +# of make so .config is not included in this case either (for *config).
   2.392 +
   2.393 +no-dot-config-targets := clean mrproper distclean \
   2.394 +			 cscope TAGS tags help %docs check%
   2.395 +
   2.396 +config-targets := 0
   2.397 +mixed-targets  := 0
   2.398 +dot-config     := 1
   2.399 +
   2.400 +ifneq ($(filter $(no-dot-config-targets), $(MAKECMDGOALS)),)
   2.401 +	ifeq ($(filter-out $(no-dot-config-targets), $(MAKECMDGOALS)),)
   2.402 +		dot-config := 0
   2.403 +	endif
   2.404 +endif
   2.405 +
   2.406 +ifeq ($(KBUILD_EXTMOD),)
   2.407 +        ifneq ($(filter config %config,$(MAKECMDGOALS)),)
   2.408 +                config-targets := 1
   2.409 +                ifneq ($(filter-out config %config,$(MAKECMDGOALS)),)
   2.410 +                        mixed-targets := 1
   2.411 +                endif
   2.412 +        endif
   2.413 +endif
   2.414 +
   2.415 +ifeq ($(mixed-targets),1)
   2.416 +# ===========================================================================
   2.417 +# We're called with mixed targets (*config and build targets).
   2.418 +# Handle them one by one.
   2.419 +
   2.420 +%:: FORCE
   2.421 +	$(Q)$(MAKE) -C $(srctree) KBUILD_SRC= $@
   2.422 +
   2.423 +else
   2.424 +ifeq ($(config-targets),1)
   2.425 +# ===========================================================================
   2.426 +# *config targets only - make sure prerequisites are updated, and descend
   2.427 +# in scripts/kconfig to make the *config target
   2.428 +
   2.429 +config: scripts_basic FORCE
   2.430 +	$(Q)$(MAKE) $(build)=scripts/kconfig $@
   2.431 +%config: scripts_basic FORCE
   2.432 +	$(Q)$(MAKE) $(build)=scripts/kconfig $@
   2.433 +
   2.434 +else
   2.435 +# ===========================================================================
   2.436 +# Build targets only - this includes vmlinux, arch specific targets, clean
   2.437 +# targets and others. In general all targets except *config targets.
   2.438 +
   2.439 +ifeq ($(KBUILD_EXTMOD),)
   2.440 +# Additional helpers built in scripts/
   2.441 +# Carefully list dependencies so we do not try to build scripts twice
   2.442 +# in parrallel
   2.443 +.PHONY: scripts
   2.444 +scripts: scripts_basic include/config/MARKER
   2.445 +	$(Q)$(MAKE) $(build)=$(@)
   2.446 +
   2.447 +scripts_basic: include/linux/autoconf.h
   2.448 +
   2.449 +# Objects we will link into vmlinux / subdirs we need to visit
   2.450 +init-y		:= init/
   2.451 +drivers-y	:= drivers/ sound/
   2.452 +net-y		:= net/
   2.453 +libs-y		:= lib/
   2.454 +core-y		:= usr/
   2.455 +endif # KBUILD_EXTMOD
   2.456 +
   2.457 +ifeq ($(dot-config),1)
   2.458 +# In this section, we need .config
   2.459 +
   2.460 +# Read in dependencies to all Kconfig* files, make sure to run
   2.461 +# oldconfig if changes are detected.
   2.462 +-include .config.cmd
   2.463 +
   2.464 +include .config
   2.465 +
   2.466 +# If .config needs to be updated, it will be done via the dependency
   2.467 +# that autoconf has on .config.
   2.468 +# To avoid any implicit rule to kick in, define an empty command
   2.469 +.config: ;
   2.470 +
   2.471 +# If .config is newer than include/linux/autoconf.h, someone tinkered
   2.472 +# with it and forgot to run make oldconfig
   2.473 +include/linux/autoconf.h: .config
   2.474 +	$(Q)$(MAKE) -f $(srctree)/Makefile silentoldconfig
   2.475 +else
   2.476 +# Dummy target needed, because used as prerequisite
   2.477 +include/linux/autoconf.h: ;
   2.478 +endif
   2.479 +
   2.480 +# The all: target is the default when no target is given on the
   2.481 +# command line.
   2.482 +# This allow a user to issue only 'make' to build a kernel including modules
   2.483 +# Defaults vmlinux but it is usually overriden in the arch makefile
   2.484 +all: vmlinux
   2.485 +
   2.486 +ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
   2.487 +CFLAGS		+= -Os
   2.488 +else
   2.489 +CFLAGS		+= -O2
   2.490 +endif
   2.491 +
   2.492 +ifndef CONFIG_FRAME_POINTER
   2.493 +CFLAGS		+= -fomit-frame-pointer
   2.494 +endif
   2.495 +
   2.496 +ifdef CONFIG_DEBUG_INFO
   2.497 +CFLAGS		+= -g
   2.498 +endif
   2.499 +
   2.500 +# warn about C99 declaration after statement
   2.501 +CFLAGS += $(call cc-option,-Wdeclaration-after-statement,)
   2.502 +
   2.503 +include $(srctree)/arch/$(ARCH)/Makefile
   2.504 +
   2.505 +# Default kernel image to build when no specific target is given.
   2.506 +# KBUILD_IMAGE may be overruled on the commandline or
   2.507 +# set in the environment
   2.508 +# Also any assingments in arch/$(ARCH)/Makefiel take precedence over
   2.509 +# this default value
   2.510 +export KBUILD_IMAGE ?= vmlinux
   2.511 +
   2.512 +#
   2.513 +# INSTALL_PATH specifies where to place the updated kernel and system map
   2.514 +# images.  Uncomment if you want to place them anywhere other than root.
   2.515 +#
   2.516 +
   2.517 +#export	INSTALL_PATH=/boot
   2.518 +
   2.519 +#
   2.520 +# INSTALL_MOD_PATH specifies a prefix to MODLIB for module directory
   2.521 +# relocations required by build roots.  This is not defined in the
   2.522 +# makefile but the arguement can be passed to make if needed.
   2.523 +#
   2.524 +
   2.525 +MODLIB	:= $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE)
   2.526 +export MODLIB
   2.527 +
   2.528 +
   2.529 +ifeq ($(KBUILD_EXTMOD),)
   2.530 +core-y		+= kernel/ mm/ fs/ ipc/ security/ crypto/
   2.531 +
   2.532 +vmlinux-dirs	:= $(patsubst %/,%,$(filter %/, $(init-y) $(init-m) \
   2.533 +		     $(core-y) $(core-m) $(drivers-y) $(drivers-m) \
   2.534 +		     $(net-y) $(net-m) $(libs-y) $(libs-m)))
   2.535 +
   2.536 +vmlinux-alldirs	:= $(sort $(vmlinux-dirs) $(patsubst %/,%,$(filter %/, \
   2.537 +		     $(init-n) $(init-) \
   2.538 +		     $(core-n) $(core-) $(drivers-n) $(drivers-) \
   2.539 +		     $(net-n)  $(net-)  $(libs-n)    $(libs-))))
   2.540 +
   2.541 +init-y		:= $(patsubst %/, %/built-in.o, $(init-y))
   2.542 +core-y		:= $(patsubst %/, %/built-in.o, $(core-y))
   2.543 +drivers-y	:= $(patsubst %/, %/built-in.o, $(drivers-y))
   2.544 +net-y		:= $(patsubst %/, %/built-in.o, $(net-y))
   2.545 +libs-y1		:= $(patsubst %/, %/lib.a, $(libs-y))
   2.546 +libs-y2		:= $(patsubst %/, %/built-in.o, $(libs-y))
   2.547 +libs-y		:= $(libs-y1) $(libs-y2)
   2.548 +
   2.549 +# Build vmlinux
   2.550 +# ---------------------------------------------------------------------------
   2.551 +# vmlinux is build from the objects selected by $(vmlinux-init) and
   2.552 +# $(vmlinux-main). Most are built-in.o files from top-level directories
   2.553 +# in the kernel tree, others are specified in arch/$(ARCH)Makefile.
   2.554 +# Ordering when linking is important, and $(vmlinux-init) must be first.
   2.555 +#
   2.556 +# vmlinux
   2.557 +#   ^
   2.558 +#   |
   2.559 +#   +-< $(vmlinux-init)
   2.560 +#   |   +--< init/version.o + more
   2.561 +#   |
   2.562 +#   +--< $(vmlinux-main)
   2.563 +#   |    +--< driver/built-in.o mm/built-in.o + more
   2.564 +#   |
   2.565 +#   +-< kallsyms.o (see description in CONFIG_KALLSYMS section)
   2.566 +#
   2.567 +# vmlinux version (uname -v) cannot be updated during normal
   2.568 +# descending-into-subdirs phase since we do not yet know if we need to
   2.569 +# update vmlinux.
   2.570 +# Therefore this step is delayed until just before final link of vmlinux -
   2.571 +# except in the kallsyms case where it is done just before adding the
   2.572 +# symbols to the kernel.
   2.573 +#
   2.574 +# System.map is generated to document addresses of all kernel symbols
   2.575 +
   2.576 +vmlinux-init := $(head-y) $(init-y)
   2.577 +vmlinux-main := $(core-y) $(libs-y) $(drivers-y) $(net-y)
   2.578 +vmlinux-all  := $(vmlinux-init) $(vmlinux-main)
   2.579 +vmlinux-lds  := arch/$(ARCH)/kernel/vmlinux.lds
   2.580 +
   2.581 +# Rule to link vmlinux - also used during CONFIG_KALLSYMS
   2.582 +# May be overridden by arch/$(ARCH)/Makefile
   2.583 +quiet_cmd_vmlinux__ ?= LD      $@
   2.584 +      cmd_vmlinux__ ?= $(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) -o $@ \
   2.585 +      -T $(vmlinux-lds) $(vmlinux-init)                          \
   2.586 +      --start-group $(vmlinux-main) --end-group                  \
   2.587 +      $(filter-out $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) FORCE ,$^)
   2.588 +
   2.589 +# Generate new vmlinux version
   2.590 +quiet_cmd_vmlinux_version = GEN     .version
   2.591 +      cmd_vmlinux_version = set -e;                     \
   2.592 +	. $(srctree)/scripts/mkversion > .tmp_version;	\
   2.593 +	mv -f .tmp_version .version;			\
   2.594 +	$(MAKE) $(build)=init
   2.595 +
   2.596 +# Generate System.map
   2.597 +quiet_cmd_sysmap = SYSMAP 
   2.598 +      cmd_sysmap = $(CONFIG_SHELL) $(srctree)/scripts/mksysmap
   2.599 +
   2.600 +# Link of vmlinux
   2.601 +# If CONFIG_KALLSYMS is set .version is already updated
   2.602 +# Generate System.map and verify that the content is consistent
   2.603 +
   2.604 +define rule_vmlinux__
   2.605 +	$(if $(CONFIG_KALLSYMS),,+$(call cmd,vmlinux_version))
   2.606 +
   2.607 +	$(call cmd,vmlinux__)
   2.608 +	$(Q)echo 'cmd_$@ := $(cmd_vmlinux__)' > $(@D)/.$(@F).cmd
   2.609 +
   2.610 +	$(Q)$(if $($(quiet)cmd_sysmap),                 \
   2.611 +	  echo '  $($(quiet)cmd_sysmap) System.map' &&) \
   2.612 +	$(cmd_sysmap) $@ System.map;                    \
   2.613 +	if [ $$? -ne 0 ]; then                          \
   2.614 +		rm -f $@;                               \
   2.615 +		/bin/false;                             \
   2.616 +	fi;
   2.617 +	$(verify_kallsyms)
   2.618 +endef
   2.619 +
   2.620 +
   2.621 +ifdef CONFIG_KALLSYMS
   2.622 +# Generate section listing all symbols and add it into vmlinux $(kallsyms.o)
   2.623 +# It's a three stage process:
   2.624 +# o .tmp_vmlinux1 has all symbols and sections, but __kallsyms is
   2.625 +#   empty
   2.626 +#   Running kallsyms on that gives us .tmp_kallsyms1.o with
   2.627 +#   the right size - vmlinux version (uname -v) is updated during this step
   2.628 +# o .tmp_vmlinux2 now has a __kallsyms section of the right size,
   2.629 +#   but due to the added section, some addresses have shifted.
   2.630 +#   From here, we generate a correct .tmp_kallsyms2.o
   2.631 +# o The correct .tmp_kallsyms2.o is linked into the final vmlinux.
   2.632 +# o Verify that the System.map from vmlinux matches the map from
   2.633 +#   .tmp_vmlinux2, just in case we did not generate kallsyms correctly.
   2.634 +# o If CONFIG_KALLSYMS_EXTRA_PASS is set, do an extra pass using
   2.635 +#   .tmp_vmlinux3 and .tmp_kallsyms3.o.  This is only meant as a
   2.636 +#   temporary bypass to allow the kernel to be built while the
   2.637 +#   maintainers work out what went wrong with kallsyms.
   2.638 +
   2.639 +ifdef CONFIG_KALLSYMS_EXTRA_PASS
   2.640 +last_kallsyms := 3
   2.641 +else
   2.642 +last_kallsyms := 2
   2.643 +endif
   2.644 +
   2.645 +kallsyms.o := .tmp_kallsyms$(last_kallsyms).o
   2.646 +
   2.647 +define verify_kallsyms
   2.648 +	$(Q)$(if $($(quiet)cmd_sysmap),                       \
   2.649 +	  echo '  $($(quiet)cmd_sysmap) .tmp_System.map' &&)  \
   2.650 +	  $(cmd_sysmap) .tmp_vmlinux$(last_kallsyms) .tmp_System.map
   2.651 +	$(Q)cmp -s System.map .tmp_System.map ||              \
   2.652 +		(echo Inconsistent kallsyms data;             \
   2.653 +		 echo Try setting CONFIG_KALLSYMS_EXTRA_PASS; \
   2.654 +		 rm .tmp_kallsyms* ; /bin/false )
   2.655 +endef
   2.656 +
   2.657 +# Update vmlinux version before link
   2.658 +# Use + in front of this rule to silent warning about make -j1
   2.659 +cmd_ksym_ld = $(cmd_vmlinux__)
   2.660 +define rule_ksym_ld
   2.661 +	+$(call cmd,vmlinux_version)
   2.662 +	$(call cmd,vmlinux__)
   2.663 +	$(Q)echo 'cmd_$@ := $(cmd_vmlinux__)' > $(@D)/.$(@F).cmd
   2.664 +endef
   2.665 +
   2.666 +# Generate .S file with all kernel symbols
   2.667 +quiet_cmd_kallsyms = KSYM    $@
   2.668 +      cmd_kallsyms = $(NM) -n $< | $(KALLSYMS) \
   2.669 +                     $(if $(CONFIG_KALLSYMS_ALL),--all-symbols) > $@
   2.670 +
   2.671 +.tmp_kallsyms1.o .tmp_kallsyms2.o .tmp_kallsyms3.o: %.o: %.S scripts FORCE
   2.672 +	$(call if_changed_dep,as_o_S)
   2.673 +
   2.674 +.tmp_kallsyms%.S: .tmp_vmlinux% $(KALLSYMS)
   2.675 +	$(call cmd,kallsyms)
   2.676 +
   2.677 +# .tmp_vmlinux1 must be complete except kallsyms, so update vmlinux version
   2.678 +.tmp_vmlinux1: $(vmlinux-lds) $(vmlinux-all) FORCE
   2.679 +	$(call if_changed_rule,ksym_ld)
   2.680 +
   2.681 +.tmp_vmlinux2: $(vmlinux-lds) $(vmlinux-all) .tmp_kallsyms1.o FORCE
   2.682 +	$(call if_changed,vmlinux__)
   2.683 +
   2.684 +.tmp_vmlinux3: $(vmlinux-lds) $(vmlinux-all) .tmp_kallsyms2.o FORCE
   2.685 +	$(call if_changed,vmlinux__)
   2.686 +
   2.687 +# Needs to visit scripts/ before $(KALLSYMS) can be used.
   2.688 +$(KALLSYMS): scripts ;
   2.689 +
   2.690 +endif # ifdef CONFIG_KALLSYMS
   2.691 +
   2.692 +# vmlinux image - including updated kernel symbols
   2.693 +vmlinux: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) $(kallsyms.o) FORCE
   2.694 +	$(call if_changed_rule,vmlinux__)
   2.695 +
   2.696 +# The actual objects are generated when descending, 
   2.697 +# make sure no implicit rule kicks in
   2.698 +$(sort $(vmlinux-init) $(vmlinux-main)) $(vmlinux-lds): $(vmlinux-dirs) ;
   2.699 +
   2.700 +# Handle descending into subdirectories listed in $(vmlinux-dirs)
   2.701 +# Preset locale variables to speed up the build process. Limit locale
   2.702 +# tweaks to this spot to avoid wrong language settings when running
   2.703 +# make menuconfig etc.
   2.704 +# Error messages still appears in the original language
   2.705 +
   2.706 +.PHONY: $(vmlinux-dirs)
   2.707 +$(vmlinux-dirs): prepare-all scripts
   2.708 +	$(Q)$(MAKE) $(build)=$@
   2.709 +
   2.710 +# Things we need to do before we recursively start building the kernel
   2.711 +# or the modules are listed in "prepare-all".
   2.712 +# A multi level approach is used. prepare1 is updated first, then prepare0.
   2.713 +# prepare-all is the collection point for the prepare targets.
   2.714 +
   2.715 +.PHONY: prepare-all prepare prepare0 prepare1 prepare2
   2.716 +
   2.717 +# prepare 2 generate Makefile to be placed in output directory, if
   2.718 +# using a seperate output directory. This allows convinient use
   2.719 +# of make in output directory
   2.720 +prepare2:
   2.721 +	$(Q)if /usr/bin/env test ! $(srctree) -ef $(objtree); then \
   2.722 +	$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile              \
   2.723 +	    $(srctree) $(objtree) $(VERSION) $(PATCHLEVEL)         \
   2.724 +	    > $(objtree)/Makefile;                                 \
   2.725 +	fi
   2.726 +
   2.727 +# prepare1 is used to check if we are building in a separate output directory,
   2.728 +# and if so do:
   2.729 +# 1) Check that make has not been executed in the kernel src $(srctree)
   2.730 +# 2) Create the include2 directory, used for the second asm symlink
   2.731 +
   2.732 +prepare1: prepare2
   2.733 +ifneq ($(KBUILD_SRC),)
   2.734 +	@echo '  Using $(srctree) as source for kernel'
   2.735 +	$(Q)if [ -h $(srctree)/include/asm -o -f $(srctree)/.config ]; then \
   2.736 +		echo "  $(srctree) is not clean, please run 'make mrproper'";\
   2.737 +		echo "  in the '$(srctree)' directory.";\
   2.738 +		/bin/false; \
   2.739 +	fi;
   2.740 +	$(Q)if [ ! -d include2 ]; then mkdir -p include2; fi;
   2.741 +	$(Q)ln -fsn $(srctree)/include/asm-$(ARCH) include2/asm
   2.742 +endif
   2.743 +
   2.744 +prepare0: prepare1 include/linux/version.h include/asm include/config/MARKER
   2.745 +ifneq ($(KBUILD_MODULES),)
   2.746 +	$(Q)rm -rf $(MODVERDIR)
   2.747 +	$(Q)mkdir -p $(MODVERDIR)
   2.748 +endif
   2.749 +
   2.750 +# All the preparing..
   2.751 +prepare-all: prepare0 prepare
   2.752 +
   2.753 +#	Leave this as default for preprocessing vmlinux.lds.S, which is now
   2.754 +#	done in arch/$(ARCH)/kernel/Makefile
   2.755 +
   2.756 +export CPPFLAGS_vmlinux.lds += -P -C -U$(ARCH)
   2.757 +
   2.758 +# Single targets
   2.759 +# ---------------------------------------------------------------------------
   2.760 +
   2.761 +%.s: %.c scripts FORCE
   2.762 +	$(Q)$(MAKE) $(build)=$(@D) $@
   2.763 +%.i: %.c scripts FORCE
   2.764 +	$(Q)$(MAKE) $(build)=$(@D) $@
   2.765 +%.o: %.c scripts FORCE
   2.766 +	$(Q)$(MAKE) $(build)=$(@D) $@
   2.767 +%/:      scripts prepare FORCE
   2.768 +	$(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) $(build)=$(@D)
   2.769 +%.lst: %.c scripts FORCE
   2.770 +	$(Q)$(MAKE) $(build)=$(@D) $@
   2.771 +%.s: %.S scripts FORCE
   2.772 +	$(Q)$(MAKE) $(build)=$(@D) $@
   2.773 +%.o: %.S scripts FORCE
   2.774 +	$(Q)$(MAKE) $(build)=$(@D) $@
   2.775 +
   2.776 +# 	FIXME: The asm symlink changes when $(ARCH) changes. That's
   2.777 +#	hard to detect, but I suppose "make mrproper" is a good idea
   2.778 +#	before switching between archs anyway.
   2.779 +
   2.780 +include/asm:
   2.781 +	@echo '  SYMLINK $@ -> include/asm-$(ARCH)'
   2.782 +	$(Q)if [ ! -d include ]; then mkdir -p include; fi;
   2.783 +	@ln -fsn asm-$(ARCH) $@
   2.784 +
   2.785 +# 	Split autoconf.h into include/linux/config/*
   2.786 +
   2.787 +include/config/MARKER: include/linux/autoconf.h
   2.788 +	@echo '  SPLIT   include/linux/autoconf.h -> include/config/*'
   2.789 +	@scripts/basic/split-include include/linux/autoconf.h include/config
   2.790 +	@touch $@
   2.791 +
   2.792 +# Generate some files
   2.793 +# ---------------------------------------------------------------------------
   2.794 +
   2.795 +# KERNELRELEASE can change from a few different places, meaning version.h
   2.796 +# needs to be updated, so this check is forced on all builds
   2.797 +
   2.798 +uts_len := 64
   2.799 +
   2.800 +define filechk_version.h
   2.801 +	if [ `echo -n "$(KERNELRELEASE)" | wc -c ` -gt $(uts_len) ]; then \
   2.802 +	  echo '"$(KERNELRELEASE)" exceeds $(uts_len) characters' >&2; \
   2.803 +	  exit 1; \
   2.804 +	fi; \
   2.805 +	(echo \#define UTS_RELEASE \"$(KERNELRELEASE)\"; \
   2.806 +	  echo \#define LINUX_VERSION_CODE `expr $(VERSION) \\* 65536 + $(PATCHLEVEL) \\* 256 + $(SUBLEVEL)`; \
   2.807 +	 echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))'; \
   2.808 +	)
   2.809 +endef
   2.810 +
   2.811 +include/linux/version.h: $(srctree)/Makefile FORCE
   2.812 +	$(call filechk,version.h)
   2.813 +
   2.814 +# ---------------------------------------------------------------------------
   2.815 +
   2.816 +.PHONY: depend dep
   2.817 +depend dep:
   2.818 +	@echo '*** Warning: make $@ is unnecessary now.'
   2.819 +
   2.820 +# ---------------------------------------------------------------------------
   2.821 +# Modules
   2.822 +
   2.823 +ifdef CONFIG_MODULES
   2.824 +
   2.825 +# 	By default, build modules as well
   2.826 +
   2.827 +all: modules
   2.828 +
   2.829 +#	Build modules
   2.830 +
   2.831 +.PHONY: modules
   2.832 +modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux)
   2.833 +	@echo '  Building modules, stage 2.';
   2.834 +	$(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modpost
   2.835 +
   2.836 +
   2.837 +# Target to prepare building external modules
   2.838 +.PHONY: modules_prepare
   2.839 +modules_prepare: prepare-all scripts
   2.840 +
   2.841 +# Target to install modules
   2.842 +.PHONY: modules_install
   2.843 +modules_install: _modinst_ _modinst_post
   2.844 +
   2.845 +.PHONY: _modinst_
   2.846 +_modinst_:
   2.847 +	@if [ -z "`$(DEPMOD) -V | grep module-init-tools`" ]; then \
   2.848 +		echo "Warning: you may need to install module-init-tools"; \
   2.849 +		echo "See http://www.codemonkey.org.uk/docs/post-halloween-2.6.txt";\
   2.850 +		sleep 1; \
   2.851 +	fi
   2.852 +	@rm -rf $(MODLIB)/kernel
   2.853 +	@rm -f $(MODLIB)/source
   2.854 +	@mkdir -p $(MODLIB)/kernel
   2.855 +	@ln -s $(srctree) $(MODLIB)/source
   2.856 +	@if [ ! $(objtree) -ef  $(MODLIB)/build ]; then \
   2.857 +		rm -f $(MODLIB)/build ; \
   2.858 +		ln -s $(objtree) $(MODLIB)/build ; \
   2.859 +	fi
   2.860 +	$(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modinst
   2.861 +
   2.862 +# If System.map exists, run depmod.  This deliberately does not have a
   2.863 +# dependency on System.map since that would run the dependency tree on
   2.864 +# vmlinux.  This depmod is only for convenience to give the initial
   2.865 +# boot a modules.dep even before / is mounted read-write.  However the
   2.866 +# boot script depmod is the master version.
   2.867 +ifeq "$(strip $(INSTALL_MOD_PATH))" ""
   2.868 +depmod_opts	:=
   2.869 +else
   2.870 +depmod_opts	:= -b $(INSTALL_MOD_PATH) -r
   2.871 +endif
   2.872 +.PHONY: _modinst_post
   2.873 +_modinst_post: _modinst_
   2.874 +	if [ -r System.map ]; then $(DEPMOD) -ae -F System.map $(depmod_opts) $(KERNELRELEASE); fi
   2.875 +
   2.876 +else # CONFIG_MODULES
   2.877 +
   2.878 +# Modules not configured
   2.879 +# ---------------------------------------------------------------------------
   2.880 +
   2.881 +modules modules_install: FORCE
   2.882 +	@echo
   2.883 +	@echo "The present kernel configuration has modules disabled."
   2.884 +	@echo "Type 'make config' and enable loadable module support."
   2.885 +	@echo "Then build a kernel with module support enabled."
   2.886 +	@echo
   2.887 +	@exit 1
   2.888 +
   2.889 +endif # CONFIG_MODULES
   2.890 +
   2.891 +# Generate asm-offsets.h 
   2.892 +# ---------------------------------------------------------------------------
   2.893 +
   2.894 +define filechk_gen-asm-offsets
   2.895 +	(set -e; \
   2.896 +	 echo "#ifndef __ASM_OFFSETS_H__"; \
   2.897 +	 echo "#define __ASM_OFFSETS_H__"; \
   2.898 +	 echo "/*"; \
   2.899 +	 echo " * DO NOT MODIFY."; \
   2.900 +	 echo " *"; \
   2.901 +	 echo " * This file was generated by arch/$(ARCH)/Makefile"; \
   2.902 +	 echo " *"; \
   2.903 +	 echo " */"; \
   2.904 +	 echo ""; \
   2.905 +	 sed -ne "/^->/{s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}"; \
   2.906 +	 echo ""; \
   2.907 +	 echo "#endif" )
   2.908 +endef
   2.909 +
   2.910 +
   2.911 +###
   2.912 +# Cleaning is done on three levels.
   2.913 +# make clean     Delete most generated files
   2.914 +#                Leave enough to build external modules
   2.915 +# make mrproper  Delete the current configuration, and all generated files
   2.916 +# make distclean Remove editor backup files, patch leftover files and the like
   2.917 +
   2.918 +# Directories & files removed with 'make clean'
   2.919 +CLEAN_DIRS  += $(MODVERDIR)
   2.920 +CLEAN_FILES +=	vmlinux System.map \
   2.921 +                .tmp_kallsyms* .tmp_version .tmp_vmlinux* .tmp_System.map
   2.922 +
   2.923 +# Directories & files removed with 'make mrproper'
   2.924 +MRPROPER_DIRS  += include/config include2
   2.925 +MRPROPER_FILES += .config .config.old include/asm .version \
   2.926 +                  include/linux/autoconf.h include/linux/version.h \
   2.927 +                  Module.symvers tags TAGS cscope* include/.asm-ignore
   2.928 +
   2.929 +# clean - Delete most, but leave enough to build external modules
   2.930 +#
   2.931 +clean: rm-dirs  := $(CLEAN_DIRS)
   2.932 +clean: rm-files := $(CLEAN_FILES)
   2.933 +clean-dirs      := $(addprefix _clean_,$(vmlinux-alldirs))
   2.934 +
   2.935 +.PHONY: $(clean-dirs) clean archclean
   2.936 +$(clean-dirs):
   2.937 +	$(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@)
   2.938 +
   2.939 +clean: archclean $(clean-dirs)
   2.940 +	$(call cmd,rmdirs)
   2.941 +	$(call cmd,rmfiles)
   2.942 +	@find . $(RCS_FIND_IGNORE) \
   2.943 +	 	\( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \
   2.944 +		-o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \) \
   2.945 +		-type f -print | xargs rm -f
   2.946 +
   2.947 +# mrproper - Delete all generated files, including .config
   2.948 +#
   2.949 +mrproper: rm-dirs  := $(wildcard $(MRPROPER_DIRS))
   2.950 +mrproper: rm-files := $(wildcard $(MRPROPER_FILES))
   2.951 +mrproper-dirs      := $(addprefix _mrproper_,Documentation/DocBook scripts)
   2.952 +
   2.953 +.PHONY: $(mrproper-dirs) mrproper archmrproper
   2.954 +$(mrproper-dirs):
   2.955 +	$(Q)$(MAKE) $(clean)=$(patsubst _mrproper_%,%,$@)
   2.956 +
   2.957 +mrproper: clean archmrproper $(mrproper-dirs)
   2.958 +	$(call cmd,rmdirs)
   2.959 +	$(call cmd,rmfiles)
   2.960 +
   2.961 +# distclean
   2.962 +#
   2.963 +.PHONY: distclean
   2.964 +
   2.965 +distclean: mrproper
   2.966 +	@find $(srctree) $(RCS_FIND_IGNORE) \
   2.967 +	 	\( -name '*.orig' -o -name '*.rej' -o -name '*~' \
   2.968 +		-o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
   2.969 +	 	-o -name '.*.rej' -o -size 0 \
   2.970 +		-o -name '*%' -o -name '.*.cmd' -o -name 'core' \) \
   2.971 +		-type f -print | xargs rm -f
   2.972 +
   2.973 +
   2.974 +# Packaging of the kernel to various formats
   2.975 +# ---------------------------------------------------------------------------
   2.976 +# rpm target kept for backward compatibility
   2.977 +package-dir	:= $(srctree)/scripts/package
   2.978 +
   2.979 +.PHONY: %-pkg rpm
   2.980 +
   2.981 +%pkg: FORCE
   2.982 +	$(Q)$(MAKE) -f $(package-dir)/Makefile $@
   2.983 +rpm: FORCE
   2.984 +	$(Q)$(MAKE) -f $(package-dir)/Makefile $@
   2.985 +
   2.986 +
   2.987 +# Brief documentation of the typical targets used
   2.988 +# ---------------------------------------------------------------------------
   2.989 +
   2.990 +boards := $(wildcard $(srctree)/arch/$(ARCH)/configs/*_defconfig)
   2.991 +boards := $(notdir $(boards))
   2.992 +
   2.993 +help:
   2.994 +	@echo  'Cleaning targets:'
   2.995 +	@echo  '  clean		  - remove most generated files but keep the config'
   2.996 +	@echo  '  mrproper	  - remove all generated files + config + various backup files'
   2.997 +	@echo  ''
   2.998 +	@echo  'Configuration targets:'
   2.999 +	@$(MAKE) -f $(srctree)/scripts/kconfig/Makefile help
  2.1000 +	@echo  ''
  2.1001 +	@echo  'Other generic targets:'
  2.1002 +	@echo  '  all		  - Build all targets marked with [*]'
  2.1003 +	@echo  '* vmlinux	  - Build the bare kernel'
  2.1004 +	@echo  '* modules	  - Build all modules'
  2.1005 +	@echo  '  modules_install - Install all modules'
  2.1006 +	@echo  '  dir/            - Build all files in dir and below'
  2.1007 +	@echo  '  dir/file.[ois]  - Build specified target only'
  2.1008 +	@echo  '  rpm		  - Build a kernel as an RPM package'
  2.1009 +	@echo  '  tags/TAGS	  - Generate tags file for editors'
  2.1010 +	@echo  '  cscope	  - Generate cscope index'
  2.1011 +	@echo  ''
  2.1012 +	@echo  'Static analysers'
  2.1013 +	@echo  '  buildcheck      - List dangling references to vmlinux discarded sections'
  2.1014 +	@echo  '                    and init sections from non-init sections'
  2.1015 +	@echo  '  checkstack      - Generate a list of stack hogs'
  2.1016 +	@echo  '  namespacecheck  - Name space analysis on compiled kernel'
  2.1017 +	@echo  ''
  2.1018 +	@echo  'Kernel packaging:'
  2.1019 +	@$(MAKE) -f $(package-dir)/Makefile help
  2.1020 +	@echo  ''
  2.1021 +	@echo  'Documentation targets:'
  2.1022 +	@$(MAKE) -f $(srctree)/Documentation/DocBook/Makefile dochelp
  2.1023 +	@echo  ''
  2.1024 +	@echo  'Architecture specific targets ($(ARCH)):'
  2.1025 +	@$(if $(archhelp),$(archhelp),\
  2.1026 +		echo '  No architecture specific help defined for $(ARCH)')
  2.1027 +	@echo  ''
  2.1028 +	@$(if $(boards), \
  2.1029 +		$(foreach b, $(boards), \
  2.1030 +		printf "  %-24s - Build for %s\\n" $(b) $(subst _defconfig,,$(b));) \
  2.1031 +		echo '')
  2.1032 +
  2.1033 +	@echo  '  make V=0|1 [targets] 0 => quiet build (default), 1 => verbose build'
  2.1034 +	@echo  '  make O=dir [targets] Locate all output files in "dir", including .config'
  2.1035 +	@echo  '  make C=1   [targets] Check all c source with $$CHECK (sparse)'
  2.1036 +	@echo  '  make C=2   [targets] Force check of all c source with $$CHECK (sparse)'
  2.1037 +	@echo  ''
  2.1038 +	@echo  'Execute "make" or "make all" to build all targets marked with [*] '
  2.1039 +	@echo  'For further info see the ./README file'
  2.1040 +
  2.1041 +
  2.1042 +# Documentation targets
  2.1043 +# ---------------------------------------------------------------------------
  2.1044 +%docs: scripts_basic FORCE
  2.1045 +	$(Q)$(MAKE) $(build)=Documentation/DocBook $@
  2.1046 +
  2.1047 +else # KBUILD_EXTMOD
  2.1048 +
  2.1049 +###
  2.1050 +# External module support.
  2.1051 +# When building external modules the kernel used as basis is considered
  2.1052 +# read-only, and no consistency checks are made and the make
  2.1053 +# system is not used on the basis kernel. If updates are required
  2.1054 +# in the basis kernel ordinary make commands (without M=...) must
  2.1055 +# be used.
  2.1056 +#
  2.1057 +# The following are the only valid targets when building external
  2.1058 +# modules.
  2.1059 +# make M=dir clean     Delete all automatically generated files
  2.1060 +# make M=dir modules   Make all modules in specified dir
  2.1061 +# make M=dir	       Same as 'make M=dir modules'
  2.1062 +# make M=dir modules_install
  2.1063 +#                      Install the modules build in the module directory
  2.1064 +#                      Assumes install directory is already created
  2.1065 +
  2.1066 +# We are always building modules
  2.1067 +KBUILD_MODULES := 1
  2.1068 +.PHONY: crmodverdir
  2.1069 +crmodverdir:
  2.1070 +	$(Q)mkdir -p $(MODVERDIR)
  2.1071 +
  2.1072 +module-dirs := $(addprefix _module_,$(KBUILD_EXTMOD))
  2.1073 +.PHONY: $(module-dirs) modules
  2.1074 +$(module-dirs): crmodverdir
  2.1075 +	$(Q)$(MAKE) $(build)=$(patsubst _module_%,%,$@)
  2.1076 +
  2.1077 +modules: $(module-dirs)
  2.1078 +	@echo '  Building modules, stage 2.';
  2.1079 +	$(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modpost
  2.1080 +
  2.1081 +.PHONY: modules_install
  2.1082 +modules_install:
  2.1083 +	$(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modinst
  2.1084 +
  2.1085 +clean-dirs := $(addprefix _clean_,$(KBUILD_EXTMOD))
  2.1086 +
  2.1087 +.PHONY: $(clean-dirs) clean
  2.1088 +$(clean-dirs):
  2.1089 +	$(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@)
  2.1090 +
  2.1091 +clean:	rm-dirs := $(MODVERDIR)
  2.1092 +clean: $(clean-dirs)
  2.1093 +	$(call cmd,rmdirs)
  2.1094 +	@find $(KBUILD_EXTMOD) $(RCS_FIND_IGNORE) \
  2.1095 +	 	\( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \
  2.1096 +		-o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \) \
  2.1097 +		-type f -print | xargs rm -f
  2.1098 +
  2.1099 +help:
  2.1100 +	@echo  '  Building external modules.'
  2.1101 +	@echo  '  Syntax: make -C path/to/kernel/src M=$$PWD target'
  2.1102 +	@echo  ''
  2.1103 +	@echo  '  modules         - default target, build the module(s)'
  2.1104 +	@echo  '  modules_install - install the module'
  2.1105 +	@echo  '  clean           - remove generated files in module directory only'
  2.1106 +	@echo  ''
  2.1107 +endif # KBUILD_EXTMOD
  2.1108 +
  2.1109 +# Generate tags for editors
  2.1110 +# ---------------------------------------------------------------------------
  2.1111 +
  2.1112 +define all-sources
  2.1113 +	( find $(srctree) $(RCS_FIND_IGNORE) \
  2.1114 +	       \( -name include -o -name arch \) -prune -o \
  2.1115 +	       -name '*.[chS]' -print; \
  2.1116 +	  find $(srctree)/arch/$(ARCH) $(RCS_FIND_IGNORE) \
  2.1117 +	       -name '*.[chS]' -print; \
  2.1118 +	  find $(srctree)/security/selinux/include $(RCS_FIND_IGNORE) \
  2.1119 +	       -name '*.[chS]' -print; \
  2.1120 +	  find $(srctree)/include $(RCS_FIND_IGNORE) \
  2.1121 +	       \( -name config -o -name 'asm-*' \) -prune \
  2.1122 +	       -o -name '*.[chS]' -print; \
  2.1123 +	  find $(srctree)/include/asm-$(ARCH) $(RCS_FIND_IGNORE) \
  2.1124 +	       -name '*.[chS]' -print; \
  2.1125 +	  find $(srctree)/include/asm-generic $(RCS_FIND_IGNORE) \
  2.1126 +	       -name '*.[chS]' -print )
  2.1127 +endef
  2.1128 +
  2.1129 +quiet_cmd_cscope-file = FILELST cscope.files
  2.1130 +      cmd_cscope-file = $(all-sources) > cscope.files
  2.1131 +
  2.1132 +quiet_cmd_cscope = MAKE    cscope.out
  2.1133 +      cmd_cscope = cscope -k -b -q
  2.1134 +
  2.1135 +cscope: FORCE
  2.1136 +	$(call cmd,cscope-file)
  2.1137 +	$(call cmd,cscope)
  2.1138 +
  2.1139 +quiet_cmd_TAGS = MAKE   $@
  2.1140 +cmd_TAGS = $(all-sources) | etags -
  2.1141 +
  2.1142 +# 	Exuberant ctags works better with -I
  2.1143 +
  2.1144 +quiet_cmd_tags = MAKE   $@
  2.1145 +define cmd_tags
  2.1146 +	rm -f $@; \
  2.1147 +	CTAGSF=`ctags --version | grep -i exuberant >/dev/null && echo "-I __initdata,__exitdata,EXPORT_SYMBOL,EXPORT_SYMBOL_NOVERS"`; \
  2.1148 +	$(all-sources) | xargs ctags $$CTAGSF -a
  2.1149 +endef
  2.1150 +
  2.1151 +TAGS: FORCE
  2.1152 +	$(call cmd,TAGS)
  2.1153 +
  2.1154 +tags: FORCE
  2.1155 +	$(call cmd,tags)
  2.1156 +
  2.1157 +
  2.1158 +# Scripts to check various things for consistency
  2.1159 +# ---------------------------------------------------------------------------
  2.1160 +
  2.1161 +configcheck:
  2.1162 +	find * $(RCS_FIND_IGNORE) \
  2.1163 +		-name '*.[hcS]' -type f -print | sort \
  2.1164 +		| xargs $(PERL) -w scripts/checkconfig.pl
  2.1165 +
  2.1166 +includecheck:
  2.1167 +	find * $(RCS_FIND_IGNORE) \
  2.1168 +		-name '*.[hcS]' -type f -print | sort \
  2.1169 +		| xargs $(PERL) -w scripts/checkincludes.pl
  2.1170 +
  2.1171 +versioncheck:
  2.1172 +	find * $(RCS_FIND_IGNORE) \
  2.1173 +		-name '*.[hcS]' -type f -print | sort \
  2.1174 +		| xargs $(PERL) -w scripts/checkversion.pl
  2.1175 +
  2.1176 +buildcheck:
  2.1177 +	$(PERL) $(srctree)/scripts/reference_discarded.pl
  2.1178 +	$(PERL) $(srctree)/scripts/reference_init.pl
  2.1179 +
  2.1180 +namespacecheck:
  2.1181 +	$(PERL) $(srctree)/scripts/namespace.pl
  2.1182 +
  2.1183 +endif #ifeq ($(config-targets),1)
  2.1184 +endif #ifeq ($(mixed-targets),1)
  2.1185 +
  2.1186 +.PHONY: checkstack
  2.1187 +checkstack:
  2.1188 +	$(OBJDUMP) -d vmlinux $$(find . -name '*.ko') | \
  2.1189 +	$(PERL) $(src)/scripts/checkstack.pl $(ARCH)
  2.1190 +
  2.1191 +# FIXME Should go into a make.lib or something 
  2.1192 +# ===========================================================================
  2.1193 +
  2.1194 +quiet_cmd_rmdirs = $(if $(wildcard $(rm-dirs)),CLEAN   $(wildcard $(rm-dirs)))
  2.1195 +      cmd_rmdirs = rm -rf $(rm-dirs)
  2.1196 +
  2.1197 +quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),CLEAN   $(wildcard $(rm-files)))
  2.1198 +      cmd_rmfiles = rm -f $(rm-files)
  2.1199 +
  2.1200 +
  2.1201 +a_flags = -Wp,-MD,$(depfile) $(AFLAGS) $(AFLAGS_KERNEL) \
  2.1202 +	  $(NOSTDINC_FLAGS) $(CPPFLAGS) \
  2.1203 +	  $(modkern_aflags) $(EXTRA_AFLAGS) $(AFLAGS_$(*F).o)
  2.1204 +
  2.1205 +quiet_cmd_as_o_S = AS      $@
  2.1206 +cmd_as_o_S       = $(CC) $(a_flags) -c -o $@ $<
  2.1207 +
  2.1208 +# read all saved command lines
  2.1209 +
  2.1210 +targets := $(wildcard $(sort $(targets)))
  2.1211 +cmd_files := $(wildcard .*.cmd $(foreach f,$(targets),$(dir $(f)).$(notdir $(f)).cmd))
  2.1212 +
  2.1213 +ifneq ($(cmd_files),)
  2.1214 +  $(cmd_files): ;	# Do not try to update included dependency files
  2.1215 +  include $(cmd_files)
  2.1216 +endif
  2.1217 +
  2.1218 +# Execute command and generate cmd file
  2.1219 +if_changed = $(if $(strip $? \
  2.1220 +		          $(filter-out $(cmd_$(1)),$(cmd_$@))\
  2.1221 +			  $(filter-out $(cmd_$@),$(cmd_$(1)))),\
  2.1222 +	@set -e; \
  2.1223 +	$(if $($(quiet)cmd_$(1)),echo '  $(subst ','\'',$($(quiet)cmd_$(1)))';) \
  2.1224 +	$(cmd_$(1)); \
  2.1225 +	echo 'cmd_$@ := $(subst $$,$$$$,$(subst ','\'',$(cmd_$(1))))' > $(@D)/.$(@F).cmd)
  2.1226 +
  2.1227 +
  2.1228 +# execute the command and also postprocess generated .d dependencies
  2.1229 +# file
  2.1230 +if_changed_dep = $(if $(strip $? $(filter-out FORCE $(wildcard $^),$^)\
  2.1231 +		          $(filter-out $(cmd_$(1)),$(cmd_$@))\
  2.1232 +			  $(filter-out $(cmd_$@),$(cmd_$(1)))),\
  2.1233 +	$(Q)set -e; \
  2.1234 +	$(if $($(quiet)cmd_$(1)),echo '  $(subst ','\'',$($(quiet)cmd_$(1)))';) \
  2.1235 +	$(cmd_$(1)); \
  2.1236 +	scripts/basic/fixdep $(depfile) $@ '$(subst $$,$$$$,$(subst ','\'',$(cmd_$(1))))' > $(@D)/.$(@F).tmp; \
  2.1237 +	rm -f $(depfile); \
  2.1238 +	mv -f $(@D)/.$(@F).tmp $(@D)/.$(@F).cmd)
  2.1239 +
  2.1240 +# Usage: $(call if_changed_rule,foo)
  2.1241 +# will check if $(cmd_foo) changed, or any of the prequisites changed,
  2.1242 +# and if so will execute $(rule_foo)
  2.1243 +
  2.1244 +if_changed_rule = $(if $(strip $? \
  2.1245 +		               $(filter-out $(cmd_$(1)),$(cmd_$(@F)))\
  2.1246 +			       $(filter-out $(cmd_$(@F)),$(cmd_$(1)))),\
  2.1247 +	               $(Q)$(rule_$(1)))
  2.1248 +
  2.1249 +# If quiet is set, only print short version of command
  2.1250 +
  2.1251 +cmd = @$(if $($(quiet)cmd_$(1)),echo '  $($(quiet)cmd_$(1))' &&) $(cmd_$(1))
  2.1252 +
  2.1253 +# filechk is used to check if the content of a generated file is updated.
  2.1254 +# Sample usage:
  2.1255 +# define filechk_sample
  2.1256 +#	echo $KERNELRELEASE
  2.1257 +# endef
  2.1258 +# version.h : Makefile
  2.1259 +#	$(call filechk,sample)
  2.1260 +# The rule defined shall write to stdout the content of the new file.
  2.1261 +# The existing file will be compared with the new one.
  2.1262 +# - If no file exist it is created
  2.1263 +# - If the content differ the new file is used
  2.1264 +# - If they are equal no change, and no timestamp update
  2.1265 +
  2.1266 +define filechk
  2.1267 +	@set -e;				\
  2.1268 +	echo '  CHK     $@';			\
  2.1269 +	mkdir -p $(dir $@);			\
  2.1270 +	$(filechk_$(1)) < $< > $@.tmp;		\
  2.1271 +	if [ -r $@ ] && cmp -s $@ $@.tmp; then	\
  2.1272 +		rm -f $@.tmp;			\
  2.1273 +	else					\
  2.1274 +		echo '  UPD     $@';		\
  2.1275 +		mv -f $@.tmp $@;		\
  2.1276 +	fi
  2.1277 +endef
  2.1278 +
  2.1279 +# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.build obj=dir
  2.1280 +# Usage:
  2.1281 +# $(Q)$(MAKE) $(build)=dir
  2.1282 +build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj
  2.1283 +
  2.1284 +# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.clean obj=dir
  2.1285 +# Usage:
  2.1286 +# $(Q)$(MAKE) $(clean)=dir
  2.1287 +clean := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.clean obj
  2.1288 +
  2.1289 +#	$(call descend,<dir>,<target>)
  2.1290 +#	Recursively call a sub-make in <dir> with target <target>
  2.1291 +# Usage is deprecated, because make does not see this as an invocation of make.
  2.1292 +descend =$(Q)$(MAKE) -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj=$(1) $(2)
  2.1293 +
  2.1294 +endif	# skip-makefile
  2.1295 +
  2.1296 +FORCE: