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.
39 # Remove hyphens since they have special meaning in RPM filenames
40 KERNELPATH
=kernel-
$(subst -,,$(KERNELRELEASE
))
42 UTS_MACHINE
:= $(ARCH
)
44 CONFIG_SHELL
:= $(shell if
[ -x
"$$BASH" ]; then echo
$$BASH; \
45 else if
[ -x
/bin
/bash
]; then echo
/bin
/bash
; \
46 else echo sh
; fi
; fi
)
51 HOSTCFLAGS
= -Wall
-Wstrict-prototypes
-O2
-fomit-frame-pointer
56 # That's our default target when none is given on the command line
57 # Note that 'modules' will be added as a prerequisite as well,
58 # in the CONFIG_MODULES part below
62 # Decide whether to build built-in, modular, or both.
63 # Normally, just do built-in.
68 # If we have only "make modules", don't compile built-in objects.
70 ifeq ($(MAKECMDGOALS
),modules
)
74 # If we have "make <whatever> modules", compile modules
75 # in addition to whatever we do anyway.
77 ifneq ($(filter modules
,$(MAKECMDGOALS
)),)
81 # Just "make" or "make all" shall build modules as well
83 ifeq ($(MAKECMDGOALS
),)
87 ifneq ($(filter all,$(MAKECMDGOALS
)),)
91 export KBUILD_MODULES KBUILD_BUILTIN KBUILD_VERBOSE KBUILD_CHECKSRC
94 # ---------------------------------------------------------------------------
96 # Normally, we echo the whole command before executing it. By making
97 # that echo $($(quiet)$(cmd)), we now have the possibility to set
98 # $(quiet) to choose other forms of output instead, e.g.
100 # quiet_cmd_cc_o_c = Compiling $(RELDIR)/$@
101 # cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $<
103 # If $(quiet) is empty, the whole command will be printed.
104 # If it is set to "quiet_", only the short version will be printed.
105 # If it is set to "silent_", nothing wil be printed at all, since
106 # the variable $(silent_cmd_cc_o_c) doesn't exist.
108 # To put more focus on warnings, less verbose as default
111 ifeq ("$(origin V)", "command line")
112 KBUILD_VERBOSE
= $(V
)
115 ifndef KBUILD_VERBOSE
120 ifeq ("$(origin C)", "command line")
121 KBUILD_CHECKSRC
= $(C
)
124 ifndef KBUILD_CHECKSRC
129 MAKEFLAGS
+= --no-print-directory
131 # For maximum performance (+ possibly random breakage, uncomment
136 # If the user wants quiet mode, echo short versions of the commands
139 ifeq ($(KBUILD_VERBOSE
),1)
147 # If the user is running make -s (silent mode), suppress echoing of
150 ifneq ($(findstring s
,$(MAKEFLAGS
)),)
154 export quiet Q KBUILD_VERBOSE
156 # Paths to obj / src tree
163 export srctree objtree
165 # Make variables (CC, etc...)
167 AS
= $(CROSS_COMPILE
)as
168 LD
= $(CROSS_COMPILE
)ld
169 CC
= $(CROSS_COMPILE
)gcc
171 AR
= $(CROSS_COMPILE
)ar
172 NM
= $(CROSS_COMPILE
)nm
173 STRIP
= $(CROSS_COMPILE
)strip
174 OBJCOPY
= $(CROSS_COMPILE
)objcopy
175 OBJDUMP
= $(CROSS_COMPILE
)objdump
177 RPM
:= $(shell if
[ -x
"/usr/bin/rpmbuild" ]; then echo rpmbuild
; \
179 GENKSYMS
= scripts
/genksyms
/genksyms
180 DEPMOD
= /sbin
/depmod
181 KALLSYMS
= scripts
/kallsyms
183 CHECK
= /home
/torvalds
/parser
/check
185 CFLAGS_MODULE
= $(MODFLAGS
)
186 AFLAGS_MODULE
= $(MODFLAGS
)
191 NOSTDINC_FLAGS
= -nostdinc
-iwithprefix
include
193 CPPFLAGS
:= -D__KERNEL__
-Iinclude
194 CFLAGS
:= $(CPPFLAGS
) -Wall
-Wstrict-prototypes
-Wno-trigraphs
-O2 \
195 -fno-strict-aliasing
-fno-common
196 AFLAGS
:= -D__ASSEMBLY__
$(CPPFLAGS
)
198 export VERSION PATCHLEVEL SUBLEVEL EXTRAVERSION KERNELRELEASE ARCH \
199 CONFIG_SHELL TOPDIR HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC \
200 CPP AR NM STRIP OBJCOPY OBJDUMP MAKE AWK GENKSYMS PERL UTS_MACHINE \
201 HOSTCXX HOSTCXXFLAGS LDFLAGS_BLOB LDFLAGS_MODULE CHECK
203 export CPPFLAGS NOSTDINC_FLAGS OBJCOPYFLAGS LDFLAGS
204 export CFLAGS CFLAGS_KERNEL CFLAGS_MODULE
205 export AFLAGS AFLAGS_KERNEL AFLAGS_MODULE
207 export MODVERDIR
:= .tmp_versions
209 # The temporary file to save gcc -MD generated dependencies must not
212 depfile
= $(subst $(comma
),_
,$(@D
)/.
$(@F
).d
)
214 noconfig_targets
:= xconfig gconfig menuconfig config oldconfig randconfig \
215 defconfig allyesconfig allnoconfig allmodconfig \
216 clean mrproper
distclean rpm \
217 help
tags TAGS cscope sgmldocs psdocs pdfdocs htmldocs \
218 checkconfig checkhelp checkincludes
220 RCS_FIND_IGNORE
:= \
( -name SCCS
-o
-name BitKeeper
-o
-name .svn
-o
-name CVS \
) -prune
-o
221 RCS_TAR_IGNORE
:= --exclude SCCS
--exclude BitKeeper
--exclude .svn
--exclude CVS
223 # Helpers built in scripts/
224 # ---------------------------------------------------------------------------
226 scripts
/docproc scripts
/fixdep scripts
/split-include
: scripts
;
230 $(Q
)$(MAKE
) $(build
)=scripts
232 # Objects we will link into vmlinux / subdirs we need to visit
233 # ---------------------------------------------------------------------------
236 drivers-y
:= drivers
/ sound
/
242 ifeq ($(filter $(noconfig_targets
),$(MAKECMDGOALS
)),)
244 export include_config
:= 1
250 include arch
/$(ARCH
)/Makefile
252 core-y
+= kernel
/ mm
/ fs
/ ipc
/ security
/ crypto
/
254 SUBDIRS
+= $(patsubst %/,%,$(filter %/, $(init-y
) $(init-m
) \
255 $(core-y
) $(core-m
) $(drivers-y
) $(drivers-m
) \
256 $(net-y
) $(net-m
) $(libs-y
) $(libs-m
)))
258 ALL_SUBDIRS
:= $(sort $(SUBDIRS
) $(patsubst %/,%,$(filter %/, \
260 $(core-n
) $(core-
) $(drivers-n
) $(drivers-
) \
261 $(net-n
) $(net-
) $(libs-n
) $(libs-
))))
263 init-y
:= $(patsubst %/, %/built-in.o
, $(init-y
))
264 core-y
:= $(patsubst %/, %/built-in.o
, $(core-y
))
265 drivers-y
:= $(patsubst %/, %/built-in.o
, $(drivers-y
))
266 net-y
:= $(patsubst %/, %/built-in.o
, $(net-y
))
267 libs-y
:= $(patsubst %/, %/lib.a
, $(libs-y
))
271 # Here goes the main Makefile
272 # ===========================================================================
274 # If the user gave a *config target, it'll be handled in another
275 # section below, since in this case we cannot include .config
276 # Same goes for other targets like clean/mrproper etc, which
277 # don't need .config, either
279 # In this section, we need .config
283 ifndef CONFIG_FRAME_POINTER
284 CFLAGS
+= -fomit-frame-pointer
287 # When we're building modules with modversions, we need to consider
288 # the built-in objects during the descend as well, in order to
289 # make sure the checksums are uptodate before we record them.
291 ifdef CONFIG_MODVERSIONS
292 ifeq ($(KBUILD_MODULES
),1)
293 ifneq ($(KBUILD_BUILTIN
),1)
300 # INSTALL_PATH specifies where to place the updated kernel and system map
301 # images. Uncomment if you want to place them anywhere other than root.
304 #export INSTALL_PATH=/boot
307 # INSTALL_MOD_PATH specifies a prefix to MODLIB for module directory
308 # relocations required by build roots. This is not defined in the
309 # makefile but the arguement can be passed to make if needed.
312 MODLIB
:= $(INSTALL_MOD_PATH
)/lib
/modules
/$(KERNELRELEASE
)
316 # ---------------------------------------------------------------------------
318 # This is a bit tricky: If we need to relink vmlinux, we want
319 # the version number incremented, which means recompile init/version.o
320 # and relink init/init.o. However, we cannot do this during the
321 # normal descending-into-subdirs phase, since at that time
322 # we cannot yet know if we will need to relink vmlinux.
323 # So we descend into init/ inside the rule for vmlinux again.
325 vmlinux-objs
:= $(head-y
) $(init-y
) $(core-y
) $(libs-y
) $(drivers-y
) $(net-y
)
327 quiet_cmd_vmlinux__
= LD
$@
329 $(LD
) $(LDFLAGS
) $(LDFLAGS_vmlinux
) $(head-y
) $(init-y
) \
336 $(filter .tmp_kallsyms
%,$^
) \
340 # set -e makes the rule exit immediately on error
342 define rule_vmlinux__
344 $(if
$(filter .tmp_kallsyms
%,$^
),, \
345 echo
' GEN .version'; \
346 .
$(srctree
)/scripts
/mkversion
> .tmp_version
; \
347 mv
-f .tmp_version .version
; \
348 $(MAKE
) $(build
)=init
; \
350 $(if
$($(quiet
)cmd_vmlinux__
), \
351 echo
' $($(quiet)cmd_vmlinux__)' &&) \
353 echo
'cmd_$@ := $(cmd_vmlinux__)' > $(@D
)/.
$(@F
).cmd
358 $(NM
) $@ | grep
-v
'\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' |
sort > System.map
361 LDFLAGS_vmlinux
+= -T arch
/$(ARCH
)/vmlinux.lds.s
363 # Generate section listing all symbols and add it into vmlinux
364 # It's a three stage process:
365 # o .tmp_vmlinux1 has all symbols and sections, but __kallsyms is
367 # Running kallsyms on that gives us .tmp_kallsyms1.o with
369 # o .tmp_vmlinux2 now has a __kallsyms section of the right size,
370 # but due to the added section, some addresses have shifted
371 # From here, we generate a correct .tmp_kallsyms2.o
372 # o The correct .tmp_kallsyms2.o is linked into the final vmlinux.
374 ifdef CONFIG_KALLSYMS
376 kallsyms.o
:= .tmp_kallsyms2.o
378 quiet_cmd_kallsyms
= KSYM
$@
379 cmd_kallsyms
= $(NM
) -n
$< | scripts
/kallsyms
> $@
381 .tmp_kallsyms1.o .tmp_kallsyms2.o
: %.o
: %.S scripts FORCE
382 $(call if_changed_dep
,as_o_S
)
384 .tmp_kallsyms
%.S
: .tmp_vmlinux
%
387 .tmp_vmlinux1
: $(vmlinux-objs
) arch
/$(ARCH
)/vmlinux.lds.s FORCE
388 +$(call if_changed_rule
,vmlinux__
)
390 .tmp_vmlinux2
: $(vmlinux-objs
) .tmp_kallsyms1.o arch
/$(ARCH
)/vmlinux.lds.s FORCE
391 $(call if_changed_rule
,vmlinux__
)
395 # Finally the vmlinux rule
397 vmlinux
: $(vmlinux-objs
) $(kallsyms.o
) arch
/$(ARCH
)/vmlinux.lds.s FORCE
398 $(call if_changed_rule
,vmlinux
)
400 # The actual objects are generated when descending,
401 # make sure no implicit rule kicks in
403 $(sort $(vmlinux-objs
)): $(SUBDIRS
) ;
405 # Handle descending into subdirectories listed in $(SUBDIRS)
409 $(Q
)$(MAKE
) $(build
)=$@
411 # Things we need done before we descend to build or make
412 # module versions are listed in "prepare"
415 prepare
: include/linux
/version.h
include/asm
include/config
/MARKER
417 ifeq ($(origin SUBDIRS
),file
)
418 $(Q
)rm -rf
$(MODVERDIR
)
420 @echo
'*** Warning: Overriding SUBDIRS on the command line can cause'
421 @echo
'*** inconsistencies'
423 $(Q
)mkdir
-p
$(MODVERDIR
)
425 @echo
' Starting the build. KBUILD_BUILTIN=$(KBUILD_BUILTIN) KBUILD_MODULES=$(KBUILD_MODULES)'
427 # This can be used by arch/$ARCH/Makefile to preprocess
428 # their vmlinux.lds.S file
430 AFLAGS_vmlinux.lds.o
+= -P
-C
-U
$(ARCH
)
432 arch
/$(ARCH
)/vmlinux.lds.s
: %.s
: %.S scripts FORCE
433 $(call if_changed_dep
,as_s_S
)
435 targets
+= arch
/$(ARCH
)/vmlinux.lds.s
438 # ---------------------------------------------------------------------------
440 %.s
: %.c scripts FORCE
441 $(Q
)$(MAKE
) $(build
)=$(@D
) $@
442 %.i
: %.c scripts FORCE
443 $(Q
)$(MAKE
) $(build
)=$(@D
) $@
444 %.o
: %.c scripts FORCE
445 $(Q
)$(MAKE
) $(build
)=$(@D
) $@
446 %/: scripts prepare FORCE
447 $(Q
)$(MAKE
) $(build
)=$(@D
)
449 $(Q
)$(MAKE
) $(build
)=$(@D
) $@
450 %.lst
: %.c scripts FORCE
451 $(Q
)$(MAKE
) $(build
)=$(@D
) $@
452 %.s
: %.S scripts FORCE
453 $(Q
)$(MAKE
) $(build
)=$(@D
) $@
454 %.o
: %.S scripts FORCE
455 $(Q
)$(MAKE
) $(build
)=$(@D
) $@
457 # FIXME: The asm symlink changes when $(ARCH) changes. That's
458 # hard to detect, but I suppose "make mrproper" is a good idea
459 # before switching between archs anyway.
462 @echo
' Making asm->asm-$(ARCH) symlink'
463 @ln
-s asm-
$(ARCH
) $@
465 # Split autoconf.h into include/linux/config/*
467 include/config
/MARKER
: scripts
/split-include
include/linux
/autoconf.h
468 @echo
' SPLIT include/linux/autoconf.h -> include/config/*'
469 @scripts
/split-include
include/linux
/autoconf.h
include/config
472 # if .config is newer than include/linux/autoconf.h, someone tinkered
473 # with it and forgot to run make oldconfig
475 include/linux
/autoconf.h
: .config scripts
/fixdep
476 $(Q
)$(MAKE
) $(build
)=scripts
/kconfig scripts
/kconfig
/conf
477 .
/scripts
/kconfig
/conf
-s arch
/$(ARCH
)/Kconfig
479 # Generate some files
480 # ---------------------------------------------------------------------------
482 # version.h changes when $(KERNELRELEASE) etc change, as defined in
487 define filechk_version.h
488 if expr length
"$(KERNELRELEASE)" \
> $(uts_len
) >/dev
/null
; then \
489 echo
'"$(KERNELRELEASE)" exceeds $(uts_len) characters' >&2; \
492 (echo \
#define UTS_RELEASE \"$(KERNELRELEASE)\"; \
493 echo \
#define LINUX_VERSION_CODE `expr $(VERSION) \\* 65536 + $(PATCHLEVEL) \\* 256 + $(SUBLEVEL)`; \
494 echo
'#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))'; \
498 include/linux
/version.h
: Makefile
499 $(call filechk
,version.h
)
501 # ---------------------------------------------------------------------------
505 @echo
'*** Warning: make $@ is unnecessary now.'
507 # ---------------------------------------------------------------------------
512 # By default, build modules as well
519 modules
: $(SUBDIRS
) $(if
$(KBUILD_BUILTIN
),vmlinux
)
520 @echo
' Building modules, stage 2.';
521 $(Q
)$(MAKE
) -rR
-f scripts
/Makefile.modpost
525 .PHONY
: modules_install
526 modules_install
: _modinst_ _modinst_post
530 @
rm -rf
$(MODLIB
)/kernel
531 @
rm -f
$(MODLIB
)/build
532 @mkdir
-p
$(MODLIB
)/kernel
533 @ln
-s
$(TOPDIR
) $(MODLIB
)/build
534 $(Q
)$(MAKE
) -rR
-f scripts
/Makefile.modinst
536 # If System.map exists, run depmod. This deliberately does not have a
537 # dependency on System.map since that would run the dependency tree on
538 # vmlinux. This depmod is only for convenience to give the initial
539 # boot a modules.dep even before / is mounted read-write. However the
540 # boot script depmod is the master version.
541 ifeq "$(strip $(INSTALL_MOD_PATH))" ""
544 depmod_opts
:= -b
$(INSTALL_MOD_PATH
) -r
546 .PHONY
: _modinst_post
547 _modinst_post
: _modinst_
548 if
[ -r System.map
]; then
$(DEPMOD
) -ae
-F System.map
$(depmod_opts
) $(KERNELRELEASE
); fi
550 else # CONFIG_MODULES
552 # Modules not configured
553 # ---------------------------------------------------------------------------
555 modules modules_install
: FORCE
557 @echo
"The present kernel configuration has modules disabled."
558 @echo
"Type 'make config' and enable loadable module support."
559 @echo
"Then build a kernel with module support enabled."
563 endif # CONFIG_MODULES
565 # Generate asm-offsets.h
566 # ---------------------------------------------------------------------------
568 define filechk_gen-asm-offsets
570 echo
"#ifndef __ASM_OFFSETS_H__"; \
571 echo
"#define __ASM_OFFSETS_H__"; \
573 echo
" * DO NOT MODIFY."; \
575 echo
" * This file was generated by arch/$(ARCH)/Makefile"; \
579 sed
-ne
"/^->/{s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}"; \
584 else # ifdef include_config
586 ifeq ($(filter-out $(noconfig_targets
),$(MAKECMDGOALS
)),)
588 # Targets which don't need .config
589 # ===========================================================================
591 # These targets basically have their own Makefile - not quite, but at
592 # least its own exclusive section in the same Makefile. The reason for
593 # this is the following:
594 # To know the configuration, the main Makefile has to include
595 # .config. That's a obviously a problem when .config doesn't exist
596 # yet, but that could be kludged around with only including it if it
598 # However, the larger problem is: If you run make *config, make will
599 # include the old .config, then execute your *config. It will then
600 # notice that a piece it included (.config) did change and restart from
601 # scratch. Which will cause execution of *config again. You get the
603 # If we don't explicitly let the Makefile know that .config is changed
604 # by *config (the old way), it won't reread .config after *config,
605 # thus working with possibly stale values - we don't that either.
607 # So we divide things: This part here is for making *config targets,
608 # and other targets which should work when no .config exists yet.
609 # The main part above takes care of the rest after a .config exists.
611 # Kernel configuration
612 # ---------------------------------------------------------------------------
614 .PHONY
: oldconfig xconfig gconfig menuconfig config \
617 scripts
/kconfig
/conf scripts
/kconfig
/mconf scripts
/kconfig
/qconf scripts
/kconfig
/gconf
: scripts
/fixdep FORCE
618 $(Q
)$(MAKE
) $(build
)=scripts
/kconfig
$@
620 xconfig
: scripts
/kconfig
/qconf
621 .
/scripts
/kconfig
/qconf arch
/$(ARCH
)/Kconfig
623 gconfig
: scripts
/kconfig
/gconf
624 .
/scripts
/kconfig
/gconf arch
/$(ARCH
)/Kconfig
626 menuconfig
: scripts
/kconfig
/mconf
627 $(Q
)$(MAKE
) $(build
)=scripts
/lxdialog
628 .
/scripts
/kconfig
/mconf arch
/$(ARCH
)/Kconfig
630 config
: scripts
/kconfig
/conf
631 .
/scripts
/kconfig
/conf arch
/$(ARCH
)/Kconfig
633 oldconfig
: scripts
/kconfig
/conf
634 .
/scripts
/kconfig
/conf
-o arch
/$(ARCH
)/Kconfig
636 randconfig
: scripts
/kconfig
/conf
637 .
/scripts
/kconfig
/conf
-r arch
/$(ARCH
)/Kconfig
639 allyesconfig
: scripts
/kconfig
/conf
640 .
/scripts
/kconfig
/conf
-y arch
/$(ARCH
)/Kconfig
642 allnoconfig
: scripts
/kconfig
/conf
643 .
/scripts
/kconfig
/conf
-n arch
/$(ARCH
)/Kconfig
645 allmodconfig
: scripts
/kconfig
/conf
646 .
/scripts
/kconfig
/conf
-m arch
/$(ARCH
)/Kconfig
648 defconfig
: scripts
/kconfig
/conf
649 .
/scripts
/kconfig
/conf
-d arch
/$(ARCH
)/Kconfig
652 # Cleaning is done on three levels.
653 # make clean Delete all automatically generated files, including
654 # tools and firmware.
655 # make mrproper Delete the current configuration, and related files
656 # Any core files spread around are deleted as well
657 # make distclean Remove editor backup files, patch leftover files and the like
659 # Files removed with 'make clean'
660 CLEAN_FILES
+= vmlinux System.map MC
*
662 # Files removed with 'make mrproper'
664 include/linux
/autoconf.h
include/linux
/version.h \
665 .version .config .config.old config.in config.old \
668 .hdepend
include/linux
/modversions.h \
669 tags TAGS cscope kernel.spec \
672 # Directories removed with 'make mrproper'
677 include/linux
/modules
679 # clean - Delete all intermediate files
681 clean-dirs
+= $(addprefix _clean_
,$(ALL_SUBDIRS
) Documentation
/DocBook scripts
)
682 .PHONY
: $(clean-dirs
) clean archclean mrproper archmrproper
distclean
684 $(Q
)$(MAKE
) $(clean)=$(patsubst _clean_
%,%,$@
)
686 quiet_cmd_rmclean
= RM
$$(CLEAN_FILES
)
687 cmd_rmclean
= rm -f
$(CLEAN_FILES
)
688 clean: archclean
$(clean-dirs
)
690 @find .
$(RCS_FIND_IGNORE
) \
691 \
( -name
'*.[oas]' -o
-name
'*.ko' -o
-name
'.*.cmd' \
692 -o
-name
'.*.d' -o
-name
'.*.tmp' -o
-name
'*.mod.c' \
) \
693 -type f
-print | xargs
rm -f
695 # mrproper - delete configuration + modules + core files
697 quiet_cmd_mrproper
= RM
$$(MRPROPER_DIRS
) + $$(MRPROPER_FILES
)
698 cmd_mrproper
= rm -rf
$(MRPROPER_DIRS
) && rm -f
$(MRPROPER_FILES
)
699 mrproper
distclean: clean archmrproper
700 @echo
' Making $@ in the srctree'
701 @find .
$(RCS_FIND_IGNORE
) \
702 \
( -name
'*.orig' -o
-name
'*.rej' -o
-name
'*~' \
703 -o
-name
'*.bak' -o
-name
'#*#' -o
-name
'.*.orig' \
704 -o
-name
'.*.rej' -o
-size
0 \
705 -o
-name
'*%' -o
-name
'.*.cmd' -o
-name
'core' \
) \
706 -type f
-print | xargs
rm -f
709 # Generate tags for editors
710 # ---------------------------------------------------------------------------
713 ( find .
$(RCS_FIND_IGNORE
) \
714 \
( -name
include -o
-name arch \
) -prune
-o \
715 -name
'*.[chS]' -print; \
716 find arch
/$(ARCH
) $(RCS_FIND_IGNORE
) \
717 -name
'*.[chS]' -print; \
718 find
include $(RCS_FIND_IGNORE
) \
719 \
( -name config
-o
-name
'asm-*' \
) -prune \
720 -o
-name
'*.[chS]' -print; \
721 find
include/asm-
$(ARCH
) $(RCS_FIND_IGNORE
) \
722 -name
'*.[chS]' -print; \
723 find
include/asm-generic
$(RCS_FIND_IGNORE
) \
724 -name
'*.[chS]' -print )
727 quiet_cmd_cscope
= MAKE
$@
728 cmd_cscope
= $(all-sources
) | cscope
-k
-b
-i
-
730 quiet_cmd_TAGS
= MAKE
$@
731 cmd_TAGS
= $(all-sources
) | etags
-
733 # Exuberant ctags works better with -I
735 quiet_cmd_tags
= MAKE
$@
738 CTAGSF
=`ctags --version | grep -i exuberant >/dev/null && echo "-I __initdata,__exitdata,EXPORT_SYMBOL,EXPORT_SYMBOL_NOVERS"`; \
739 $(all-sources
) | xargs ctags
$$CTAGSF -a
752 # ---------------------------------------------------------------------------
754 # If you do a make spec before packing the tarball you can rpm -ta it
757 .
$(srctree
)/scripts
/mkspec
>kernel.spec
759 # Build a tar ball, generate an rpm from it and pack the result
760 # There are two bits of magic here
761 # 1) The use of /. to avoid tar packing just the symlink
762 # 2) Removing the .dep files as they have source paths in them that
763 # will become invalid
766 find .
$(RCS_FIND_IGNORE
) \
767 \
( -size
0 -o
-name .depend
-o
-name .hdepend \
) \
768 -type f
-print | xargs
rm -f
771 ln
-sf
$(TOPDIR
) $(KERNELPATH
) ; \
772 tar -cvz
$(RCS_TAR_IGNORE
) -f
$(KERNELPATH
).
tar.gz
$(KERNELPATH
)/.
; \
775 $(CONFIG_SHELL
) $(srctree
)/scripts
/mkversion
> .version
; \
776 $(RPM
) -ta
$(TOPDIR
)/..
/$(KERNELPATH
).
tar.gz
; \
777 rm $(TOPDIR
)/..
/$(KERNELPATH
).
tar.gz
779 # Brief documentation of the typical targets used
780 # ---------------------------------------------------------------------------
783 @echo
'Cleaning targets:'
784 @echo
' clean - remove most generated files but keep the config'
785 @echo
' mrproper - remove all generated files + config + various backup files'
787 @echo
'Configuration targets:'
788 @echo
' oldconfig - Update current config utilising a line-oriented program'
789 @echo
' menuconfig - Update current config utilising a menu based program'
790 @echo
' xconfig - Update current config utilising a X-based program'
791 @echo
' defconfig - New config with default answer to all options'
792 @echo
' allmodconfig - New config selecting modules when possible'
793 @echo
' allyesconfig - New config where all options are accepted with yes'
794 @echo
' allnoconfig - New minimal config'
796 @echo
'Other generic targets:'
797 @echo
' all - Build all targets marked with [*]'
798 @echo
'* vmlinux - Build the bare kernel'
799 @echo
'* modules - Build all modules'
800 @echo
' dir/file.[ois]- Build specified target only'
801 @echo
' rpm - Build a kernel as an RPM package'
802 @echo
' tags/TAGS - Generate tags file for editors'
804 @echo
'Documentation targets:'
805 @
$(MAKE
) --no-print-directory
-f Documentation
/DocBook
/Makefile dochelp
807 @echo
'Architecture specific targets ($(ARCH)):'
808 @
$(if
$(archhelp
),$(archhelp
),\
809 echo
' No architecture specific help defined for $(ARCH)')
811 @echo
'Execute "make" or "make all" to build all targets marked with [*] '
812 @echo
'For further info browse Documentation/kbuild/*'
815 # Documentation targets
816 # ---------------------------------------------------------------------------
817 sgmldocs psdocs pdfdocs htmldocs
: scripts
/docproc FORCE
818 $(Q
)$(MAKE
) $(build
)=Documentation
/DocBook
$@
820 # Scripts to check various things for consistency
821 # ---------------------------------------------------------------------------
824 find
* $(RCS_FIND_IGNORE
) \
825 -name
'*.[hcS]' -type f
-print |
sort \
826 | xargs
$(PERL
) -w scripts
/checkconfig.pl
829 find
* $(RCS_FIND_IGNORE
) \
830 -name
'*.[hcS]' -type f
-print |
sort \
831 | xargs
$(PERL
) -w scripts
/checkincludes.pl
833 else # ifneq ($(filter-out $(noconfig_targets),$(MAKECMDGOALS)),)
835 # We're called with both targets which do and do not need
836 # .config included. Handle them one after the other.
837 # ===========================================================================
842 endif # ifeq ($(filter-out $(noconfig_targets),$(MAKECMDGOALS)),)
843 endif # ifdef include_config
845 # FIXME Should go into a make.lib or something
846 # ===========================================================================
848 a_flags
= -Wp
,-MD
,$(depfile
) $(AFLAGS
) $(AFLAGS_KERNEL
) $(NOSTDINC_FLAGS
) \
849 $(modkern_aflags
) $(EXTRA_AFLAGS
) $(AFLAGS_
$(*F
).o
)
851 quiet_cmd_as_s_S
= CPP
$@
852 cmd_as_s_S
= $(CPP
) $(a_flags
) -o
$@
$<
854 quiet_cmd_as_o_S
= AS
$@
855 cmd_as_o_S
= $(CC
) $(a_flags
) -c
-o
$@
$<
857 # read all saved command lines
859 targets
:= $(wildcard $(sort $(targets
)))
860 cmd_files
:= $(wildcard .
*.cmd
$(foreach f
,$(targets
),$(dir $(f
)).
$(notdir $(f
)).cmd
))
862 ifneq ($(cmd_files
),)
866 # execute the command and also postprocess generated .d dependencies
869 if_changed_dep
= $(if
$(strip $?
$(filter-out FORCE
$(wildcard $^
),$^
)\
870 $(filter-out $(cmd_
$(1)),$(cmd_
$@
))\
871 $(filter-out $(cmd_
$@
),$(cmd_
$(1)))),\
873 $(if
$($(quiet
)cmd_
$(1)),echo
' $(subst ','\'',$($(quiet
)cmd_
$(1)))';) \
875 scripts/fixdep $(depfile) $@ '$(subst $$,$$$$,$(subst ','\'',$(cmd_$(1))))' > $(@D
)/.
$(@F
).tmp
; \
877 mv
-f
$(@D
)/.
$(@F
).tmp
$(@D
)/.
$(@F
).cmd
)
879 # Usage: $(call if_changed_rule,foo)
880 # will check if $(cmd_foo) changed, or any of the prequisites changed,
881 # and if so will execute $(rule_foo)
883 if_changed_rule
= $(if
$(strip $? \
884 $(filter-out $(cmd_
$(1)),$(cmd_
$(@F
)))\
885 $(filter-out $(cmd_
$(@F
)),$(cmd_
$(1)))),\
888 # If quiet is set, only print short version of command
890 cmd
= @
$(if
$($(quiet
)cmd_
$(1)),echo
' $($(quiet)cmd_$(1))' &&) $(cmd_
$(1))
892 # filechk is used to check if the content of a generated file is updated.
894 # define filechk_sample
895 # echo $KERNELRELEASE
897 # version.h : Makefile
898 # $(call filechk,sample)
899 # The rule defined shall write to stdout the content of the new file.
900 # The existing file will be compared with the new one.
901 # - If no file exist it is created
902 # - If the content differ the new file is used
903 # - If they are equal no change, and no timestamp update
908 $(filechk_
$(1)) < $< > $@.tmp
; \
909 if
[ -r
$@
] && cmp
-s
$@
$@.tmp
; then \
917 # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.build obj=dir
919 # $(Q)$(MAKE) $(build)=dir
920 build
:= -f scripts
/Makefile.build obj
922 # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.clean obj=dir
924 # $(Q)$(MAKE) $(clean)=dir
925 clean := -f scripts
/Makefile.
clean obj
927 # $(call descend,<dir>,<target>)
928 # Recursively call a sub-make in <dir> with target <target>
929 # Usage is deprecated, because make does not see this as an invocation of make.
930 descend
=$(Q
)$(MAKE
) -f scripts
/Makefile.build obj
=$(1) $(2)