Merge to Fedora kernel-2.6.7-1.492
[linux-2.6.git] / Makefile
1 VERSION = 2
2 PATCHLEVEL = 6
3 SUBLEVEL = 7
4 EXTRAVERSION = -1.492-ckrm.E15-vs1.9.1
5 NAME=Zonked Quokka
6
7 # *DOCUMENTATION*
8 # To see a list of typical targets execute "make help"
9 # More info can be located in ./README
10 # Comments in this file are targeted only to the developer, do not
11 # expect to learn how to build the kernel reading this file.
12
13 # Do not print "Entering directory ..."
14 MAKEFLAGS += --no-print-directory
15
16 # We are using a recursive build, so we need to do a little thinking
17 # to get the ordering right.
18 #
19 # Most importantly: sub-Makefiles should only ever modify files in
20 # their own directory. If in some directory we have a dependency on
21 # a file in another dir (which doesn't happen often, but it's of
22 # unavoidable when linking the built-in.o targets which finally
23 # turn into vmlinux), we will call a sub make in that other dir, and
24 # after that we are sure that everything which is in that other dir
25 # is now up to date.
26 #
27 # The only cases where we need to modify files which have global
28 # effects are thus separated out and done before the recursive
29 # descending is started. They are now explicitly listed as the
30 # prepare rule.
31
32 # To put more focus on warnings, be less verbose as default
33 # Use 'make V=1' to see the full commands
34
35 ifdef V
36   ifeq ("$(origin V)", "command line")
37     KBUILD_VERBOSE = $(V)
38   endif
39 endif
40 ifndef KBUILD_VERBOSE
41   KBUILD_VERBOSE = 0
42 endif
43
44 # Call sparse as part of compilation of C files
45 # Use 'make C=1' to enable sparse checking
46
47 ifdef C
48   ifeq ("$(origin C)", "command line")
49     KBUILD_CHECKSRC = $(C)
50   endif
51 endif
52 ifndef KBUILD_CHECKSRC
53   KBUILD_CHECKSRC = 0
54 endif
55
56 # Use make M=dir to specify direcotry of external module to build
57 # Old syntax make ... SUBDIRS=$PWD is still supported
58 # Setting the environment variable KBUILD_EXTMOD take precedence
59 ifdef SUBDIRS
60   KBUILD_EXTMOD ?= $(SUBDIRS)
61 endif
62 ifdef M
63   ifeq ("$(origin M)", "command line")
64     KBUILD_EXTMOD := $(M)
65   endif
66 endif
67
68
69 # kbuild supports saving output files in a separate directory.
70 # To locate output files in a separate directory two syntax'es are supported.
71 # In both cases the working directory must be the root of the kernel src.
72 # 1) O=
73 # Use "make O=dir/to/store/output/files/"
74
75 # 2) Set KBUILD_OUTPUT
76 # Set the environment variable KBUILD_OUTPUT to point to the directory
77 # where the output files shall be placed.
78 # export KBUILD_OUTPUT=dir/to/store/output/files/
79 # make
80 #
81 # The O= assigment takes precedence over the KBUILD_OUTPUT environment variable.
82
83
84 # KBUILD_SRC is set on invocation of make in OBJ directory
85 # KBUILD_SRC is not intended to be used by the regular user (for now)
86 ifeq ($(KBUILD_SRC),)
87
88 # OK, Make called in directory where kernel src resides
89 # Do we want to locate output files in a separate directory?
90 ifdef O
91   ifeq ("$(origin O)", "command line")
92     KBUILD_OUTPUT := $(O)
93   endif
94 endif
95
96 # That's our default target when none is given on the command line
97 .PHONY: _all
98 _all:
99
100 ifneq ($(KBUILD_OUTPUT),)
101 # Invoke a second make in the output directory, passing relevant variables
102 # check that the output directory actually exists
103 saved-output := $(KBUILD_OUTPUT)
104 KBUILD_OUTPUT := $(shell cd $(KBUILD_OUTPUT) && /bin/pwd)
105 $(if $(wildcard $(KBUILD_OUTPUT)),, \
106      $(error output directory "$(saved-output)" does not exist))
107
108 .PHONY: $(MAKECMDGOALS)
109
110 $(filter-out _all,$(MAKECMDGOALS)) _all:
111         $(if $(KBUILD_VERBOSE:1=),@)$(MAKE) -C $(KBUILD_OUTPUT)         \
112         KBUILD_SRC=$(CURDIR)         KBUILD_VERBOSE=$(KBUILD_VERBOSE)   \
113         KBUILD_CHECK=$(KBUILD_CHECK) KBUILD_EXTMOD="$(KBUILD_EXTMOD)"   \
114         -f $(CURDIR)/Makefile $@
115
116 # Leave processing to above invocation of make
117 skip-makefile := 1
118 endif # ifneq ($(KBUILD_OUTPUT),)
119 endif # ifeq ($(KBUILD_SRC),)
120
121 # We process the rest of the Makefile if this is the final invocation of make
122 ifeq ($(skip-makefile),)
123
124 # If building an external module we do not care about the all: rule
125 # but instead _all depend on modules
126 .PHONY: all
127 ifeq ($(KBUILD_EXTMOD),)
128 _all: all
129 else
130 _all: modules
131 endif
132
133 # Make sure we're not wasting cpu-cycles doing locale handling, yet do make
134 # sure error messages appear in the user-desired language
135 ifdef LC_ALL
136 LANG := $(LC_ALL)
137 LC_ALL :=
138 endif
139 LC_COLLATE := C
140 LC_CTYPE := C
141 export LANG LC_ALL LC_COLLATE LC_CTYPE
142
143 srctree         := $(if $(KBUILD_SRC),$(KBUILD_SRC),$(CURDIR))
144 TOPDIR          := $(srctree)
145 # FIXME - TOPDIR is obsolete, use srctree/objtree
146 objtree         := $(CURDIR)
147 src             := $(srctree)
148 obj             := $(objtree)
149
150 VPATH           := $(srctree)
151
152 export srctree objtree VPATH TOPDIR
153
154 KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
155
156 # SUBARCH tells the usermode build what the underlying arch is.  That is set
157 # first, and if a usermode build is happening, the "ARCH=um" on the command
158 # line overrides the setting of ARCH below.  If a native build is happening,
159 # then ARCH is assigned, getting whatever value it gets normally, and 
160 # SUBARCH is subsequently ignored.
161
162 SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
163                                   -e s/arm.*/arm/ -e s/sa110/arm/ \
164                                   -e s/s390x/s390/ -e s/parisc64/parisc/ )
165
166 # Cross compiling and selecting different set of gcc/bin-utils
167 # ---------------------------------------------------------------------------
168 #
169 # When performing cross compilation for other architectures ARCH shall be set
170 # to the target architecture. (See arch/* for the possibilities).
171 # ARCH can be set during invocation of make:
172 # make ARCH=ia64
173 # Another way is to have ARCH set in the environment.
174 # The default ARCH is the host where make is executed.
175
176 # CROSS_COMPILE specify the prefix used for all executables used
177 # during compilation. Only gcc and related bin-utils executables
178 # are prefixed with $(CROSS_COMPILE).
179 # CROSS_COMPILE can be set on the command line
180 # make CROSS_COMPILE=ia64-linux-
181 # Alternatively CROSS_COMPILE can be set in the environment.
182 # Default value for CROSS_COMPILE is not to prefix executables
183 # Note: Some architectures assign CROSS_COMPILE in their arch/*/Makefile
184
185 ARCH            ?= $(SUBARCH)
186 CROSS_COMPILE   ?=
187
188 # Architecture as present in compile.h
189 UTS_MACHINE := $(ARCH)
190
191 # SHELL used by kbuild
192 CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
193           else if [ -x /bin/bash ]; then echo /bin/bash; \
194           else echo sh; fi ; fi)
195
196 HOSTCC          = gcc
197 HOSTCXX         = g++
198 HOSTCFLAGS      = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
199 HOSTCXXFLAGS    = -O2
200
201 #       Decide whether to build built-in, modular, or both.
202 #       Normally, just do built-in.
203
204 KBUILD_MODULES :=
205 KBUILD_BUILTIN := 1
206
207 #       If we have only "make modules", don't compile built-in objects.
208 #       When we're building modules with modversions, we need to consider
209 #       the built-in objects during the descend as well, in order to
210 #       make sure the checksums are uptodate before we record them.
211
212 ifeq ($(MAKECMDGOALS),modules)
213   KBUILD_BUILTIN := $(if $(CONFIG_MODVERSIONS),1)
214 endif
215
216 #       If we have "make <whatever> modules", compile modules
217 #       in addition to whatever we do anyway.
218 #       Just "make" or "make all" shall build modules as well
219
220 ifneq ($(filter all _all modules,$(MAKECMDGOALS)),)
221   KBUILD_MODULES := 1
222 endif
223
224 ifeq ($(MAKECMDGOALS),)
225   KBUILD_MODULES := 1
226 endif
227
228 export KBUILD_MODULES KBUILD_BUILTIN KBUILD_VERBOSE
229 export KBUILD_CHECKSRC KBUILD_SRC KBUILD_EXTMOD
230
231 # Beautify output
232 # ---------------------------------------------------------------------------
233 #
234 # Normally, we echo the whole command before executing it. By making
235 # that echo $($(quiet)$(cmd)), we now have the possibility to set
236 # $(quiet) to choose other forms of output instead, e.g.
237 #
238 #         quiet_cmd_cc_o_c = Compiling $(RELDIR)/$@
239 #         cmd_cc_o_c       = $(CC) $(c_flags) -c -o $@ $<
240 #
241 # If $(quiet) is empty, the whole command will be printed.
242 # If it is set to "quiet_", only the short version will be printed. 
243 # If it is set to "silent_", nothing wil be printed at all, since
244 # the variable $(silent_cmd_cc_o_c) doesn't exist.
245 #
246 # A simple variant is to prefix commands with $(Q) - that's usefull
247 # for commands that shall be hidden in non-verbose mode.
248 #
249 #       $(Q)ln $@ :<
250 #
251 # If KBUILD_VERBOSE equals 0 then the above command will be hidden.
252 # If KBUILD_VERBOSE equals 1 then the above command is displayed.
253
254 ifeq ($(KBUILD_VERBOSE),1)
255   quiet =
256   Q =
257 else
258   quiet=quiet_
259   Q = @
260 endif
261
262 # If the user is running make -s (silent mode), suppress echoing of
263 # commands
264
265 ifneq ($(findstring s,$(MAKEFLAGS)),)
266   quiet=silent_
267 endif
268
269 check_gcc = $(shell if $(CC) $(CFLAGS) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;)
270
271 export quiet Q KBUILD_VERBOSE check_gcc
272
273 # Look for make include files relative to root of kernel src
274 MAKEFLAGS += --include-dir=$(srctree)
275
276 # For maximum performance (+ possibly random breakage, uncomment
277 # the following)
278
279 #MAKEFLAGS += -rR
280
281 # Make variables (CC, etc...)
282
283 AS              = $(CROSS_COMPILE)as
284 LD              = $(CROSS_COMPILE)ld
285 CC              = $(CROSS_COMPILE)gcc
286 CPP             = $(CC) -E
287 AR              = $(CROSS_COMPILE)ar
288 NM              = $(CROSS_COMPILE)nm
289 STRIP           = $(CROSS_COMPILE)strip
290 OBJCOPY         = $(CROSS_COMPILE)objcopy
291 OBJDUMP         = $(CROSS_COMPILE)objdump
292 AWK             = awk
293 GENKSYMS        = scripts/genksyms/genksyms
294 DEPMOD          = /sbin/depmod
295 KALLSYMS        = scripts/kallsyms
296 PERL            = perl
297 CHECK           = sparse
298 MODFLAGS        = -DMODULE
299 CFLAGS_MODULE   = $(MODFLAGS)
300 AFLAGS_MODULE   = $(MODFLAGS)
301 LDFLAGS_MODULE  = -r
302 CFLAGS_KERNEL   =
303 AFLAGS_KERNEL   =
304
305 NOSTDINC_FLAGS  = -nostdinc -iwithprefix include
306
307 CPPFLAGS        := -D__KERNEL__ -Iinclude \
308                    $(if $(KBUILD_SRC),-Iinclude2 -I$(srctree)/include)
309
310 CFLAGS          := -Wall -Wstrict-prototypes -Wno-trigraphs \
311                    -fno-strict-aliasing -fno-common
312 AFLAGS          := -D__ASSEMBLY__
313
314 export  VERSION PATCHLEVEL SUBLEVEL EXTRAVERSION KERNELRELEASE ARCH \
315         CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC \
316         CPP AR NM STRIP OBJCOPY OBJDUMP MAKE AWK GENKSYMS PERL UTS_MACHINE \
317         HOSTCXX HOSTCXXFLAGS LDFLAGS_BLOB LDFLAGS_MODULE CHECK
318
319 export CPPFLAGS NOSTDINC_FLAGS OBJCOPYFLAGS LDFLAGS
320 export CFLAGS CFLAGS_KERNEL CFLAGS_MODULE 
321 export AFLAGS AFLAGS_KERNEL AFLAGS_MODULE
322
323 # When compiling out-of-tree modules, put MODVERDIR in the module
324 # tree rather than in the kernel tree. The kernel tree might
325 # even be read-only.
326 export MODVERDIR := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/).tmp_versions
327
328 # The temporary file to save gcc -MD generated dependencies must not
329 # contain a comma
330 comma := ,
331 depfile = $(subst $(comma),_,$(@D)/.$(@F).d)
332
333 # Files to ignore in find ... statements
334
335 RCS_FIND_IGNORE := \( -name SCCS -o -name BitKeeper -o -name .svn -o -name CVS -o -name .pc \) -prune -o
336 RCS_TAR_IGNORE := --exclude SCCS --exclude BitKeeper --exclude .svn --exclude CVS --exclude .pc
337
338 # ===========================================================================
339 # Rules shared between *config targets and build targets
340
341 # Basic helpers built in scripts/
342 .PHONY: scripts_basic
343 scripts_basic:
344         $(Q)$(MAKE) $(build)=scripts/basic
345
346 # To make sure we do not include .config for any of the *config targets
347 # catch them early, and hand them over to scripts/kconfig/Makefile
348 # It is allowed to specify more targets when calling make, including
349 # mixing *config targets and build targets.
350 # For example 'make oldconfig all'. 
351 # Detect when mixed targets is specified, and make a second invocation
352 # of make so .config is not included in this case either (for *config).
353
354 no-dot-config-targets := clean mrproper distclean \
355                          cscope TAGS tags help %docs check%
356
357 config-targets := 0
358 mixed-targets  := 0
359 dot-config     := 1
360
361 ifneq ($(filter $(no-dot-config-targets), $(MAKECMDGOALS)),)
362         ifeq ($(filter-out $(no-dot-config-targets), $(MAKECMDGOALS)),)
363                 dot-config := 0
364         endif
365 endif
366
367 ifeq ($(KBUILD_EXTMOD),)
368         ifneq ($(filter config %config,$(MAKECMDGOALS)),)
369                 config-targets := 1
370                 ifneq ($(filter-out config %config,$(MAKECMDGOALS)),)
371                         mixed-targets := 1
372                 endif
373         endif
374 endif
375
376 ifeq ($(mixed-targets),1)
377 # ===========================================================================
378 # We're called with mixed targets (*config and build targets).
379 # Handle them one by one.
380
381 %:: FORCE
382         $(Q)$(MAKE) -C $(srctree) KBUILD_SRC= $@
383
384 else
385 ifeq ($(config-targets),1)
386 # ===========================================================================
387 # *config targets only - make sure prerequisites are updated, and descend
388 # in scripts/kconfig to make the *config target
389
390 config: scripts_basic FORCE
391         $(Q)$(MAKE) $(build)=scripts/kconfig $@
392 %config: scripts_basic FORCE
393         $(Q)$(MAKE) $(build)=scripts/kconfig $@
394
395 else
396 # ===========================================================================
397 # Build targets only - this includes vmlinux, arch specific targets, clean
398 # targets and others. In general all targets except *config targets.
399
400 ifeq ($(KBUILD_EXTMOD),)
401 # Additional helpers built in scripts/
402 # Carefully list dependencies so we do not try to build scripts twice
403 # in parrallel
404 .PHONY: scripts
405 scripts: scripts_basic include/config/MARKER
406         $(Q)$(MAKE) $(build)=$(@)
407
408 scripts_basic: include/linux/autoconf.h
409
410 # Objects we will link into vmlinux / subdirs we need to visit
411 init-y          := init/
412 drivers-y       := drivers/ sound/
413 net-y           := net/
414 libs-y          := lib/
415 core-y          := usr/
416 endif # KBUILD_EXTMOD
417
418 ifeq ($(dot-config),1)
419 # In this section, we need .config
420
421 # Read in dependencies to all Kconfig* files, make sure to run
422 # oldconfig if changes are detected.
423 -include .config.cmd
424
425 include .config
426
427 # If .config needs to be updated, it will be done via the dependency
428 # that autoconf has on .config.
429 # To avoid any implicit rule to kick in, define an empty command
430 .config: ;
431
432 # If .config is newer than include/linux/autoconf.h, someone tinkered
433 # with it and forgot to run make oldconfig
434 include/linux/autoconf.h: .config
435         $(Q)$(MAKE) -f $(srctree)/Makefile silentoldconfig
436 else
437 # Dummy target needed, because used as prerequisite
438 include/linux/autoconf.h: ;
439 endif
440
441 include $(srctree)/arch/$(ARCH)/Makefile
442
443 # Default kernel image to build when no specific target is given.
444 # KBUILD_IMAGE may be overruled on the commandline or
445 # set in the environment
446 # Also any assingments in arch/$(ARCH)/Makefiel take precedence over
447 # this default value
448 export KBUILD_IMAGE ?= vmlinux
449
450 # The all: target is the default when no target is given on the
451 # command line.
452 # This allow a user to issue only 'make' to build a kernel including modules
453 # Defaults vmlinux but it is usually overriden in the arch makefile
454 all: vmlinux
455
456 ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
457 CFLAGS          += -Os
458 else
459 CFLAGS          += -O2
460 endif
461
462 ifndef CONFIG_FRAME_POINTER
463 CFLAGS          += -fomit-frame-pointer
464 endif
465
466 ifdef CONFIG_DEBUG_INFO
467 CFLAGS          += -g
468 endif
469
470 # warn about C99 declaration after statement
471 CFLAGS += $(call check_gcc,-Wdeclaration-after-statement,)
472
473 #
474 # INSTALL_PATH specifies where to place the updated kernel and system map
475 # images.  Uncomment if you want to place them anywhere other than root.
476 #
477
478 #export INSTALL_PATH=/boot
479
480 #
481 # INSTALL_MOD_PATH specifies a prefix to MODLIB for module directory
482 # relocations required by build roots.  This is not defined in the
483 # makefile but the arguement can be passed to make if needed.
484 #
485
486 MODLIB  := $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE)
487 export MODLIB
488
489
490 ifeq ($(KBUILD_EXTMOD),)
491 core-y          += kernel/ mm/ fs/ ipc/ security/ crypto/
492
493 vmlinux-dirs    := $(patsubst %/,%,$(filter %/, $(init-y) $(init-m) \
494                      $(core-y) $(core-m) $(drivers-y) $(drivers-m) \
495                      $(net-y) $(net-m) $(libs-y) $(libs-m)))
496
497 vmlinux-alldirs := $(sort $(vmlinux-dirs) $(patsubst %/,%,$(filter %/, \
498                      $(init-n) $(init-) \
499                      $(core-n) $(core-) $(drivers-n) $(drivers-) \
500                      $(net-n)  $(net-)  $(libs-n)    $(libs-))))
501
502 init-y          := $(patsubst %/, %/built-in.o, $(init-y))
503 core-y          := $(patsubst %/, %/built-in.o, $(core-y))
504 drivers-y       := $(patsubst %/, %/built-in.o, $(drivers-y))
505 net-y           := $(patsubst %/, %/built-in.o, $(net-y))
506 libs-y1         := $(patsubst %/, %/lib.a, $(libs-y))
507 libs-y2         := $(patsubst %/, %/built-in.o, $(libs-y))
508 libs-y          := $(libs-y1) $(libs-y2)
509
510 # Build vmlinux
511 # ---------------------------------------------------------------------------
512
513 #       This is a bit tricky: If we need to relink vmlinux, we want
514 #       the version number incremented, which means recompile init/version.o
515 #       and relink init/init.o. However, we cannot do this during the
516 #       normal descending-into-subdirs phase, since at that time
517 #       we cannot yet know if we will need to relink vmlinux.
518 #       So we descend into init/ inside the rule for vmlinux again.
519 head-y += $(HEAD)
520 vmlinux-objs := $(head-y) $(init-y) $(core-y) $(libs-y) $(drivers-y) $(net-y)
521
522 quiet_cmd_vmlinux__ = LD      $@
523 define cmd_vmlinux__
524         $(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) $(head-y) $(init-y) \
525         --start-group \
526         $(core-y) \
527         $(libs-y) \
528         $(drivers-y) \
529         $(net-y) \
530         --end-group \
531         $(filter .tmp_kallsyms%,$^) \
532         -o $@
533 endef
534
535 #       set -e makes the rule exit immediately on error
536
537 define rule_vmlinux__
538         +set -e;                                                        \
539         $(if $(filter .tmp_kallsyms%,$^),,                              \
540           echo '  GEN     .version';                                    \
541           . $(srctree)/scripts/mkversion > .tmp_version;                \
542           mv -f .tmp_version .version;                                  \
543           $(MAKE) $(build)=init;                                        \
544         )                                                               \
545         $(if $($(quiet)cmd_vmlinux__),                                  \
546           echo '  $($(quiet)cmd_vmlinux__)' &&)                         \
547         $(cmd_vmlinux__);                                               \
548         echo 'cmd_$@ := $(cmd_vmlinux__)' > $(@D)/.$(@F).cmd
549 endef
550
551 do_system_map = $(NM) $(1) | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | sort > $(2)
552
553 LDFLAGS_vmlinux += -T arch/$(ARCH)/kernel/vmlinux.lds.s
554
555 #       Generate section listing all symbols and add it into vmlinux
556 #       It's a three stage process:
557 #       o .tmp_vmlinux1 has all symbols and sections, but __kallsyms is
558 #         empty
559 #         Running kallsyms on that gives us .tmp_kallsyms1.o with
560 #         the right size
561 #       o .tmp_vmlinux2 now has a __kallsyms section of the right size,
562 #         but due to the added section, some addresses have shifted
563 #         From here, we generate a correct .tmp_kallsyms2.o
564 #       o The correct .tmp_kallsyms2.o is linked into the final vmlinux.
565 #       o Verify that the System.map from vmlinux matches the map from
566 #         .tmp_vmlinux2, just in case we did not generate kallsyms correctly.
567 #       o If CONFIG_KALLSYMS_EXTRA_PASS is set, do an extra pass using
568 #         .tmp_vmlinux3 and .tmp_kallsyms3.o.  This is only meant as a
569 #         temporary bypass to allow the kernel to be built while the
570 #         maintainers work out what went wrong with kallsyms.
571
572 ifdef CONFIG_KALLSYMS
573
574 ifdef CONFIG_KALLSYMS_EXTRA_PASS
575 last_kallsyms := 3
576 else
577 last_kallsyms := 2
578 endif
579
580 kallsyms.o := .tmp_kallsyms$(last_kallsyms).o
581
582 define rule_verify_kallsyms
583         @$(call do_system_map, .tmp_vmlinux$(last_kallsyms), .tmp_System.map)
584         @cmp -s System.map .tmp_System.map || \
585                 (echo Inconsistent kallsyms data, try setting CONFIG_KALLSYMS_EXTRA_PASS ; rm .tmp_kallsyms* ; false)
586 endef
587
588 quiet_cmd_kallsyms = KSYM    $@
589 cmd_kallsyms = $(NM) -n $< | $(KALLSYMS) $(foreach x,$(CONFIG_KALLSYMS_ALL),--all-symbols) > $@
590
591 .tmp_kallsyms1.o .tmp_kallsyms2.o .tmp_kallsyms3.o: %.o: %.S scripts FORCE
592         $(call if_changed_dep,as_o_S)
593
594 .tmp_kallsyms%.S: .tmp_vmlinux%
595         $(call cmd,kallsyms)
596
597 .tmp_vmlinux1: $(vmlinux-objs) arch/$(ARCH)/kernel/vmlinux.lds.s FORCE
598         $(call if_changed_rule,vmlinux__)
599
600 .tmp_vmlinux2: $(vmlinux-objs) .tmp_kallsyms1.o arch/$(ARCH)/kernel/vmlinux.lds.s FORCE
601         $(call if_changed_rule,vmlinux__)
602
603 .tmp_vmlinux3: $(vmlinux-objs) .tmp_kallsyms2.o arch/$(ARCH)/kernel/vmlinux.lds.s FORCE
604         $(call if_changed_rule,vmlinux__)
605
606 endif
607
608 #       Finally the vmlinux rule
609
610 define rule_vmlinux
611         $(rule_vmlinux__); \
612         $(call do_system_map, $@, System.map)
613         $(rule_verify_kallsyms)
614 endef
615
616 vmlinux: $(vmlinux-objs) $(kallsyms.o) arch/$(ARCH)/kernel/vmlinux.lds.s FORCE
617         $(call if_changed_rule,vmlinux)
618
619 #       The actual objects are generated when descending, 
620 #       make sure no implicit rule kicks in
621
622 $(sort $(vmlinux-objs)) arch/$(ARCH)/kernel/vmlinux.lds.s: $(vmlinux-dirs) ;
623
624 #       Handle descending into subdirectories listed in $(vmlinux-dirs)
625
626 .PHONY: $(vmlinux-dirs)
627 $(vmlinux-dirs): prepare-all scripts
628         $(Q)$(MAKE) $(build)=$@
629
630 # Things we need to do before we recursively start building the kernel
631 # or the modules are listed in "prepare-all".
632 # A multi level approach is used. prepare1 is updated first, then prepare0.
633 # prepare-all is the collection point for the prepare targets.
634
635 .PHONY: prepare-all prepare prepare0 prepare1
636
637 # prepare1 is used to check if we are building in a separate output directory,
638 # and if so do:
639 # 1) Check that make has not been executed in the kernel src $(srctree)
640 # 2) Create the include2 directory, used for the second asm symlink
641
642 prepare1:
643 ifneq ($(KBUILD_SRC),)
644         @echo '  Using $(srctree) as source for kernel'
645         $(Q)if [ -h $(srctree)/include/asm -o -f $(srctree)/.config ]; then \
646                 echo "  $(srctree) is not clean, please run 'make mrproper'";\
647                 echo "  in the '$(srctree)' directory.";\
648                 /bin/false; \
649         fi;
650         $(Q)if [ ! -d include2 ]; then mkdir -p include2; fi;
651         $(Q)ln -fsn $(srctree)/include/asm-$(ARCH) include2/asm
652 endif
653
654 prepare0: prepare1 include/linux/version.h include/asm include/config/MARKER
655 ifneq ($(KBUILD_MODULES),)
656         $(Q)rm -rf $(MODVERDIR)
657         $(Q)mkdir -p $(MODVERDIR)
658 endif
659
660 # All the preparing..
661 prepare-all: prepare0 prepare
662
663 #       Leave this as default for preprocessing vmlinux.lds.S, which is now
664 #       done in arch/$(ARCH)/kernel/Makefile
665
666 export AFLAGS_vmlinux.lds.o += -P -C -U$(ARCH)
667
668 # Single targets
669 # ---------------------------------------------------------------------------
670
671 %.s: %.c scripts FORCE
672         $(Q)$(MAKE) $(build)=$(@D) $@
673 %.i: %.c scripts FORCE
674         $(Q)$(MAKE) $(build)=$(@D) $@
675 %.o: %.c scripts FORCE
676         $(Q)$(MAKE) $(build)=$(@D) $@
677 %/:      scripts prepare FORCE
678         $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) $(build)=$(@D)
679 %.lst: %.c scripts FORCE
680         $(Q)$(MAKE) $(build)=$(@D) $@
681 %.s: %.S scripts FORCE
682         $(Q)$(MAKE) $(build)=$(@D) $@
683 %.o: %.S scripts FORCE
684         $(Q)$(MAKE) $(build)=$(@D) $@
685
686 #       FIXME: The asm symlink changes when $(ARCH) changes. That's
687 #       hard to detect, but I suppose "make mrproper" is a good idea
688 #       before switching between archs anyway.
689
690 include/asm:
691         @echo '  SYMLINK $@ -> include/asm-$(ARCH)'
692         $(Q)if [ ! -d include ]; then mkdir -p include; fi;
693         @ln -fsn asm-$(ARCH) $@
694
695 #       Split autoconf.h into include/linux/config/*
696
697 include/config/MARKER: include/linux/autoconf.h
698         @echo '  SPLIT   include/linux/autoconf.h -> include/config/*'
699         @scripts/basic/split-include include/linux/autoconf.h include/config
700         @touch $@
701
702 # Generate some files
703 # ---------------------------------------------------------------------------
704
705 #       version.h changes when $(KERNELRELEASE) etc change, as defined in
706 #       this Makefile
707
708 uts_len := 64
709
710 define filechk_version.h
711         if [ `echo -n "$(KERNELRELEASE)" | wc -c ` -gt $(uts_len) ]; then \
712           echo '"$(KERNELRELEASE)" exceeds $(uts_len) characters' >&2; \
713           exit 1; \
714         fi; \
715         (echo \#define UTS_RELEASE \"$(KERNELRELEASE)\"; \
716           echo \#define LINUX_VERSION_CODE `expr $(VERSION) \\* 65536 + $(PATCHLEVEL) \\* 256 + $(SUBLEVEL)`; \
717          echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))'; \
718         )
719 endef
720
721 include/linux/version.h: Makefile
722         $(call filechk,version.h)
723
724 # ---------------------------------------------------------------------------
725
726 .PHONY: depend dep
727 depend dep:
728         @echo '*** Warning: make $@ is unnecessary now.'
729
730 # ---------------------------------------------------------------------------
731 # Modules
732
733 ifdef CONFIG_MODULES
734
735 #       By default, build modules as well
736
737 all: modules
738
739 #       Build modules
740
741 .PHONY: modules
742 modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux)
743         @echo '  Building modules, stage 2.';
744         $(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modpost
745
746
747 # Target to prepare building external modules
748 .PHONY: modules_prepare
749 modules_prepare: prepare-all scripts
750
751 # Target to install modules
752 .PHONY: modules_install
753 modules_install: _modinst_ _modinst_post
754
755 .PHONY: _modinst_
756 _modinst_:
757         @if [ -z "`$(DEPMOD) -V | grep module-init-tools`" ]; then \
758                 echo "Warning: you may need to install module-init-tools"; \
759                 echo "See http://www.codemonkey.org.uk/docs/post-halloween-2.6.txt";\
760                 sleep 1; \
761         fi
762         @rm -rf $(MODLIB)/kernel
763         @rm -f $(MODLIB)/build
764         @mkdir -p $(MODLIB)/kernel
765         @ln -s $(TOPDIR) $(MODLIB)/build
766         $(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modinst
767
768 # If System.map exists, run depmod.  This deliberately does not have a
769 # dependency on System.map since that would run the dependency tree on
770 # vmlinux.  This depmod is only for convenience to give the initial
771 # boot a modules.dep even before / is mounted read-write.  However the
772 # boot script depmod is the master version.
773 ifeq "$(strip $(INSTALL_MOD_PATH))" ""
774 depmod_opts     :=
775 else
776 depmod_opts     := -b $(INSTALL_MOD_PATH) -r
777 endif
778 .PHONY: _modinst_post
779 _modinst_post: _modinst_
780         if [ -r System.map ]; then $(DEPMOD) -ae -F System.map $(depmod_opts) $(KERNELRELEASE); fi
781
782 else # CONFIG_MODULES
783
784 # Modules not configured
785 # ---------------------------------------------------------------------------
786
787 modules modules_install: FORCE
788         @echo
789         @echo "The present kernel configuration has modules disabled."
790         @echo "Type 'make config' and enable loadable module support."
791         @echo "Then build a kernel with module support enabled."
792         @echo
793         @exit 1
794
795 endif # CONFIG_MODULES
796
797 # Generate asm-offsets.h 
798 # ---------------------------------------------------------------------------
799
800 define filechk_gen-asm-offsets
801         (set -e; \
802          echo "#ifndef __ASM_OFFSETS_H__"; \
803          echo "#define __ASM_OFFSETS_H__"; \
804          echo "/*"; \
805          echo " * DO NOT MODIFY."; \
806          echo " *"; \
807          echo " * This file was generated by arch/$(ARCH)/Makefile"; \
808          echo " *"; \
809          echo " */"; \
810          echo ""; \
811          sed -ne "/^->/{s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}"; \
812          echo ""; \
813          echo "#endif" )
814 endef
815
816
817 ###
818 # Cleaning is done on three levels.
819 # make clean     Delete most generated files
820 #                Leave enough to build external modules
821 # make mrproper  Delete the current configuration, and all generated files
822 # make distclean Remove editor backup files, patch leftover files and the like
823
824 # Directories & files removed with 'make clean'
825 CLEAN_DIRS  += $(MODVERDIR)
826 CLEAN_FILES +=  vmlinux System.map \
827                 .tmp_kallsyms* .tmp_version .tmp_vmlinux* .tmp_System.map
828
829 # Directories & files removed with 'make mrproper'
830 MRPROPER_DIRS  += include/config include2
831 MRPROPER_FILES += .config .config.old include/asm .version \
832                   include/linux/autoconf.h include/linux/version.h \
833                   Module.symvers tags TAGS cscope*
834
835 # clean - Delete most, but leave enough to build external modules
836 #
837 clean: rm-dirs  := $(CLEAN_DIRS)
838 clean: rm-files := $(CLEAN_FILES)
839 clean-dirs      := $(addprefix _clean_,$(vmlinux-alldirs))
840
841 .PHONY: $(clean-dirs) clean archclean
842 $(clean-dirs):
843         $(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@)
844
845 clean: archclean $(clean-dirs)
846         $(call cmd,rmdirs)
847         $(call cmd,rmfiles)
848         @find . $(RCS_FIND_IGNORE) \
849                 \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \
850                 -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \) \
851                 -type f -print | xargs rm -f
852
853 # mrproper - Delete all generated files, including .config
854 #
855 mrproper: rm-dirs  := $(wildcard $(MRPROPER_DIRS))
856 mrproper: rm-files := $(wildcard $(MRPROPER_FILES))
857 mrproper-dirs      := $(addprefix _mrproper_,Documentation/DocBook scripts)
858
859 .PHONY: $(mrproper-dirs) mrproper archmrproper
860 $(mrproper-dirs):
861         $(Q)$(MAKE) $(clean)=$(patsubst _mrproper_%,%,$@)
862
863 mrproper: clean archmrproper $(mrproper-dirs)
864         $(call cmd,rmdirs)
865         $(call cmd,rmfiles)
866
867 # distclean
868 #
869 .PHONY: distclean
870
871 distclean: mrproper
872         @find $(srctree) $(RCS_FIND_IGNORE) \
873                 \( -name '*.orig' -o -name '*.rej' -o -name '*~' \
874                 -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
875                 -o -name '.*.rej' -o -size 0 \
876                 -o -name '*%' -o -name '.*.cmd' -o -name 'core' \) \
877                 -type f -print | xargs rm -f
878
879
880 # Packaging of the kernel to various formats
881 # ---------------------------------------------------------------------------
882 # rpm target kept for backward compatibility
883 package-dir     := $(srctree)/scripts/package
884
885 .PHONY: %-pkg rpm
886
887 %pkg: FORCE
888         $(Q)$(MAKE) -f $(package-dir)/Makefile $@
889 rpm: FORCE
890         $(Q)$(MAKE) -f $(package-dir)/Makefile $@
891
892
893 # Brief documentation of the typical targets used
894 # ---------------------------------------------------------------------------
895
896 boards := $(wildcard $(srctree)/arch/$(ARCH)/configs/*_defconfig)
897 boards := $(notdir $(boards))
898
899 help:
900         @echo  'Cleaning targets:'
901         @echo  '  clean           - remove most generated files but keep the config'
902         @echo  '  mrproper        - remove all generated files + config + various backup files'
903         @echo  ''
904         @echo  'Configuration targets:'
905         @$(MAKE) -f $(srctree)/scripts/kconfig/Makefile help
906         @echo  ''
907         @echo  'Other generic targets:'
908         @echo  '  all             - Build all targets marked with [*]'
909         @echo  '* vmlinux         - Build the bare kernel'
910         @echo  '* modules         - Build all modules'
911         @echo  '  modules_install - Install all modules'
912         @echo  '  dir/            - Build all files in dir and below'
913         @echo  '  dir/file.[ois]  - Build specified target only'
914         @echo  '  rpm             - Build a kernel as an RPM package'
915         @echo  '  tags/TAGS       - Generate tags file for editors'
916         @echo  '  cscope          - Generate cscope index'
917         @echo  '  checkstack      - Generate a list of stack hogs'
918         @echo  'Kernel packaging:'
919         @$(MAKE) -f $(package-dir)/Makefile help
920         @echo  ''
921         @echo  'Documentation targets:'
922         @$(MAKE) -f $(srctree)/Documentation/DocBook/Makefile dochelp
923         @echo  ''
924         @echo  'Architecture specific targets ($(ARCH)):'
925         @$(if $(archhelp),$(archhelp),\
926                 echo '  No architecture specific help defined for $(ARCH)')
927         @echo  ''
928         @$(if $(boards), \
929                 $(foreach b, $(boards), \
930                 printf "  %-24s - Build for %s\\n" $(b) $(subst _defconfig,,$(b));) \
931                 echo '')
932
933         @echo  '  make V=0|1 [targets] 0 => quiet build (default), 1 => verbose build'
934         @echo  '  make O=dir [targets] Locate all output files in "dir", including .config'
935         @echo  '  make C=1   [targets] Check all c source with checker tool'
936         @echo  ''
937         @echo  'Execute "make" or "make all" to build all targets marked with [*] '
938         @echo  'For further info see the ./README file'
939
940
941 # Documentation targets
942 # ---------------------------------------------------------------------------
943 %docs: scripts_basic FORCE
944         $(Q)$(MAKE) $(build)=Documentation/DocBook $@
945
946 else # KBUILD_EXTMOD
947
948 ###
949 # External module support.
950 # When building external modules the kernel used as basis is considered
951 # read-only, and no consistency checks are made and the make
952 # system is not used on the basis kernel. If updates are required
953 # in the basis kernel ordinary make commands (without M=...) must
954 # be used.
955 #
956 # The following are the only valid targets when building external
957 # modules.
958 # make M=dir clean     Delete all automatically generated files
959 # make M=dir modules   Make all modules in specified dir
960 # make M=dir           Same as 'make M=dir modules'
961 # make M=dir modules_install
962 #                      Install the modules build in the module directory
963 #                      Assumes install directory is already created
964
965 # We are always building modules
966 KBUILD_MODULES := 1
967 .PHONY: crmodverdir
968 crmodverdir:
969         $(Q)mkdir -p $(MODVERDIR)
970
971 module-dirs := $(addprefix _module_,$(KBUILD_EXTMOD))
972 .PHONY: $(module-dirs) modules
973 $(module-dirs): crmodverdir
974         $(Q)$(MAKE) $(build)=$(patsubst _module_%,%,$@)
975
976 modules: $(module-dirs)
977         @echo '  Building modules, stage 2.';
978         $(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modpost
979
980 .PHONY: modules_install
981 modules_install:
982         $(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modinst
983
984 clean-dirs := $(addprefix _clean_,$(KBUILD_EXTMOD))
985
986 .PHONY: $(clean-dirs) clean
987 $(clean-dirs):
988         $(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@)
989
990 clean:  rm-dirs := $(MODVERDIR)
991 clean: $(clean-dirs)
992         $(call cmd,rmdirs)
993         @find $(KBUILD_EXTMOD) $(RCS_FIND_IGNORE) \
994                 \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \
995                 -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \) \
996                 -type f -print | xargs rm -f
997
998 help:
999         @echo  '  Building external modules.'
1000         @echo  '  Syntax: make -C path/to/kernel/src M=$$PWD target'
1001         @echo  ''
1002         @echo  '  modules         - default target, build the module(s)'
1003         @echo  '  modules_install - install the module'
1004         @echo  '  clean           - remove generated files in module directory only'
1005         @echo  ''
1006 endif # KBUILD_EXTMOD
1007
1008 # Generate tags for editors
1009 # ---------------------------------------------------------------------------
1010
1011 define all-sources
1012         ( find . $(RCS_FIND_IGNORE) \
1013                \( -name include -o -name arch \) -prune -o \
1014                -name '*.[chS]' -print; \
1015           find arch/$(ARCH) $(RCS_FIND_IGNORE) \
1016                -name '*.[chS]' -print; \
1017           find security/selinux/include $(RCS_FIND_IGNORE) \
1018                -name '*.[chS]' -print; \
1019           find include $(RCS_FIND_IGNORE) \
1020                \( -name config -o -name 'asm-*' \) -prune \
1021                -o -name '*.[chS]' -print; \
1022           find include/asm-$(ARCH) $(RCS_FIND_IGNORE) \
1023                -name '*.[chS]' -print; \
1024           find include/asm-generic $(RCS_FIND_IGNORE) \
1025                -name '*.[chS]' -print )
1026 endef
1027
1028 quiet_cmd_cscope-file = FILELST cscope.files
1029       cmd_cscope-file = $(all-sources) > cscope.files
1030
1031 quiet_cmd_cscope = MAKE    cscope.out
1032       cmd_cscope = cscope -k -b -q
1033
1034 cscope: FORCE
1035         $(call cmd,cscope-file)
1036         $(call cmd,cscope)
1037
1038 quiet_cmd_TAGS = MAKE   $@
1039 cmd_TAGS = $(all-sources) | etags -
1040
1041 #       Exuberant ctags works better with -I
1042
1043 quiet_cmd_tags = MAKE   $@
1044 define cmd_tags
1045         rm -f $@; \
1046         CTAGSF=`ctags --version | grep -i exuberant >/dev/null && echo "-I __initdata,__exitdata,EXPORT_SYMBOL,EXPORT_SYMBOL_NOVERS"`; \
1047         $(all-sources) | xargs ctags $$CTAGSF -a
1048 endef
1049
1050 TAGS: FORCE
1051         $(call cmd,TAGS)
1052
1053 tags: FORCE
1054         $(call cmd,tags)
1055
1056
1057 # Scripts to check various things for consistency
1058 # ---------------------------------------------------------------------------
1059
1060 configcheck:
1061         find * $(RCS_FIND_IGNORE) \
1062                 -name '*.[hcS]' -type f -print | sort \
1063                 | xargs $(PERL) -w scripts/checkconfig.pl
1064
1065 includecheck:
1066         find * $(RCS_FIND_IGNORE) \
1067                 -name '*.[hcS]' -type f -print | sort \
1068                 | xargs $(PERL) -w scripts/checkincludes.pl
1069
1070 versioncheck:
1071         find * $(RCS_FIND_IGNORE) \
1072                 -name '*.[hcS]' -type f -print | sort \
1073                 | xargs $(PERL) -w scripts/checkversion.pl
1074
1075 buildcheck:
1076         $(PERL) scripts/reference_discarded.pl
1077         $(PERL) scripts/reference_init.pl
1078
1079 endif #ifeq ($(config-targets),1)
1080 endif #ifeq ($(mixed-targets),1)
1081
1082 .PHONY: checkstack
1083 checkstack:
1084         $(OBJDUMP) -d vmlinux $$(find . -name '*.ko') | \
1085         $(PERL) $(src)/scripts/checkstack.pl $(ARCH)
1086
1087 # FIXME Should go into a make.lib or something 
1088 # ===========================================================================
1089
1090 quiet_cmd_rmdirs = $(if $(wildcard $(rm-dirs)),CLEAN   $(wildcard $(rm-dirs)))
1091       cmd_rmdirs = rm -rf $(rm-dirs)
1092
1093 quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),CLEAN   $(wildcard $(rm-files)))
1094       cmd_rmfiles = rm -f $(rm-files)
1095
1096
1097 a_flags = -Wp,-MD,$(depfile) $(AFLAGS) $(AFLAGS_KERNEL) \
1098           $(NOSTDINC_FLAGS) $(CPPFLAGS) \
1099           $(modkern_aflags) $(EXTRA_AFLAGS) $(AFLAGS_$(*F).o)
1100
1101 quiet_cmd_as_o_S = AS      $@
1102 cmd_as_o_S       = $(CC) $(a_flags) -c -o $@ $<
1103
1104 # read all saved command lines
1105
1106 targets := $(wildcard $(sort $(targets)))
1107 cmd_files := $(wildcard .*.cmd $(foreach f,$(targets),$(dir $(f)).$(notdir $(f)).cmd))
1108
1109 ifneq ($(cmd_files),)
1110   $(cmd_files): ;       # Do not try to update included dependency files
1111   include $(cmd_files)
1112 endif
1113
1114 # execute the command and also postprocess generated .d dependencies
1115 # file
1116
1117 if_changed_dep = $(if $(strip $? $(filter-out FORCE $(wildcard $^),$^)\
1118                           $(filter-out $(cmd_$(1)),$(cmd_$@))\
1119                           $(filter-out $(cmd_$@),$(cmd_$(1)))),\
1120         @set -e; \
1121         $(if $($(quiet)cmd_$(1)),echo '  $(subst ','\'',$($(quiet)cmd_$(1)))';) \
1122         $(cmd_$(1)); \
1123         scripts/basic/fixdep $(depfile) $@ '$(subst $$,$$$$,$(subst ','\'',$(cmd_$(1))))' > $(@D)/.$(@F).tmp; \
1124         rm -f $(depfile); \
1125         mv -f $(@D)/.$(@F).tmp $(@D)/.$(@F).cmd)
1126
1127 # Usage: $(call if_changed_rule,foo)
1128 # will check if $(cmd_foo) changed, or any of the prequisites changed,
1129 # and if so will execute $(rule_foo)
1130
1131 if_changed_rule = $(if $(strip $? \
1132                                $(filter-out $(cmd_$(1)),$(cmd_$(@F)))\
1133                                $(filter-out $(cmd_$(@F)),$(cmd_$(1)))),\
1134                        @$(rule_$(1)))
1135
1136 # If quiet is set, only print short version of command
1137
1138 cmd = @$(if $($(quiet)cmd_$(1)),echo '  $($(quiet)cmd_$(1))' &&) $(cmd_$(1))
1139
1140 # filechk is used to check if the content of a generated file is updated.
1141 # Sample usage:
1142 # define filechk_sample
1143 #       echo $KERNELRELEASE
1144 # endef
1145 # version.h : Makefile
1146 #       $(call filechk,sample)
1147 # The rule defined shall write to stdout the content of the new file.
1148 # The existing file will be compared with the new one.
1149 # - If no file exist it is created
1150 # - If the content differ the new file is used
1151 # - If they are equal no change, and no timestamp update
1152
1153 define filechk
1154         @set -e;                                \
1155         echo '  CHK     $@';                    \
1156         mkdir -p $(dir $@);                     \
1157         $(filechk_$(1)) < $< > $@.tmp;          \
1158         if [ -r $@ ] && cmp -s $@ $@.tmp; then  \
1159                 rm -f $@.tmp;                   \
1160         else                                    \
1161                 echo '  UPD     $@';            \
1162                 mv -f $@.tmp $@;                \
1163         fi
1164 endef
1165
1166 # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.build obj=dir
1167 # Usage:
1168 # $(Q)$(MAKE) $(build)=dir
1169 build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj
1170
1171 # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.clean obj=dir
1172 # Usage:
1173 # $(Q)$(MAKE) $(clean)=dir
1174 clean := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.clean obj
1175
1176 #       $(call descend,<dir>,<target>)
1177 #       Recursively call a sub-make in <dir> with target <target>
1178 # Usage is deprecated, because make does not see this as an invocation of make.
1179 descend =$(Q)$(MAKE) -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj=$(1) $(2)
1180
1181 endif   # skip-makefile
1182
1183 FORCE: