7 # To see a list of typical targets execute "make help"
8 # More info can be located in ./Documentation/kbuild
9 # Comments in this file are targeted only to the developer, do not
10 # expect to learn how to build the kernel reading this file.
12 # We are using a recursive build, so we need to do a little thinking
13 # to get the ordering right.
15 # Most importantly: sub-Makefiles should only ever modify files in
16 # their own directory. If in some directory we have a dependency on
17 # a file in another dir (which doesn't happen often, but it's of
18 # unavoidable when linking the built-in.o targets which finally
19 # turn into vmlinux), we will call a sub make in that other dir, and
20 # after that we are sure that everything which is in that other dir
23 # The only cases where we need to modify files which have global
24 # effects are thus separated out and done before the recursive
25 # descending is started. They are now explicitly listed as the
28 KERNELRELEASE
=$(VERSION
).
$(PATCHLEVEL
).
$(SUBLEVEL
)$(EXTRAVERSION
)
30 # SUBARCH tells the usermode build what the underlying arch is. That is set
31 # first, and if a usermode build is happening, the "ARCH=um" on the command
32 # line overrides the setting of ARCH below. If a native build is happening,
33 # then ARCH is assigned, getting whatever value it gets normally, and
34 # SUBARCH is subsequently ignored.
36 SUBARCH
:= $(shell uname
-m | sed
-e s
/i
.86/i386
/ -e s
/sun4u
/sparc64
/ -e s
/arm.
*/arm
/ -e s
/sa110
/arm
/)
39 KERNELPATH
=kernel-
$(shell echo
$(KERNELRELEASE
) | sed
-e
"s/-//g")
41 UTS_MACHINE
:= $(ARCH
)
43 CONFIG_SHELL
:= $(shell if
[ -x
"$$BASH" ]; then echo
$$BASH; \
44 else if
[ -x
/bin
/bash
]; then echo
/bin
/bash
; \
45 else echo sh
; fi
; fi
)
50 HOSTCFLAGS
= -Wall
-Wstrict-prototypes
-O2
-fomit-frame-pointer
55 # That's our default target when none is given on the command line
59 # Decide whether to build built-in, modular, or both.
60 # Normally, just do built-in.
65 # If we have only "make modules", don't compile built-in objects.
67 ifeq ($(MAKECMDGOALS
),modules
)
71 # If we have "make <whatever> modules", compile modules
72 # in addition to whatever we do anyway.
74 ifneq ($(filter modules
,$(MAKECMDGOALS
)),)
78 # Just "make" or "make all" shall build modules as well
80 ifeq ($(MAKECMDGOALS
),)
84 ifneq ($(filter all,$(MAKECMDGOALS
)),)
88 export KBUILD_MODULES KBUILD_BUILTIN KBUILD_VERBOSE
91 # ---------------------------------------------------------------------------
93 # Normally, we echo the whole command before executing it. By making
94 # that echo $($(quiet)$(cmd)), we now have the possibility to set
95 # $(quiet) to choose other forms of output instead, e.g.
97 # quiet_cmd_cc_o_c = Compiling $(RELDIR)/$@
98 # cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $<
100 # If $(quiet) is empty, the whole command will be printed.
101 # If it is set to "quiet_", only the short version will be printed.
102 # If it is set to "silent_", nothing wil be printed at all, since
103 # the variable $(silent_cmd_cc_o_c) doesn't exist.
105 # For now, leave verbose as default
107 ifndef KBUILD_VERBOSE
111 MAKEFLAGS
+= --no-print-directory
113 # For maximum performance (+ possibly random breakage, uncomment
118 # If the user wants quiet mode, echo short versions of the commands
121 ifeq ($(KBUILD_VERBOSE
),1)
129 # If the user is running make -s (silent mode), suppress echoing of
132 ifneq ($(findstring s
,$(MAKEFLAGS
)),)
136 export quiet Q KBUILD_VERBOSE
138 # Paths to obj / src tree
145 export srctree objtree
147 # Make variables (CC, etc...)
149 AS
= $(CROSS_COMPILE
)as
150 LD
= $(CROSS_COMPILE
)ld
151 CC
= $(CROSS_COMPILE
)gcc
153 AR
= $(CROSS_COMPILE
)ar
154 NM
= $(CROSS_COMPILE
)nm
155 STRIP
= $(CROSS_COMPILE
)strip
156 OBJCOPY
= $(CROSS_COMPILE
)objcopy
157 OBJDUMP
= $(CROSS_COMPILE
)objdump
158 GENKSYMS
= /sbin
/genksyms
159 DEPMOD
= /sbin
/depmod
160 KALLSYMS
= /sbin
/kallsyms
163 CFLAGS_MODULE
= $(MODFLAGS
)
164 AFLAGS_MODULE
= $(MODFLAGS
)
167 NOSTDINC_FLAGS
= -nostdinc
-iwithprefix
include
169 CPPFLAGS
:= -D__KERNEL__
-Iinclude
170 CFLAGS
:= $(CPPFLAGS
) -Wall
-Wstrict-prototypes
-Wno-trigraphs
-O2 \
171 -fomit-frame-pointer
-fno-strict-aliasing
-fno-common
172 AFLAGS
:= -D__ASSEMBLY__
$(CPPFLAGS
)
174 export VERSION PATCHLEVEL SUBLEVEL EXTRAVERSION KERNELRELEASE ARCH \
175 CONFIG_SHELL TOPDIR HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC \
176 CPP AR NM STRIP OBJCOPY OBJDUMP MAKE GENKSYMS PERL UTS_MACHINE \
179 export CPPFLAGS NOSTDINC_FLAGS OBJCOPYFLAGS LDFLAGS
180 export CFLAGS CFLAGS_KERNEL CFLAGS_MODULE
181 export AFLAGS AFLAGS_KERNEL AFLAGS_MODULE
183 # The temporary file to save gcc -MD generated dependencies must not
185 depfile
= $(subst $(comma
),_
,$(@D
)/.
$(@F
).d
)
187 noconfig_targets
:= xconfig menuconfig config oldconfig randconfig \
188 defconfig allyesconfig allnoconfig allmodconfig \
189 clean mrproper
distclean \
190 help
tags TAGS sgmldocs psdocs pdfdocs htmldocs \
191 checkconfig checkhelp checkincludes
193 RCS_FIND_IGNORE
:= \
( -name SCCS
-o
-name BitKeeper
-o
-name .svn
-o
-name CVS \
) -prune
-o
194 RCS_TAR_IGNORE
:= --exclude SCCS
--exclude BitKeeper
--exclude .svn
--exclude CVS
196 # Helpers built in scripts/
197 # ---------------------------------------------------------------------------
199 scripts
/docproc scripts
/fixdep scripts
/split-include
: scripts
;
203 +@
$(Q
)$(MAKE
) -f scripts
/Makefile.build obj
=scripts
205 # Objects we will link into vmlinux / subdirs we need to visit
206 # ---------------------------------------------------------------------------
209 drivers-y
:= drivers
/ sound
/
215 ifeq ($(filter $(noconfig_targets
),$(MAKECMDGOALS
)),)
223 include arch
/$(ARCH
)/Makefile
225 core-y
+= kernel
/ mm
/ fs
/ ipc
/ security
/ crypto
/
227 SUBDIRS
+= $(patsubst %/,%,$(filter %/, $(init-y
) $(init-m
) \
228 $(core-y
) $(core-m
) $(drivers-y
) $(drivers-m
) \
229 $(net-y
) $(net-m
) $(libs-y
) $(libs-m
)))
231 ALL_SUBDIRS
:= $(SUBDIRS
) $(patsubst %/,%,$(filter %/, $(init-n
) $(init-
) \
232 $(core-n
) $(core-
) $(drivers-n
) $(drivers-
) \
233 $(net-n
) $(net-
) $(libs-n
) $(libs-
)))
235 init-y
:= $(patsubst %/, %/built-in.o
, $(init-y
))
236 core-y
:= $(patsubst %/, %/built-in.o
, $(core-y
))
237 drivers-y
:= $(patsubst %/, %/built-in.o
, $(drivers-y
))
238 net-y
:= $(patsubst %/, %/built-in.o
, $(net-y
))
239 libs-y
:= $(patsubst %/, %/lib.a
, $(libs-y
))
243 # Here goes the main Makefile
244 # ===========================================================================
246 # If the user gave a *config target, it'll be handled in another
247 # section below, since in this case we cannot include .config
248 # Same goes for other targets like clean/mrproper etc, which
249 # don't need .config, either
251 # In this section, we need .config
253 -include ..config.cmd
256 export EXPORT_FLAGS
:= -DEXPORT_SYMTAB
260 # INSTALL_PATH specifies where to place the updated kernel and system map
261 # images. Uncomment if you want to place them anywhere other than root.
264 #export INSTALL_PATH=/boot
267 # INSTALL_MOD_PATH specifies a prefix to MODLIB for module directory
268 # relocations required by build roots. This is not defined in the
269 # makefile but the arguement can be passed to make if needed.
272 MODLIB
:= $(INSTALL_MOD_PATH
)/lib
/modules
/$(KERNELRELEASE
)
276 # ---------------------------------------------------------------------------
278 # This is a bit tricky: If we need to relink vmlinux, we want
279 # the version number incremented, which means recompile init/version.o
280 # and relink init/init.o. However, we cannot do this during the
281 # normal descending-into-subdirs phase, since at that time
282 # we cannot yet know if we will need to relink vmlinux.
283 # So we descend into init/ inside the rule for vmlinux again.
285 vmlinux-objs
:= $(HEAD
) $(init-y
) $(core-y
) $(libs-y
) $(drivers-y
) $(net-y
)
287 quiet_cmd_vmlinux__
= LD
$@
289 $(LD
) $(LDFLAGS
) $(LDFLAGS_vmlinux
) $(HEAD
) $(init-y
) \
296 $(filter .tmp_kallsyms
%,$^
) \
300 # set -e makes the rule exit immediately on error
302 define rule_vmlinux__
304 $(if
$(filter .tmp_kallsyms
%,$^
),,
305 echo
' Generating build number'
306 . scripts
/mkversion
> .tmp_version
307 mv
-f .tmp_version .version
308 $(Q
)$(MAKE
) -f scripts
/Makefile.build obj
=init
310 $(call cmd
,vmlinux__
)
311 echo
'cmd_$@ := $(cmd_vmlinux__)' > $(@D
)/.
$(@F
).cmd
316 $(NM
) $@ | grep
-v
'\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' |
sort > System.map
319 LDFLAGS_vmlinux
+= -T arch
/$(ARCH
)/vmlinux.lds.s
321 # Generate section listing all symbols and add it into vmlinux
322 # It's a three stage process:
323 # o .tmp_vmlinux1 has all symbols and sections, but __kallsyms is
325 # Running kallsyms on that gives as .tmp_kallsyms1.o with
327 # o .tmp_vmlinux2 now has a __kallsyms section of the right size,
328 # but due to the added section, some addresses have shifted
329 # From here, we generate a correct .tmp_kallsyms2.o
330 # o The correct .tmp_kallsyms2.o is linked into the final vmlinux.
332 ifdef CONFIG_KALLSYMS
334 kallsyms.o
:= .tmp_kallsyms2.o
336 quiet_cmd_kallsyms
= KSYM
$@
337 cmd_kallsyms
= $(KALLSYMS
) $< > $@
339 .tmp_kallsyms1.o
: .tmp_vmlinux1
342 .tmp_kallsyms2.o
: .tmp_vmlinux2
345 .tmp_vmlinux1
: $(vmlinux-objs
) arch
/$(ARCH
)/vmlinux.lds.s FORCE
346 $(call if_changed_rule
,vmlinux__
)
348 .tmp_vmlinux2
: $(vmlinux-objs
) .tmp_kallsyms1.o arch
/$(ARCH
)/vmlinux.lds.s FORCE
349 $(call if_changed_rule
,vmlinux__
)
353 # Finally the vmlinux rule
355 vmlinux
: $(vmlinux-objs
) $(kallsyms.o
) arch
/$(ARCH
)/vmlinux.lds.s FORCE
356 $(call if_changed_rule
,vmlinux
)
358 # The actual objects are generated when descending,
359 # make sure no implicit rule kicks in
361 $(sort $(vmlinux-objs
)): $(SUBDIRS
) ;
363 # Handle descending into subdirectories listed in $(SUBDIRS)
366 $(SUBDIRS
): .hdepend prepare
367 $(Q
)$(MAKE
) -f scripts
/Makefile.build obj
=$@
369 # Things we need done before we descend to build or make
370 # module versions are listed in "prepare"
373 prepare
: include/linux
/version.h
include/asm
include/config
/MARKER
374 @echo
' Starting the build. KBUILD_BUILTIN=$(KBUILD_BUILTIN) KBUILD_MODULES=$(KBUILD_MODULES)'
376 # This can be used by arch/$ARCH/Makefile to preprocess
377 # their vmlinux.lds.S file
379 AFLAGS_vmlinux.lds.o
+= -P
-C
-U
$(ARCH
)
381 arch
/$(ARCH
)/vmlinux.lds.s
: %.s
: %.S scripts FORCE
382 $(call if_changed_dep
,as_s_S
)
384 targets
+= arch
/$(ARCH
)/vmlinux.lds.s
387 # ---------------------------------------------------------------------------
389 %.s
: %.c scripts FORCE
390 $(Q
)$(MAKE
) -f scripts
/Makefile.build obj
=$(@D
) $@
391 %.i
: %.c scripts FORCE
392 $(Q
)$(MAKE
) -f scripts
/Makefile.build obj
=$(@D
) $@
393 %.o
: %.c scripts FORCE
394 $(Q
)$(MAKE
) -f scripts
/Makefile.build obj
=$(@D
) $@
395 %.lst
: %.c scripts FORCE
396 $(Q
)$(MAKE
) -f scripts
/Makefile.build obj
=$(@D
) $@
397 %.s
: %.S scripts FORCE
398 $(Q
)$(MAKE
) -f scripts
/Makefile.build obj
=$(@D
) $@
399 %.o
: %.S scripts FORCE
400 $(Q
)$(MAKE
) -f scripts
/Makefile.build obj
=$(@D
) $@
402 # FIXME: The asm symlink changes when $(ARCH) changes. That's
403 # hard to detect, but I suppose "make mrproper" is a good idea
404 # before switching between archs anyway.
407 @echo
' Making asm->asm-$(ARCH) symlink'
408 @ln
-s asm-
$(ARCH
) $@
410 # Split autoconf.h into include/linux/config/*
412 include/config
/MARKER
: scripts
/split-include
include/linux
/autoconf.h
413 @echo
' SPLIT include/linux/autoconf.h -> include/config/*'
414 @scripts
/split-include
include/linux
/autoconf.h
include/config
417 # if .config is newer than include/linux/autoconf.h, someone tinkered
418 # with it and forgot to run make oldconfig
420 include/linux
/autoconf.h
: .config
421 +@
$(call descend
,scripts
/kconfig
,scripts
/kconfig
/conf
)
422 .
/scripts
/kconfig
/conf
-s arch
/$(ARCH
)/Kconfig
424 # Generate some files
425 # ---------------------------------------------------------------------------
427 # version.h changes when $(KERNELRELEASE) etc change, as defined in
432 include/linux
/version.h
: Makefile
433 @if expr length
"$(KERNELRELEASE)" \
> $(uts_len
) >/dev
/null
; then \
434 echo
'"$(KERNELRELEASE)" exceeds $(uts_len) characters' >&2; \
437 @echo
-n
' Generating $@'
438 @
(echo \
#define UTS_RELEASE \"$(KERNELRELEASE)\"; \
439 echo \
#define LINUX_VERSION_CODE `expr $(VERSION) \\* 65536 + $(PATCHLEVEL) \\* 256 + $(SUBLEVEL)`; \
440 echo
'#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))'; \
442 @
$(update-if-changed
)
444 # Generate module versions
445 # ---------------------------------------------------------------------------
447 # The targets are still named depend / dep for traditional
448 # reasons, but the only thing we do here is generating
449 # the module version checksums.
451 .PHONY
: depend dep
$(patsubst %,_sfdep_
%,$(SUBDIRS
))
455 # .hdepend is our (misnomed) marker for whether we've
456 # generated module versions
458 make-versions
:= $(strip $(if
$(filter dep depend
,$(MAKECMDGOALS
)),1) \
459 $(if
$(wildcard .hdepend
),,1))
461 .hdepend
: prepare FORCE
462 ifneq ($(make-versions
),)
463 @
$(MAKE
) include/linux
/modversions.h
467 ifdef CONFIG_MODVERSIONS
469 # Update modversions.h, but only if it would change.
471 .PHONY
: __rm_tmp_export-objs
472 __rm_tmp_export-objs
:
473 @
rm -rf .tmp_export-objs
475 include/linux
/modversions.h
: $(patsubst %,_modver_
%,$(SUBDIRS
))
476 @echo
-n
' Generating $@'
477 @
( echo
"#ifndef _LINUX_MODVERSIONS_H";\
478 echo
"#define _LINUX_MODVERSIONS_H"; \
479 echo
"#include <linux/modsetver.h>"; \
480 cd .tmp_export-objs
>/dev
/null
; \
481 for f in
`find modules -name \*.ver -print | sort`; do \
482 echo
"#include <linux/$${f}>"; \
488 .PHONY
: $(patsubst %, _modver_
%, $(SUBDIRS
))
489 $(patsubst %, _modver_
%, $(SUBDIRS
)): __rm_tmp_export-objs
490 $(Q
)$(MAKE
) -f scripts
/Makefile.modver obj
=$(patsubst _modver_
%,%,$@
)
492 else # !CONFIG_MODVERSIONS
494 .PHONY
: include/linux
/modversions.h
496 include/linux
/modversions.h
:
498 endif # CONFIG_MODVERSIONS
500 # ---------------------------------------------------------------------------
507 ifdef CONFIG_MODVERSIONS
508 MODFLAGS
+= -include include/linux
/modversions.h
516 .PHONY
: modules_install
517 modules_install
: _modinst_
$(patsubst %, _modinst_
%, $(SUBDIRS
)) _modinst_post
521 @
rm -rf
$(MODLIB
)/kernel
522 @
rm -f
$(MODLIB
)/build
523 @mkdir
-p
$(MODLIB
)/kernel
524 @ln
-s
$(TOPDIR
) $(MODLIB
)/build
526 # If System.map exists, run depmod. This deliberately does not have a
527 # dependency on System.map since that would run the dependency tree on
528 # vmlinux. This depmod is only for convenience to give the initial
529 # boot a modules.dep even before / is mounted read-write. However the
530 # boot script depmod is the master version.
531 ifeq "$(strip $(INSTALL_MOD_PATH))" ""
534 depmod_opts
:= -b
$(INSTALL_MOD_PATH
) -r
536 .PHONY
: _modinst_post
538 if
[ -r System.map
]; then
$(DEPMOD
) -ae
-F System.map
$(depmod_opts
) $(KERNELRELEASE
); fi
540 .PHONY
: $(patsubst %, _modinst_
%, $(SUBDIRS
))
541 $(patsubst %, _modinst_
%, $(SUBDIRS
)) :
542 $(Q
)$(MAKE
) -f scripts
/Makefile.modinst obj
=$(patsubst _modinst_
%,%,$@
)
543 else # CONFIG_MODULES
545 # Modules not configured
546 # ---------------------------------------------------------------------------
548 modules modules_install
: FORCE
550 @echo
"The present kernel configuration has modules disabled."
551 @echo
"Type 'make config' and enable loadable module support."
552 @echo
"Then build a kernel with module support enabled."
556 endif # CONFIG_MODULES
558 # Generate asm-offsets.h
559 # ---------------------------------------------------------------------------
561 define generate-asm-offsets.h
563 echo
"#ifndef __ASM_OFFSETS_H__"; \
564 echo
"#define __ASM_OFFSETS_H__"; \
566 echo
" * DO NOT MODIFY."; \
568 echo
" * This file was generated by arch/$(ARCH)/Makefile"; \
572 sed
-ne
"/^->/{s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}"; \
578 # ---------------------------------------------------------------------------
580 # If you do a make spec before packing the tarball you can rpm -ta it
583 . scripts
/mkspec
>kernel.spec
585 # Build a tar ball, generate an rpm from it and pack the result
586 # There arw two bits of magic here
587 # 1) The use of /. to avoid tar packing just the symlink
588 # 2) Removing the .dep files as they have source paths in them that
589 # will become invalid
592 find .
$(RCS_FIND_IGNORE
) \
593 \
( -size
0 -o
-name .depend
-o
-name .hdepend \
) \
594 -type f
-print | xargs
rm -f
597 ln
-sf
$(TOPDIR
) $(KERNELPATH
) ; \
598 tar -cvz
$(RCS_TAR_IGNORE
) -f
$(KERNELPATH
).
tar.gz
$(KERNELPATH
)/.
; \
601 . scripts
/mkversion
> .version
; \
602 rpm
-ta
$(TOPDIR
)/..
/$(KERNELPATH
).
tar.gz
; \
603 rm $(TOPDIR
)/..
/$(KERNELPATH
).
tar.gz
605 else # ifdef include-config
607 ifeq ($(filter-out $(noconfig_targets
),$(MAKECMDGOALS
)),)
609 # Targets which don't need .config
610 # ===========================================================================
612 # These targets basically have their own Makefile - not quite, but at
613 # least its own exclusive section in the same Makefile. The reason for
614 # this is the following:
615 # To know the configuration, the main Makefile has to include
616 # .config. That's a obviously a problem when .config doesn't exist
617 # yet, but that could be kludged around with only including it if it
619 # However, the larger problem is: If you run make *config, make will
620 # include the old .config, then execute your *config. It will then
621 # notice that a piece it included (.config) did change and restart from
622 # scratch. Which will cause execution of *config again. You get the
624 # If we don't explicitly let the Makefile know that .config is changed
625 # by *config (the old way), it won't reread .config after *config,
626 # thus working with possibly stale values - we don't that either.
628 # So we divide things: This part here is for making *config targets,
629 # and other targets which should work when no .config exists yet.
630 # The main part above takes care of the rest after a .config exists.
632 # Kernel configuration
633 # ---------------------------------------------------------------------------
635 .PHONY
: oldconfig xconfig menuconfig config \
638 scripts
/kconfig
/conf scripts
/kconfig
/mconf scripts
/kconfig
/qconf
: scripts
/fixdep FORCE
639 +@
$(call descend
,scripts
/kconfig
,$@
)
641 xconfig
: scripts
/kconfig
/qconf
642 .
/scripts
/kconfig
/qconf arch
/$(ARCH
)/Kconfig
644 menuconfig
: scripts
/kconfig
/mconf
645 $(Q
)$(MAKE
) -f scripts
/Makefile.build obj
=scripts lxdialog
646 .
/scripts
/kconfig
/mconf arch
/$(ARCH
)/Kconfig
648 config
: scripts
/kconfig
/conf
649 .
/scripts
/kconfig
/conf arch
/$(ARCH
)/Kconfig
651 oldconfig
: scripts
/kconfig
/conf
652 .
/scripts
/kconfig
/conf
-o arch
/$(ARCH
)/Kconfig
654 randconfig
: scripts
/kconfig
/conf
655 .
/scripts
/kconfig
/conf
-r arch
/$(ARCH
)/Kconfig
657 allyesconfig
: scripts
/kconfig
/conf
658 .
/scripts
/kconfig
/conf
-y arch
/$(ARCH
)/Kconfig
660 allnoconfig
: scripts
/kconfig
/conf
661 .
/scripts
/kconfig
/conf
-n arch
/$(ARCH
)/Kconfig
663 allmodconfig
: scripts
/kconfig
/conf
664 .
/scripts
/kconfig
/conf
-m arch
/$(ARCH
)/Kconfig
666 defconfig
: scripts
/kconfig
/conf
667 .
/scripts
/kconfig
/conf
-d arch
/$(ARCH
)/Kconfig
670 # Cleaning is done on three levels.
671 # make clean Delete all automatically generated files, including
672 # tools and firmware.
673 # make mrproper Delete the current configuration, and related files
674 # Any core files spread around is deleted as well
675 # make distclean Remove editor backup files, patch leftover files and the like
677 # Files removed with 'make clean'
678 CLEAN_FILES
+= vmlinux System.map MC
*
680 # Files removed with 'make mrproper'
682 include/linux
/autoconf.h
include/linux
/version.h \
683 .version .config .config.old config.in config.old \
686 .hdepend
include/linux
/modversions.h \
687 tags TAGS kernel.spec \
690 # Directories removed with 'make mrproper'
694 include/linux
/modules
696 # clean - Delete all intermediate files
698 clean-dirs
+= $(ALL_SUBDIRS
) Documentation
/DocBook scripts
700 $(addprefix _clean_
,$(clean-dirs
)):
701 $(Q
)$(MAKE
) -f scripts
/Makefile.
clean obj
=$(patsubst _clean_
%,%,$@
)
703 quiet_cmd_rmclean
= RM
$$(CLEAN_FILES
)
704 cmd_rmclean
= rm -f
$(CLEAN_FILES
)
705 clean: archclean
$(addprefix _clean_
,$(clean-dirs
))
707 @find .
$(RCS_FIND_IGNORE
) \
708 \
( -name
'*.[oas]' -o
-name
'.*.cmd' -o
-name
'.*.d' \
709 -o
-name
'.*.tmp' \
) -type f
-print | xargs
rm -f
711 # mrproper - delete configuration + modules + core files
713 quiet_cmd_mrproper
= RM
$$(MRPROPER_DIRS
) + $$(MRPROPER_FILES
)
714 cmd_mrproper
= rm -rf
$(MRPROPER_DIRS
) && rm -f
$(MRPROPER_FILES
)
715 mrproper
distclean: clean archmrproper
716 @echo
' Making $@ in the srctree'
717 @find .
$(RCS_FIND_IGNORE
) \
718 \
( -name
'*.orig' -o
-name
'*.rej' -o
-name
'*~' \
719 -o
-name
'*.bak' -o
-name
'#*#' -o
-name
'.*.orig' \
720 -o
-name
'.*.rej' -o
-size
0 \
721 -o
-name
'*%' -o
-name
'.*.cmd' -o
-name
'core' \
) \
722 -type f
-print | xargs
rm -f
725 # Generate tags for editors
726 # ---------------------------------------------------------------------------
729 ( find .
$(RCS_FIND_IGNORE
) \
730 \
( -name
include -o
-name arch \
) -prune
-o \
731 -name
'*.[chS]' -print; \
732 find arch
/$(ARCH
) $(RCS_FIND_IGNORE
) \
733 -name
'*.[chS]' -print; \
734 find
include $(RCS_FIND_IGNORE
) \
735 \
( -name config
-o
-name
'asm-*' \
) -prune \
736 -o
-name
'*.[chS]' -print; \
737 find
include/asm-
$(ARCH
) $(RCS_FIND_IGNORE
) \
738 -name
'*.[chS]' -print; \
739 find
include/asm-generic
$(RCS_FIND_IGNORE
) \
740 -name
'*.[chS]' -print )
743 quiet_cmd_TAGS
= MAKE
$@
744 cmd_TAGS
= $(all-sources
) | etags
-
746 # Exuberant ctags works better with -I
748 quiet_cmd_tags
= MAKE
$@
751 CTAGSF
=`ctags --version | grep -i exuberant >/dev/null && echo "-I __initdata,__exitdata,EXPORT_SYMBOL,EXPORT_SYMBOL_NOVERS"`; \
752 $(all-sources
) | xargs ctags
$$CTAGSF -a
761 # Brief documentation of the typical targets used
762 # ---------------------------------------------------------------------------
765 @echo
'Cleaning targets:'
766 @echo
' clean - remove most generated files but keep the config'
767 @echo
' mrproper - remove all generated files including the config'
768 @echo
' distclean - mrproper + remove files generated by editors and patch'
770 @echo
'Configuration targets:'
771 @echo
' oldconfig - Update current config utilising a line-oriented program'
772 @echo
' menuconfig - Update current config utilising a menu based program'
773 @echo
' xconfig - Update current config utilising a X-based program'
774 @echo
' defconfig - New config with default answer to all options'
775 @echo
' allmodconfig - New config selecting modules when possible'
776 @echo
' allyesconfig - New config where all options are accepted with yes'
777 @echo
' allnoconfig - New minimal config'
779 @echo
'Other generic targets:'
780 @echo
' all - Build all targets marked with [*]'
781 @echo
' dep - Create module version information'
782 @echo
'* vmlinux - Build the bare kernel'
783 @echo
'* modules - Build all modules'
784 @echo
' dir/file.[ois]- Build specified target only'
785 @echo
' rpm - Build a kernel as an RPM package'
786 @echo
' tags/TAGS - Generate tags file for editors'
788 @echo
'Documentation targets:'
789 @
$(MAKE
) --no-print-directory
-f Documentation
/DocBook
/Makefile dochelp
791 @echo
'Architecture specific targets ($(ARCH)):'
792 @
$(MAKE
) --no-print-directory
-f arch
/$(ARCH
)/boot
/Makefile archhelp
794 @echo
'Execute "make" or "make all" to build all targets marked with [*] '
795 @echo
'For further info browse Documentation/kbuild/*'
798 # Documentation targets
799 # ---------------------------------------------------------------------------
800 sgmldocs psdocs pdfdocs htmldocs
: scripts
801 $(Q
)$(MAKE
) -f Documentation
/DocBook
/Makefile
$@
803 # Scripts to check various things for consistency
804 # ---------------------------------------------------------------------------
807 find
* $(RCS_FIND_IGNORE
) \
808 -name
'*.[hcS]' -type f
-print |
sort \
809 | xargs
$(PERL
) -w scripts
/checkconfig.pl
812 find
* $(RCS_FIND_IGNORE
) \
813 -name
[cC
]onfig.in
-print |
sort \
814 | xargs
$(PERL
) -w scripts
/checkhelp.pl
817 find
* $(RCS_FIND_IGNORE
) \
818 -name
'*.[hcS]' -type f
-print |
sort \
819 | xargs
$(PERL
) -w scripts
/checkincludes.pl
821 else # ifneq ($(filter-out $(noconfig_targets),$(MAKECMDGOALS)),)
823 # We're called with both targets which do and do not need
824 # .config included. Handle them one after the other.
825 # ===========================================================================
830 endif # ifeq ($(filter-out $(noconfig_targets),$(MAKECMDGOALS)),)
831 endif # ifdef include-config
833 # FIXME Should go into a make.lib or something
834 # ===========================================================================
836 a_flags
= -Wp
,-MD
,$(depfile
) $(AFLAGS
) $(NOSTDINC_FLAGS
) \
837 $(modkern_aflags
) $(EXTRA_AFLAGS
) $(AFLAGS_
$(*F
).o
)
839 quiet_cmd_as_s_S
= CPP
$@
840 cmd_as_s_S
= $(CPP
) $(a_flags
) -o
$@
$<
842 # read all saved command lines
844 targets
:= $(wildcard $(sort $(targets
)))
845 cmd_files
:= $(wildcard .
*.cmd
$(foreach f
,$(targets
),$(dir $(f
)).
$(notdir $(f
)).cmd
))
847 ifneq ($(cmd_files
),)
851 # execute the command and also postprocess generated .d dependencies
854 if_changed_dep
= $(if
$(strip $?
$(filter-out FORCE
$(wildcard $^
),$^
)\
855 $(filter-out $(cmd_
$(1)),$(cmd_
$@
))\
856 $(filter-out $(cmd_
$@
),$(cmd_
$(1)))),\
858 $(if
$($(quiet
)cmd_
$(1)),echo
' $($(quiet)cmd_$(1))';) \
860 scripts
/fixdep
$(depfile
) $@
'$(cmd_$(1))' > $(@D
)/.
$(@F
).tmp
; \
862 mv
-f
$(@D
)/.
$(@F
).tmp
$(@D
)/.
$(@F
).cmd
)
864 # Usage: $(call if_changed_rule,foo)
865 # will check if $(cmd_foo) changed, or any of the prequisites changed,
866 # and if so will execute $(rule_foo)
868 if_changed_rule
= $(if
$(strip $? \
869 $(filter-out $(cmd_
$(1)),$(cmd_
$(@F
)))\
870 $(filter-out $(cmd_
$(@F
)),$(cmd_
$(1)))),\
873 # If quiet is set, only print short version of command
875 cmd
= @
$(if
$($(quiet
)cmd_
$(1)),echo
' $($(quiet)cmd_$(1))' &&) $(cmd_
$(1))
877 define update-if-changed
878 if
[ -r
$@
] && cmp
-s
$@
$@.tmp
; then \
879 echo
' (unchanged)'; \
886 # $(call descend,<dir>,<target>)
887 # Recursively call a sub-make in <dir> with target <target>
889 descend
= $(Q
)$(MAKE
) -f scripts
/Makefile.build obj
=$(1) $(2)