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/ \
37 -e s/arm.*/arm/ -e s/sa110/arm/ \
41 # Remove hyphens since they have special meaning in RPM filenames
42 KERNELPATH=kernel-$(subst -,,$(KERNELRELEASE))
44 UTS_MACHINE := $(ARCH)
46 CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
47 else if [ -x /bin/bash ]; then echo /bin/bash; \
48 else echo sh; fi ; fi)
53 HOSTCFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
58 # That's our default target when none is given on the command line
59 # Note that 'modules' will be added as a prerequisite as well,
60 # in the CONFIG_MODULES part below
64 # Decide whether to build built-in, modular, or both.
65 # Normally, just do built-in.
70 # If we have only "make modules", don't compile built-in objects.
72 ifeq ($(MAKECMDGOALS),modules)
76 # If we have "make <whatever> modules", compile modules
77 # in addition to whatever we do anyway.
79 ifneq ($(filter modules,$(MAKECMDGOALS)),)
83 # Just "make" or "make all" shall build modules as well
85 ifeq ($(MAKECMDGOALS),)
89 ifneq ($(filter all,$(MAKECMDGOALS)),)
93 export KBUILD_MODULES KBUILD_BUILTIN KBUILD_VERBOSE
96 # ---------------------------------------------------------------------------
98 # Normally, we echo the whole command before executing it. By making
99 # that echo $($(quiet)$(cmd)), we now have the possibility to set
100 # $(quiet) to choose other forms of output instead, e.g.
102 # quiet_cmd_cc_o_c = Compiling $(RELDIR)/$@
103 # cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $<
105 # If $(quiet) is empty, the whole command will be printed.
106 # If it is set to "quiet_", only the short version will be printed.
107 # If it is set to "silent_", nothing wil be printed at all, since
108 # the variable $(silent_cmd_cc_o_c) doesn't exist.
110 # For now, leave verbose as default
113 ifeq ("$(origin V)", "command line")
114 KBUILD_VERBOSE = $(V)
117 ifndef KBUILD_VERBOSE
121 MAKEFLAGS += --no-print-directory
123 # For maximum performance (+ possibly random breakage, uncomment
128 # If the user wants quiet mode, echo short versions of the commands
131 ifeq ($(KBUILD_VERBOSE),1)
139 # If the user is running make -s (silent mode), suppress echoing of
142 ifneq ($(findstring s,$(MAKEFLAGS)),)
146 export quiet Q KBUILD_VERBOSE
148 # Paths to obj / src tree
155 export srctree objtree
157 # Make variables (CC, etc...)
159 AS = $(CROSS_COMPILE)as
160 LD = $(CROSS_COMPILE)ld
161 CC = $(CROSS_COMPILE)gcc
163 AR = $(CROSS_COMPILE)ar
164 NM = $(CROSS_COMPILE)nm
165 STRIP = $(CROSS_COMPILE)strip
166 OBJCOPY = $(CROSS_COMPILE)objcopy
167 OBJDUMP = $(CROSS_COMPILE)objdump
169 RPM := $(shell if [ -x "/usr/bin/rpmbuild" ]; then echo rpmbuild; \
171 GENKSYMS = scripts/genksyms/genksyms
172 DEPMOD = /sbin/depmod
173 KALLSYMS = scripts/kallsyms
176 CFLAGS_MODULE = $(MODFLAGS)
177 AFLAGS_MODULE = $(MODFLAGS)
182 NOSTDINC_FLAGS = -nostdinc -iwithprefix include
184 CPPFLAGS := -D__KERNEL__ -Iinclude
185 CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes -Wno-trigraphs -O2 \
186 -fno-strict-aliasing -fno-common
187 AFLAGS := -D__ASSEMBLY__ $(CPPFLAGS)
189 export VERSION PATCHLEVEL SUBLEVEL EXTRAVERSION KERNELRELEASE ARCH \
190 CONFIG_SHELL TOPDIR HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC \
191 CPP AR NM STRIP OBJCOPY OBJDUMP MAKE AWK GENKSYMS PERL UTS_MACHINE \
192 HOSTCXX HOSTCXXFLAGS LDFLAGS_BLOB LDFLAGS_MODULE
194 export CPPFLAGS NOSTDINC_FLAGS OBJCOPYFLAGS LDFLAGS
195 export CFLAGS CFLAGS_KERNEL CFLAGS_MODULE
196 export AFLAGS AFLAGS_KERNEL AFLAGS_MODULE
198 export MODVERDIR := .tmp_versions
200 # The temporary file to save gcc -MD generated dependencies must not
203 depfile = $(subst $(comma),_,$(@D)/.$(@F).d)
205 noconfig_targets := xconfig gconfig menuconfig config oldconfig randconfig \
206 defconfig allyesconfig allnoconfig allmodconfig \
207 clean mrproper distclean rpm \
208 help tags TAGS cscope sgmldocs psdocs pdfdocs htmldocs \
209 checkconfig checkhelp checkincludes
211 RCS_FIND_IGNORE := \( -name SCCS -o -name BitKeeper -o -name .svn -o -name CVS \) -prune -o
212 RCS_TAR_IGNORE := --exclude SCCS --exclude BitKeeper --exclude .svn --exclude CVS
214 # Helpers built in scripts/
215 # ---------------------------------------------------------------------------
217 scripts/docproc scripts/fixdep scripts/split-include : scripts ;
221 $(Q)$(MAKE) $(build)=scripts
223 # Objects we will link into vmlinux / subdirs we need to visit
224 # ---------------------------------------------------------------------------
227 drivers-y := drivers/ sound/
233 ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
235 export include_config := 1
241 include arch/$(ARCH)/Makefile
243 core-y += kernel/ mm/ fs/ ipc/ security/ crypto/
245 SUBDIRS += $(patsubst %/,%,$(filter %/, $(init-y) $(init-m) \
246 $(core-y) $(core-m) $(drivers-y) $(drivers-m) \
247 $(net-y) $(net-m) $(libs-y) $(libs-m)))
249 ALL_SUBDIRS := $(sort $(SUBDIRS) $(patsubst %/,%,$(filter %/, \
251 $(core-n) $(core-) $(drivers-n) $(drivers-) \
252 $(net-n) $(net-) $(libs-n) $(libs-))))
254 init-y := $(patsubst %/, %/built-in.o, $(init-y))
255 core-y := $(patsubst %/, %/built-in.o, $(core-y))
256 drivers-y := $(patsubst %/, %/built-in.o, $(drivers-y))
257 net-y := $(patsubst %/, %/built-in.o, $(net-y))
258 libs-y := $(patsubst %/, %/lib.a, $(libs-y))
262 # Here goes the main Makefile
263 # ===========================================================================
265 # If the user gave a *config target, it'll be handled in another
266 # section below, since in this case we cannot include .config
267 # Same goes for other targets like clean/mrproper etc, which
268 # don't need .config, either
270 # In this section, we need .config
274 ifndef CONFIG_FRAME_POINTER
275 CFLAGS += -fomit-frame-pointer
278 # When we're building modules with modversions, we need to consider
279 # the built-in objects during the descend as well, in order to
280 # make sure the checksums are uptodate before we record them.
282 ifdef CONFIG_MODVERSIONS
283 ifeq ($(KBUILD_MODULES),1)
284 ifneq ($(KBUILD_BUILTIN),1)
291 # INSTALL_PATH specifies where to place the updated kernel and system map
292 # images. Uncomment if you want to place them anywhere other than root.
295 #export INSTALL_PATH=/boot
298 # INSTALL_MOD_PATH specifies a prefix to MODLIB for module directory
299 # relocations required by build roots. This is not defined in the
300 # makefile but the arguement can be passed to make if needed.
303 MODLIB := $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE)
307 # ---------------------------------------------------------------------------
309 # This is a bit tricky: If we need to relink vmlinux, we want
310 # the version number incremented, which means recompile init/version.o
311 # and relink init/init.o. However, we cannot do this during the
312 # normal descending-into-subdirs phase, since at that time
313 # we cannot yet know if we will need to relink vmlinux.
314 # So we descend into init/ inside the rule for vmlinux again.
316 vmlinux-objs := $(head-y) $(init-y) $(core-y) $(libs-y) $(drivers-y) $(net-y)
318 quiet_cmd_vmlinux__ = LD $@
320 $(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) $(head-y) $(init-y) \
327 $(filter .tmp_kallsyms%,$^) \
331 # set -e makes the rule exit immediately on error
333 define rule_vmlinux__
335 $(if $(filter .tmp_kallsyms%,$^),, \
336 echo ' GEN .version'; \
337 . $(srctree)/scripts/mkversion > .tmp_version; \
338 mv -f .tmp_version .version; \
339 $(MAKE) $(build)=init; \
341 $(if $($(quiet)cmd_vmlinux__), \
342 echo ' $($(quiet)cmd_vmlinux__)' &&) \
344 echo 'cmd_$@ := $(cmd_vmlinux__)' > $(@D)/.$(@F).cmd
349 $(NM) $@ | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | sort > System.map
352 LDFLAGS_vmlinux += -T arch/$(ARCH)/vmlinux.lds.s
354 # Generate section listing all symbols and add it into vmlinux
355 # It's a three stage process:
356 # o .tmp_vmlinux1 has all symbols and sections, but __kallsyms is
358 # Running kallsyms on that gives us .tmp_kallsyms1.o with
360 # o .tmp_vmlinux2 now has a __kallsyms section of the right size,
361 # but due to the added section, some addresses have shifted
362 # From here, we generate a correct .tmp_kallsyms2.o
363 # o The correct .tmp_kallsyms2.o is linked into the final vmlinux.
365 ifdef CONFIG_KALLSYMS
367 kallsyms.o := .tmp_kallsyms2.o
369 quiet_cmd_kallsyms = KSYM $@
370 cmd_kallsyms = $(NM) -n $< | scripts/kallsyms > $@
372 .tmp_kallsyms1.o .tmp_kallsyms2.o: %.o: %.S scripts FORCE
373 $(call if_changed_dep,as_o_S)
375 .tmp_kallsyms%.S: .tmp_vmlinux%
378 .tmp_vmlinux1: $(vmlinux-objs) arch/$(ARCH)/vmlinux.lds.s FORCE
379 +$(call if_changed_rule,vmlinux__)
381 .tmp_vmlinux2: $(vmlinux-objs) .tmp_kallsyms1.o arch/$(ARCH)/vmlinux.lds.s FORCE
382 $(call if_changed_rule,vmlinux__)
386 # Finally the vmlinux rule
388 vmlinux: $(vmlinux-objs) $(kallsyms.o) arch/$(ARCH)/vmlinux.lds.s FORCE
389 $(call if_changed_rule,vmlinux)
391 # The actual objects are generated when descending,
392 # make sure no implicit rule kicks in
394 $(sort $(vmlinux-objs)): $(SUBDIRS) ;
396 # Handle descending into subdirectories listed in $(SUBDIRS)
400 $(Q)$(MAKE) $(build)=$@
402 # Things we need done before we descend to build or make
403 # module versions are listed in "prepare"
406 prepare: include/linux/version.h include/asm include/config/MARKER
408 ifeq ($(origin SUBDIRS),file)
409 $(Q)rm -rf $(MODVERDIR)
411 @echo '*** Warning: Overriding SUBDIRS on the command line can cause'
412 @echo '*** inconsistencies'
414 $(Q)mkdir -p $(MODVERDIR)
416 @echo ' Starting the build. KBUILD_BUILTIN=$(KBUILD_BUILTIN) KBUILD_MODULES=$(KBUILD_MODULES)'
418 # This can be used by arch/$ARCH/Makefile to preprocess
419 # their vmlinux.lds.S file
421 AFLAGS_vmlinux.lds.o += -P -C -U$(ARCH)
423 arch/$(ARCH)/vmlinux.lds.s: %.s: %.S scripts FORCE
424 $(call if_changed_dep,as_s_S)
426 targets += arch/$(ARCH)/vmlinux.lds.s
429 # ---------------------------------------------------------------------------
431 %.s: %.c scripts FORCE
432 $(Q)$(MAKE) $(build)=$(@D) $@
433 %.i: %.c scripts FORCE
434 $(Q)$(MAKE) $(build)=$(@D) $@
435 %.o: %.c scripts FORCE
436 $(Q)$(MAKE) $(build)=$(@D) $@
437 %/: scripts prepare FORCE
438 $(Q)$(MAKE) $(build)=$(@D)
440 $(Q)$(MAKE) $(build)=$(@D) $@
441 %.lst: %.c scripts FORCE
442 $(Q)$(MAKE) $(build)=$(@D) $@
443 %.s: %.S scripts FORCE
444 $(Q)$(MAKE) $(build)=$(@D) $@
445 %.o: %.S scripts FORCE
446 $(Q)$(MAKE) $(build)=$(@D) $@
448 # FIXME: The asm symlink changes when $(ARCH) changes. That's
449 # hard to detect, but I suppose "make mrproper" is a good idea
450 # before switching between archs anyway.
453 @echo ' Making asm->asm-$(ARCH) symlink'
454 @ln -s asm-$(ARCH) $@
456 # Split autoconf.h into include/linux/config/*
458 include/config/MARKER: scripts/split-include include/linux/autoconf.h
459 @echo ' SPLIT include/linux/autoconf.h -> include/config/*'
460 @scripts/split-include include/linux/autoconf.h include/config
463 # if .config is newer than include/linux/autoconf.h, someone tinkered
464 # with it and forgot to run make oldconfig
466 include/linux/autoconf.h: .config scripts/fixdep
467 $(Q)$(MAKE) $(build)=scripts/kconfig scripts/kconfig/conf
468 ./scripts/kconfig/conf -s arch/$(ARCH)/Kconfig
470 # Generate some files
471 # ---------------------------------------------------------------------------
473 # version.h changes when $(KERNELRELEASE) etc change, as defined in
478 define filechk_version.h
479 if expr length "$(KERNELRELEASE)" \> $(uts_len) >/dev/null ; then \
480 echo '"$(KERNELRELEASE)" exceeds $(uts_len) characters' >&2; \
483 (echo \#define UTS_RELEASE \"$(KERNELRELEASE)\"; \
484 echo \#define LINUX_VERSION_CODE `expr $(VERSION) \\* 65536 + $(PATCHLEVEL) \\* 256 + $(SUBLEVEL)`; \
485 echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))'; \
489 include/linux/version.h: Makefile
490 $(call filechk,version.h)
492 # ---------------------------------------------------------------------------
496 @echo '*** Warning: make $@ is unnecessary now.'
498 # ---------------------------------------------------------------------------
503 # By default, build modules as well
510 modules: $(SUBDIRS) $(if $(KBUILD_BUILTIN),vmlinux)
511 @echo ' Building modules, stage 2.';
512 $(Q)$(MAKE) -rR -f scripts/Makefile.modpost
516 .PHONY: modules_install
517 modules_install: _modinst_ _modinst_post
521 @rm -rf $(MODLIB)/kernel
522 @rm -f $(MODLIB)/build
523 @mkdir -p $(MODLIB)/kernel
524 @ln -s $(TOPDIR) $(MODLIB)/build
525 $(Q)$(MAKE) -rR -f scripts/Makefile.modinst
527 # If System.map exists, run depmod. This deliberately does not have a
528 # dependency on System.map since that would run the dependency tree on
529 # vmlinux. This depmod is only for convenience to give the initial
530 # boot a modules.dep even before / is mounted read-write. However the
531 # boot script depmod is the master version.
532 ifeq "$(strip $(INSTALL_MOD_PATH))" ""
535 depmod_opts := -b $(INSTALL_MOD_PATH) -r
537 .PHONY: _modinst_post
538 _modinst_post: _modinst_
539 if [ -r System.map ]; then $(DEPMOD) -ae -F System.map $(depmod_opts) $(KERNELRELEASE); fi
541 else # CONFIG_MODULES
543 # Modules not configured
544 # ---------------------------------------------------------------------------
546 modules modules_install: FORCE
548 @echo "The present kernel configuration has modules disabled."
549 @echo "Type 'make config' and enable loadable module support."
550 @echo "Then build a kernel with module support enabled."
554 endif # CONFIG_MODULES
556 # Generate asm-offsets.h
557 # ---------------------------------------------------------------------------
559 define filechk_gen-asm-offsets
561 echo "#ifndef __ASM_OFFSETS_H__"; \
562 echo "#define __ASM_OFFSETS_H__"; \
564 echo " * DO NOT MODIFY."; \
566 echo " * This file was generated by arch/$(ARCH)/Makefile"; \
570 sed -ne "/^->/{s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}"; \
575 else # ifdef include_config
577 ifeq ($(filter-out $(noconfig_targets),$(MAKECMDGOALS)),)
579 # Targets which don't need .config
580 # ===========================================================================
582 # These targets basically have their own Makefile - not quite, but at
583 # least its own exclusive section in the same Makefile. The reason for
584 # this is the following:
585 # To know the configuration, the main Makefile has to include
586 # .config. That's a obviously a problem when .config doesn't exist
587 # yet, but that could be kludged around with only including it if it
589 # However, the larger problem is: If you run make *config, make will
590 # include the old .config, then execute your *config. It will then
591 # notice that a piece it included (.config) did change and restart from
592 # scratch. Which will cause execution of *config again. You get the
594 # If we don't explicitly let the Makefile know that .config is changed
595 # by *config (the old way), it won't reread .config after *config,
596 # thus working with possibly stale values - we don't that either.
598 # So we divide things: This part here is for making *config targets,
599 # and other targets which should work when no .config exists yet.
600 # The main part above takes care of the rest after a .config exists.
602 # Kernel configuration
603 # ---------------------------------------------------------------------------
605 .PHONY: oldconfig xconfig gconfig menuconfig config \
608 scripts/kconfig/conf scripts/kconfig/mconf scripts/kconfig/qconf scripts/kconfig/gconf: scripts/fixdep FORCE
609 $(Q)$(MAKE) $(build)=scripts/kconfig $@
611 xconfig: scripts/kconfig/qconf
612 ./scripts/kconfig/qconf arch/$(ARCH)/Kconfig
614 gconfig: scripts/kconfig/gconf
615 ./scripts/kconfig/gconf arch/$(ARCH)/Kconfig
617 menuconfig: scripts/kconfig/mconf
618 $(Q)$(MAKE) $(build)=scripts/lxdialog
619 ./scripts/kconfig/mconf arch/$(ARCH)/Kconfig
621 config: scripts/kconfig/conf
622 ./scripts/kconfig/conf arch/$(ARCH)/Kconfig
624 oldconfig: scripts/kconfig/conf
625 ./scripts/kconfig/conf -o arch/$(ARCH)/Kconfig
627 randconfig: scripts/kconfig/conf
628 ./scripts/kconfig/conf -r arch/$(ARCH)/Kconfig
630 allyesconfig: scripts/kconfig/conf
631 ./scripts/kconfig/conf -y arch/$(ARCH)/Kconfig
633 allnoconfig: scripts/kconfig/conf
634 ./scripts/kconfig/conf -n arch/$(ARCH)/Kconfig
636 allmodconfig: scripts/kconfig/conf
637 ./scripts/kconfig/conf -m arch/$(ARCH)/Kconfig
639 defconfig: scripts/kconfig/conf
640 ./scripts/kconfig/conf -d arch/$(ARCH)/Kconfig
643 # Cleaning is done on three levels.
644 # make clean Delete all automatically generated files, including
645 # tools and firmware.
646 # make mrproper Delete the current configuration, and related files
647 # Any core files spread around are deleted as well
648 # make distclean Remove editor backup files, patch leftover files and the like
650 # Files removed with 'make clean'
651 CLEAN_FILES += vmlinux System.map MC*
653 # Files removed with 'make mrproper'
655 include/linux/autoconf.h include/linux/version.h \
656 .version .config .config.old config.in config.old \
659 .hdepend include/linux/modversions.h \
660 tags TAGS cscope kernel.spec \
663 # Directories removed with 'make mrproper'
668 include/linux/modules
670 # clean - Delete all intermediate files
672 clean-dirs += $(addprefix _clean_,$(ALL_SUBDIRS) Documentation/DocBook scripts)
673 .PHONY: $(clean-dirs) clean archclean mrproper archmrproper distclean
675 $(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@)
677 quiet_cmd_rmclean = RM $$(CLEAN_FILES)
678 cmd_rmclean = rm -f $(CLEAN_FILES)
679 clean: archclean $(clean-dirs)
681 @find . $(RCS_FIND_IGNORE) \
682 \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \
683 -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \) \
684 -type f -print | xargs rm -f
686 # mrproper - delete configuration + modules + core files
688 quiet_cmd_mrproper = RM $$(MRPROPER_DIRS) + $$(MRPROPER_FILES)
689 cmd_mrproper = rm -rf $(MRPROPER_DIRS) && rm -f $(MRPROPER_FILES)
690 mrproper distclean: clean archmrproper
691 @echo ' Making $@ in the srctree'
692 @find . $(RCS_FIND_IGNORE) \
693 \( -name '*.orig' -o -name '*.rej' -o -name '*~' \
694 -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
695 -o -name '.*.rej' -o -size 0 \
696 -o -name '*%' -o -name '.*.cmd' -o -name 'core' \) \
697 -type f -print | xargs rm -f
700 # Generate tags for editors
701 # ---------------------------------------------------------------------------
704 ( find . $(RCS_FIND_IGNORE) \
705 \( -name include -o -name arch \) -prune -o \
706 -name '*.[chS]' -print; \
707 find arch/$(ARCH) $(RCS_FIND_IGNORE) \
708 -name '*.[chS]' -print; \
709 find include $(RCS_FIND_IGNORE) \
710 \( -name config -o -name 'asm-*' \) -prune \
711 -o -name '*.[chS]' -print; \
712 find include/asm-$(ARCH) $(RCS_FIND_IGNORE) \
713 -name '*.[chS]' -print; \
714 find include/asm-generic $(RCS_FIND_IGNORE) \
715 -name '*.[chS]' -print )
718 quiet_cmd_cscope = MAKE $@
719 cmd_cscope = $(all-sources) | cscope -k -b -i -
721 quiet_cmd_TAGS = MAKE $@
722 cmd_TAGS = $(all-sources) | etags -
724 # Exuberant ctags works better with -I
726 quiet_cmd_tags = MAKE $@
729 CTAGSF=`ctags --version | grep -i exuberant >/dev/null && echo "-I __initdata,__exitdata,EXPORT_SYMBOL,EXPORT_SYMBOL_NOVERS"`; \
730 $(all-sources) | xargs ctags $$CTAGSF -a
743 # ---------------------------------------------------------------------------
745 # If you do a make spec before packing the tarball you can rpm -ta it
748 . $(srctree)/scripts/mkspec >kernel.spec
750 # Build a tar ball, generate an rpm from it and pack the result
751 # There are two bits of magic here
752 # 1) The use of /. to avoid tar packing just the symlink
753 # 2) Removing the .dep files as they have source paths in them that
754 # will become invalid
757 find . $(RCS_FIND_IGNORE) \
758 \( -size 0 -o -name .depend -o -name .hdepend \) \
759 -type f -print | xargs rm -f
762 ln -sf $(TOPDIR) $(KERNELPATH) ; \
763 tar -cvz $(RCS_TAR_IGNORE) -f $(KERNELPATH).tar.gz $(KERNELPATH)/. ; \
766 $(CONFIG_SHELL) $(srctree)/scripts/mkversion > .version ; \
767 $(RPM) -ta $(TOPDIR)/../$(KERNELPATH).tar.gz ; \
768 rm $(TOPDIR)/../$(KERNELPATH).tar.gz
770 # Brief documentation of the typical targets used
771 # ---------------------------------------------------------------------------
774 @echo 'Cleaning targets:'
775 @echo ' clean - remove most generated files but keep the config'
776 @echo ' mrproper - remove all generated files + config + various backup files'
778 @echo 'Configuration targets:'
779 @echo ' oldconfig - Update current config utilising a line-oriented program'
780 @echo ' menuconfig - Update current config utilising a menu based program'
781 @echo ' xconfig - Update current config utilising a X-based program'
782 @echo ' defconfig - New config with default answer to all options'
783 @echo ' allmodconfig - New config selecting modules when possible'
784 @echo ' allyesconfig - New config where all options are accepted with yes'
785 @echo ' allnoconfig - New minimal config'
787 @echo 'Other generic targets:'
788 @echo ' all - Build all targets marked with [*]'
789 @echo '* vmlinux - Build the bare kernel'
790 @echo '* modules - Build all modules'
791 @echo ' dir/file.[ois]- Build specified target only'
792 @echo ' rpm - Build a kernel as an RPM package'
793 @echo ' tags/TAGS - Generate tags file for editors'
795 @echo 'Documentation targets:'
796 @$(MAKE) --no-print-directory -f Documentation/DocBook/Makefile dochelp
798 @echo 'Architecture specific targets ($(ARCH)):'
799 @$(if $(archhelp),$(archhelp),\
800 echo ' No architecture specific help defined for $(ARCH)')
802 @echo 'Execute "make" or "make all" to build all targets marked with [*] '
803 @echo 'For further info browse Documentation/kbuild/*'
806 # Documentation targets
807 # ---------------------------------------------------------------------------
808 sgmldocs psdocs pdfdocs htmldocs: scripts/docproc FORCE
809 $(Q)$(MAKE) $(build)=Documentation/DocBook $@
811 # Scripts to check various things for consistency
812 # ---------------------------------------------------------------------------
815 find * $(RCS_FIND_IGNORE) \
816 -name '*.[hcS]' -type f -print | sort \
817 | xargs $(PERL) -w scripts/checkconfig.pl
820 find * $(RCS_FIND_IGNORE) \
821 -name '*.[hcS]' -type f -print | sort \
822 | xargs $(PERL) -w scripts/checkincludes.pl
824 else # ifneq ($(filter-out $(noconfig_targets),$(MAKECMDGOALS)),)
826 # We're called with both targets which do and do not need
827 # .config included. Handle them one after the other.
828 # ===========================================================================
833 endif # ifeq ($(filter-out $(noconfig_targets),$(MAKECMDGOALS)),)
834 endif # ifdef include_config
836 # FIXME Should go into a make.lib or something
837 # ===========================================================================
839 a_flags = -Wp,-MD,$(depfile) $(AFLAGS) $(AFLAGS_KERNEL) $(NOSTDINC_FLAGS) \
840 $(modkern_aflags) $(EXTRA_AFLAGS) $(AFLAGS_$(*F).o)
842 quiet_cmd_as_s_S = CPP $@
843 cmd_as_s_S = $(CPP) $(a_flags) -o $@ $<
845 quiet_cmd_as_o_S = AS $@
846 cmd_as_o_S = $(CC) $(a_flags) -c -o $@ $<
848 # read all saved command lines
850 targets := $(wildcard $(sort $(targets)))
851 cmd_files := $(wildcard .*.cmd $(foreach f,$(targets),$(dir $(f)).$(notdir $(f)).cmd))
853 ifneq ($(cmd_files),)
857 # execute the command and also postprocess generated .d dependencies
860 if_changed_dep = $(if $(strip $? $(filter-out FORCE $(wildcard $^),$^)\
861 $(filter-out $(cmd_$(1)),$(cmd_$@))\
862 $(filter-out $(cmd_$@),$(cmd_$(1)))),\
864 $(if $($(quiet)cmd_$(1)),echo ' $(subst ','\'',$($(quiet)cmd_$(1)))';) \
866 scripts/fixdep $(depfile) $@ '$(subst $$,$$$$,$(subst ','\'',$(cmd_$(1))))' > $(@D)/.$(@F).tmp; \
868 mv -f $(@D)/.$(@F).tmp $(@D)/.$(@F).cmd)
870 # Usage: $(call if_changed_rule,foo)
871 # will check if $(cmd_foo) changed, or any of the prequisites changed,
872 # and if so will execute $(rule_foo)
874 if_changed_rule = $(if $(strip $? \
875 $(filter-out $(cmd_$(1)),$(cmd_$(@F)))\
876 $(filter-out $(cmd_$(@F)),$(cmd_$(1)))),\
879 # If quiet is set, only print short version of command
881 cmd = @$(if $($(quiet)cmd_$(1)),echo ' $($(quiet)cmd_$(1))' &&) $(cmd_$(1))
883 # filechk is used to check if the content of a generated file is updated.
885 # define filechk_sample
886 # echo $KERNELRELEASE
888 # version.h : Makefile
889 # $(call filechk,sample)
890 # The rule defined shall write to stdout the content of the new file.
891 # The existing file will be compared with the new one.
892 # - If no file exist it is created
893 # - If the content differ the new file is used
894 # - If they are equal no change, and no timestamp update
899 $(filechk_$(1)) < $< > $@.tmp; \
900 if [ -r $@ ] && cmp -s $@ $@.tmp; then \
908 # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.build obj=dir
910 # $(Q)$(MAKE) $(build)=dir
911 build := -f scripts/Makefile.build obj
913 # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.clean obj=dir
915 # $(Q)$(MAKE) $(clean)=dir
916 clean := -f scripts/Makefile.clean obj
918 # $(call descend,<dir>,<target>)
919 # Recursively call a sub-make in <dir> with target <target>
920 # Usage is deprecated, because make does not see this as an invocation of make.
921 descend =$(Q)$(MAKE) -f scripts/Makefile.build obj=$(1) $(2)