[PATCH] Add Zarlink MT312 DVB-T frontend driver
[linux-2.6/history.git] / Makefile
blob675c1fb88ceeb295aaa9a530584ea505654797b0
1 VERSION = 2
2 PATCHLEVEL = 6
3 SUBLEVEL = 0
4 EXTRAVERSION = -test1
6 # *DOCUMENTATION*
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
21 # is now up to date.
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
26 # prepare rule.
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/ \
38 -e s/s390x/s390/ -e s/parisc64/parisc/ )
40 # Remove hyphens since they have special meaning in RPM filenames
41 KERNELPATH=kernel-$(subst -,,$(KERNELRELEASE))
43 # Cross compiling and selecting different set of gcc/bin-utils
44 # ---------------------------------------------------------------------------
46 # When performing cross compilation for other architectures ARCH shall be set
47 # to the target architecture. (See arch/* for the possibilities).
48 # ARCH can be set during invocation of make:
49 # make ARCH=ia64
50 # Another way is to have ARCH set in the environment.
51 # The default ARCH is the host where make is executed.
53 # CROSS_COMPILE specify the prefix used for all executables used
54 # during compilation. Only gcc and related bin-utils executables
55 # are prefixed with $(CROSS_COMPILE).
56 # CROSS_COMPILE can be set on the command line
57 # make CROSS_COMPILE=ia64-linux-
58 # Alternatively CROSS_COMPILE can be set in the environment.
59 # Default value for CROSS_COMPILE is not to prefix executables
60 # Note: Some architectures assign CROSS_COMPILE in their arch/*/Makefile
62 ARCH ?= $(SUBARCH)
63 CROSS_COMPILE ?=
65 # Architecture as present in compile.h
66 UTS_MACHINE := $(ARCH)
68 # SHELL used by kbuild
69 CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
70 else if [ -x /bin/bash ]; then echo /bin/bash; \
71 else echo sh; fi ; fi)
72 TOPDIR := $(CURDIR)
74 HOSTCC = gcc
75 HOSTCXX = g++
76 HOSTCFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
77 HOSTCXXFLAGS = -O2
80 # That's our default target when none is given on the command line
81 # Note that 'modules' will be added as a prerequisite as well,
82 # in the CONFIG_MODULES part below
84 all: vmlinux
86 # Decide whether to build built-in, modular, or both.
87 # Normally, just do built-in.
89 KBUILD_MODULES :=
90 KBUILD_BUILTIN := 1
92 # If we have only "make modules", don't compile built-in objects.
93 # When we're building modules with modversions, we need to consider
94 # the built-in objects during the descend as well, in order to
95 # make sure the checksums are uptodate before we record them.
97 ifeq ($(MAKECMDGOALS),modules)
98 KBUILD_BUILTIN := $(if $(CONFIG_MODVERSIONS),1)
99 endif
101 # If we have "make <whatever> modules", compile modules
102 # in addition to whatever we do anyway.
103 # Just "make" or "make all" shall build modules as well
105 ifneq ($(filter all modules,$(MAKECMDGOALS)),)
106 KBUILD_MODULES := 1
107 endif
109 ifeq ($(MAKECMDGOALS),)
110 KBUILD_MODULES := 1
111 endif
113 export KBUILD_MODULES KBUILD_BUILTIN KBUILD_VERBOSE KBUILD_CHECKSRC
115 # Beautify output
116 # ---------------------------------------------------------------------------
118 # Normally, we echo the whole command before executing it. By making
119 # that echo $($(quiet)$(cmd)), we now have the possibility to set
120 # $(quiet) to choose other forms of output instead, e.g.
122 # quiet_cmd_cc_o_c = Compiling $(RELDIR)/$@
123 # cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $<
125 # If $(quiet) is empty, the whole command will be printed.
126 # If it is set to "quiet_", only the short version will be printed.
127 # If it is set to "silent_", nothing wil be printed at all, since
128 # the variable $(silent_cmd_cc_o_c) doesn't exist.
130 # To put more focus on warnings, less verbose as default
132 ifdef V
133 ifeq ("$(origin V)", "command line")
134 KBUILD_VERBOSE = $(V)
135 endif
136 endif
137 ifndef KBUILD_VERBOSE
138 KBUILD_VERBOSE = 0
139 endif
141 ifdef C
142 ifeq ("$(origin C)", "command line")
143 KBUILD_CHECKSRC = $(C)
144 endif
145 endif
146 ifndef KBUILD_CHECKSRC
147 KBUILD_CHECKSRC = 0
148 endif
151 MAKEFLAGS += --no-print-directory
153 # For maximum performance (+ possibly random breakage, uncomment
154 # the following)
156 #MAKEFLAGS += -rR
158 # If the user wants quiet mode, echo short versions of the commands
159 # only
161 ifeq ($(KBUILD_VERBOSE),1)
162 quiet =
164 else
165 quiet=quiet_
166 Q = @
167 endif
169 # If the user is running make -s (silent mode), suppress echoing of
170 # commands
172 ifneq ($(findstring s,$(MAKEFLAGS)),)
173 quiet=silent_
174 endif
176 export quiet Q KBUILD_VERBOSE
178 # Paths to obj / src tree
180 src := .
181 obj := .
182 srctree := .
183 objtree := .
185 export srctree objtree
187 # Make variables (CC, etc...)
189 AS = $(CROSS_COMPILE)as
190 LD = $(CROSS_COMPILE)ld
191 CC = $(CROSS_COMPILE)gcc
192 CPP = $(CC) -E
193 AR = $(CROSS_COMPILE)ar
194 NM = $(CROSS_COMPILE)nm
195 STRIP = $(CROSS_COMPILE)strip
196 OBJCOPY = $(CROSS_COMPILE)objcopy
197 OBJDUMP = $(CROSS_COMPILE)objdump
198 AWK = awk
199 RPM := $(shell if [ -x "/usr/bin/rpmbuild" ]; then echo rpmbuild; \
200 else echo rpm; fi)
201 GENKSYMS = scripts/genksyms/genksyms
202 DEPMOD = /sbin/depmod
203 KALLSYMS = scripts/kallsyms
204 PERL = perl
205 CHECK = sparse
206 MODFLAGS = -DMODULE
207 CFLAGS_MODULE = $(MODFLAGS)
208 AFLAGS_MODULE = $(MODFLAGS)
209 LDFLAGS_MODULE = -r
210 CFLAGS_KERNEL =
211 AFLAGS_KERNEL =
213 NOSTDINC_FLAGS = -nostdinc -iwithprefix include
215 CPPFLAGS := -D__KERNEL__ -Iinclude
216 CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes -Wno-trigraphs -O2 \
217 -fno-strict-aliasing -fno-common
218 AFLAGS := -D__ASSEMBLY__ $(CPPFLAGS)
220 export VERSION PATCHLEVEL SUBLEVEL EXTRAVERSION KERNELRELEASE ARCH \
221 CONFIG_SHELL TOPDIR HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC \
222 CPP AR NM STRIP OBJCOPY OBJDUMP MAKE AWK GENKSYMS PERL UTS_MACHINE \
223 HOSTCXX HOSTCXXFLAGS LDFLAGS_BLOB LDFLAGS_MODULE CHECK
225 export CPPFLAGS NOSTDINC_FLAGS OBJCOPYFLAGS LDFLAGS
226 export CFLAGS CFLAGS_KERNEL CFLAGS_MODULE
227 export AFLAGS AFLAGS_KERNEL AFLAGS_MODULE
229 export MODVERDIR := .tmp_versions
231 # The temporary file to save gcc -MD generated dependencies must not
232 # contain a comma
233 comma := ,
234 depfile = $(subst $(comma),_,$(@D)/.$(@F).d)
236 noconfig_targets := xconfig gconfig menuconfig config oldconfig randconfig \
237 defconfig allyesconfig allnoconfig allmodconfig \
238 clean mrproper distclean rpm \
239 help tags TAGS cscope sgmldocs psdocs pdfdocs htmldocs \
240 checkconfig checkhelp checkincludes
242 RCS_FIND_IGNORE := \( -name SCCS -o -name BitKeeper -o -name .svn -o -name CVS \) -prune -o
243 RCS_TAR_IGNORE := --exclude SCCS --exclude BitKeeper --exclude .svn --exclude CVS
245 # Helpers built in scripts/
246 # ---------------------------------------------------------------------------
248 scripts/docproc scripts/fixdep scripts/split-include : scripts ;
250 .PHONY: scripts
251 scripts:
252 $(Q)$(MAKE) $(build)=scripts
254 # Objects we will link into vmlinux / subdirs we need to visit
255 # ---------------------------------------------------------------------------
257 init-y := init/
258 drivers-y := drivers/ sound/
259 net-y := net/
260 libs-y := lib/
261 core-y := usr/
262 SUBDIRS :=
264 ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
266 export include_config := 1
268 -include .config
270 endif
272 include arch/$(ARCH)/Makefile
274 core-y += kernel/ mm/ fs/ ipc/ security/ crypto/
276 SUBDIRS += $(patsubst %/,%,$(filter %/, $(init-y) $(init-m) \
277 $(core-y) $(core-m) $(drivers-y) $(drivers-m) \
278 $(net-y) $(net-m) $(libs-y) $(libs-m)))
280 ALL_SUBDIRS := $(sort $(SUBDIRS) $(patsubst %/,%,$(filter %/, \
281 $(init-n) $(init-) \
282 $(core-n) $(core-) $(drivers-n) $(drivers-) \
283 $(net-n) $(net-) $(libs-n) $(libs-))))
285 init-y := $(patsubst %/, %/built-in.o, $(init-y))
286 core-y := $(patsubst %/, %/built-in.o, $(core-y))
287 drivers-y := $(patsubst %/, %/built-in.o, $(drivers-y))
288 net-y := $(patsubst %/, %/built-in.o, $(net-y))
289 libs-y1 := $(patsubst %/, %/lib.a, $(libs-y))
290 libs-y2 := $(patsubst %/, %/built-in.o, $(libs-y))
291 libs-y := $(libs-y1) $(libs-y2)
293 ifdef include_config
295 # Here goes the main Makefile
296 # ===========================================================================
298 # If the user gave a *config target, it'll be handled in another
299 # section below, since in this case we cannot include .config
300 # Same goes for other targets like clean/mrproper etc, which
301 # don't need .config, either
303 # In this section, we need .config
305 -include .config.cmd
307 ifndef CONFIG_FRAME_POINTER
308 CFLAGS += -fomit-frame-pointer
309 endif
312 # INSTALL_PATH specifies where to place the updated kernel and system map
313 # images. Uncomment if you want to place them anywhere other than root.
316 #export INSTALL_PATH=/boot
319 # INSTALL_MOD_PATH specifies a prefix to MODLIB for module directory
320 # relocations required by build roots. This is not defined in the
321 # makefile but the arguement can be passed to make if needed.
324 MODLIB := $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE)
325 export MODLIB
327 # Build vmlinux
328 # ---------------------------------------------------------------------------
330 # This is a bit tricky: If we need to relink vmlinux, we want
331 # the version number incremented, which means recompile init/version.o
332 # and relink init/init.o. However, we cannot do this during the
333 # normal descending-into-subdirs phase, since at that time
334 # we cannot yet know if we will need to relink vmlinux.
335 # So we descend into init/ inside the rule for vmlinux again.
336 head-y += $(HEAD)
337 vmlinux-objs := $(head-y) $(init-y) $(core-y) $(libs-y) $(drivers-y) $(net-y)
339 quiet_cmd_vmlinux__ = LD $@
340 define cmd_vmlinux__
341 $(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) $(head-y) $(init-y) \
342 --start-group \
343 $(core-y) \
344 $(libs-y) \
345 $(drivers-y) \
346 $(net-y) \
347 --end-group \
348 $(filter .tmp_kallsyms%,$^) \
349 -o $@
350 endef
352 # set -e makes the rule exit immediately on error
354 define rule_vmlinux__
355 set -e; \
356 $(if $(filter .tmp_kallsyms%,$^),, \
357 echo ' GEN .version'; \
358 . $(srctree)/scripts/mkversion > .tmp_version; \
359 mv -f .tmp_version .version; \
360 $(MAKE) $(build)=init; \
362 $(if $($(quiet)cmd_vmlinux__), \
363 echo ' $($(quiet)cmd_vmlinux__)' &&) \
364 $(cmd_vmlinux__); \
365 echo 'cmd_$@ := $(cmd_vmlinux__)' > $(@D)/.$(@F).cmd
366 endef
368 define rule_vmlinux
369 $(rule_vmlinux__); \
370 $(NM) $@ | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | sort > System.map
371 endef
373 LDFLAGS_vmlinux += -T arch/$(ARCH)/vmlinux.lds.s
375 # Generate section listing all symbols and add it into vmlinux
376 # It's a three stage process:
377 # o .tmp_vmlinux1 has all symbols and sections, but __kallsyms is
378 # empty
379 # Running kallsyms on that gives us .tmp_kallsyms1.o with
380 # the right size
381 # o .tmp_vmlinux2 now has a __kallsyms section of the right size,
382 # but due to the added section, some addresses have shifted
383 # From here, we generate a correct .tmp_kallsyms2.o
384 # o The correct .tmp_kallsyms2.o is linked into the final vmlinux.
386 ifdef CONFIG_KALLSYMS
388 kallsyms.o := .tmp_kallsyms2.o
390 quiet_cmd_kallsyms = KSYM $@
391 cmd_kallsyms = $(NM) -n $< | $(KALLSYMS) > $@
393 .tmp_kallsyms1.o .tmp_kallsyms2.o: %.o: %.S scripts FORCE
394 $(call if_changed_dep,as_o_S)
396 .tmp_kallsyms%.S: .tmp_vmlinux%
397 $(call cmd,kallsyms)
399 .tmp_vmlinux1: $(vmlinux-objs) arch/$(ARCH)/vmlinux.lds.s FORCE
400 +$(call if_changed_rule,vmlinux__)
402 .tmp_vmlinux2: $(vmlinux-objs) .tmp_kallsyms1.o arch/$(ARCH)/vmlinux.lds.s FORCE
403 $(call if_changed_rule,vmlinux__)
405 endif
407 # Finally the vmlinux rule
409 vmlinux: $(vmlinux-objs) $(kallsyms.o) arch/$(ARCH)/vmlinux.lds.s FORCE
410 $(call if_changed_rule,vmlinux)
412 # The actual objects are generated when descending,
413 # make sure no implicit rule kicks in
415 $(sort $(vmlinux-objs)): $(SUBDIRS) ;
417 # Handle descending into subdirectories listed in $(SUBDIRS)
419 .PHONY: $(SUBDIRS)
420 $(SUBDIRS): prepare
421 $(Q)$(MAKE) $(build)=$@
423 # Things we need done before we descend to build or make
424 # module versions are listed in "prepare"
426 .PHONY: prepare
427 prepare: include/linux/version.h include/asm include/config/MARKER
428 ifdef KBUILD_MODULES
429 ifeq ($(origin SUBDIRS),file)
430 $(Q)rm -rf $(MODVERDIR)
431 else
432 @echo '*** Warning: Overriding SUBDIRS on the command line can cause'
433 @echo '*** inconsistencies'
434 endif
435 endif
436 $(if $(CONFIG_MODULES),$(Q)mkdir -p $(MODVERDIR))
438 # This can be used by arch/$ARCH/Makefile to preprocess
439 # their vmlinux.lds.S file
441 AFLAGS_vmlinux.lds.o += -P -C -U$(ARCH)
443 arch/$(ARCH)/vmlinux.lds.s: %.s: %.S scripts FORCE
444 $(call if_changed_dep,as_s_S)
446 targets += arch/$(ARCH)/vmlinux.lds.s
448 # Single targets
449 # ---------------------------------------------------------------------------
451 %.s: %.c scripts FORCE
452 $(Q)$(MAKE) $(build)=$(@D) $@
453 %.i: %.c scripts FORCE
454 $(Q)$(MAKE) $(build)=$(@D) $@
455 %.o: %.c scripts FORCE
456 $(Q)$(MAKE) $(build)=$(@D) $@
457 %/: scripts prepare FORCE
458 $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) $(build)=$(@D)
459 %.lst: %.c scripts FORCE
460 $(Q)$(MAKE) $(build)=$(@D) $@
461 %.s: %.S scripts FORCE
462 $(Q)$(MAKE) $(build)=$(@D) $@
463 %.o: %.S scripts FORCE
464 $(Q)$(MAKE) $(build)=$(@D) $@
466 # FIXME: The asm symlink changes when $(ARCH) changes. That's
467 # hard to detect, but I suppose "make mrproper" is a good idea
468 # before switching between archs anyway.
470 include/asm:
471 @echo ' Making asm->asm-$(ARCH) symlink'
472 @ln -s asm-$(ARCH) $@
474 # Split autoconf.h into include/linux/config/*
476 include/config/MARKER: scripts/split-include include/linux/autoconf.h
477 @echo ' SPLIT include/linux/autoconf.h -> include/config/*'
478 @scripts/split-include include/linux/autoconf.h include/config
479 @touch $@
481 # if .config is newer than include/linux/autoconf.h, someone tinkered
482 # with it and forgot to run make oldconfig
484 include/linux/autoconf.h: .config scripts/fixdep
485 $(Q)$(MAKE) $(build)=scripts/kconfig scripts/kconfig/conf
486 ./scripts/kconfig/conf -s arch/$(ARCH)/Kconfig
488 # Generate some files
489 # ---------------------------------------------------------------------------
491 # version.h changes when $(KERNELRELEASE) etc change, as defined in
492 # this Makefile
494 uts_len := 64
496 define filechk_version.h
497 if expr length "$(KERNELRELEASE)" \> $(uts_len) >/dev/null ; then \
498 echo '"$(KERNELRELEASE)" exceeds $(uts_len) characters' >&2; \
499 exit 1; \
500 fi; \
501 (echo \#define UTS_RELEASE \"$(KERNELRELEASE)\"; \
502 echo \#define LINUX_VERSION_CODE `expr $(VERSION) \\* 65536 + $(PATCHLEVEL) \\* 256 + $(SUBLEVEL)`; \
503 echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))'; \
505 endef
507 include/linux/version.h: Makefile
508 $(call filechk,version.h)
510 # ---------------------------------------------------------------------------
512 .PHONY: depend dep
513 depend dep:
514 @echo '*** Warning: make $@ is unnecessary now.'
516 # ---------------------------------------------------------------------------
517 # Modules
519 ifdef CONFIG_MODULES
521 # By default, build modules as well
523 all: modules
525 # Build modules
527 .PHONY: modules
528 modules: $(SUBDIRS) $(if $(KBUILD_BUILTIN),vmlinux)
529 @echo ' Building modules, stage 2.';
530 $(Q)$(MAKE) -rR -f scripts/Makefile.modpost
532 # Install modules
534 .PHONY: modules_install
535 modules_install: _modinst_ _modinst_post
537 .PHONY: _modinst_
538 _modinst_:
539 @rm -rf $(MODLIB)/kernel
540 @rm -f $(MODLIB)/build
541 @mkdir -p $(MODLIB)/kernel
542 @ln -s $(TOPDIR) $(MODLIB)/build
543 $(Q)$(MAKE) -rR -f scripts/Makefile.modinst
545 # If System.map exists, run depmod. This deliberately does not have a
546 # dependency on System.map since that would run the dependency tree on
547 # vmlinux. This depmod is only for convenience to give the initial
548 # boot a modules.dep even before / is mounted read-write. However the
549 # boot script depmod is the master version.
550 ifeq "$(strip $(INSTALL_MOD_PATH))" ""
551 depmod_opts :=
552 else
553 depmod_opts := -b $(INSTALL_MOD_PATH) -r
554 endif
555 .PHONY: _modinst_post
556 _modinst_post: _modinst_
557 if [ -r System.map ]; then $(DEPMOD) -ae -F System.map $(depmod_opts) $(KERNELRELEASE); fi
559 else # CONFIG_MODULES
561 # Modules not configured
562 # ---------------------------------------------------------------------------
564 modules modules_install: FORCE
565 @echo
566 @echo "The present kernel configuration has modules disabled."
567 @echo "Type 'make config' and enable loadable module support."
568 @echo "Then build a kernel with module support enabled."
569 @echo
570 @exit 1
572 endif # CONFIG_MODULES
574 # Generate asm-offsets.h
575 # ---------------------------------------------------------------------------
577 define filechk_gen-asm-offsets
578 (set -e; \
579 echo "#ifndef __ASM_OFFSETS_H__"; \
580 echo "#define __ASM_OFFSETS_H__"; \
581 echo "/*"; \
582 echo " * DO NOT MODIFY."; \
583 echo " *"; \
584 echo " * This file was generated by arch/$(ARCH)/Makefile"; \
585 echo " *"; \
586 echo " */"; \
587 echo ""; \
588 sed -ne "/^->/{s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}"; \
589 echo ""; \
590 echo "#endif" )
591 endef
593 else # ifdef include_config
595 ifeq ($(filter-out $(noconfig_targets),$(MAKECMDGOALS)),)
597 # Targets which don't need .config
598 # ===========================================================================
600 # These targets basically have their own Makefile - not quite, but at
601 # least its own exclusive section in the same Makefile. The reason for
602 # this is the following:
603 # To know the configuration, the main Makefile has to include
604 # .config. That's a obviously a problem when .config doesn't exist
605 # yet, but that could be kludged around with only including it if it
606 # exists.
607 # However, the larger problem is: If you run make *config, make will
608 # include the old .config, then execute your *config. It will then
609 # notice that a piece it included (.config) did change and restart from
610 # scratch. Which will cause execution of *config again. You get the
611 # picture.
612 # If we don't explicitly let the Makefile know that .config is changed
613 # by *config (the old way), it won't reread .config after *config,
614 # thus working with possibly stale values - we don't that either.
616 # So we divide things: This part here is for making *config targets,
617 # and other targets which should work when no .config exists yet.
618 # The main part above takes care of the rest after a .config exists.
620 # Kernel configuration
621 # ---------------------------------------------------------------------------
623 .PHONY: oldconfig xconfig gconfig menuconfig config \
624 make_with_config rpm
626 scripts/kconfig/conf scripts/kconfig/mconf scripts/kconfig/qconf scripts/kconfig/gconf: scripts/fixdep FORCE
627 $(Q)$(MAKE) $(build)=scripts/kconfig $@
629 xconfig: scripts/kconfig/qconf
630 ./scripts/kconfig/qconf arch/$(ARCH)/Kconfig
632 gconfig: scripts/kconfig/gconf
633 ./scripts/kconfig/gconf arch/$(ARCH)/Kconfig
635 menuconfig: scripts/kconfig/mconf
636 $(Q)$(MAKE) $(build)=scripts/lxdialog
637 ./scripts/kconfig/mconf arch/$(ARCH)/Kconfig
639 config: scripts/kconfig/conf
640 ./scripts/kconfig/conf arch/$(ARCH)/Kconfig
642 oldconfig: scripts/kconfig/conf
643 ./scripts/kconfig/conf -o arch/$(ARCH)/Kconfig
645 randconfig: scripts/kconfig/conf
646 ./scripts/kconfig/conf -r arch/$(ARCH)/Kconfig
648 allyesconfig: scripts/kconfig/conf
649 ./scripts/kconfig/conf -y arch/$(ARCH)/Kconfig
651 allnoconfig: scripts/kconfig/conf
652 ./scripts/kconfig/conf -n arch/$(ARCH)/Kconfig
654 allmodconfig: scripts/kconfig/conf
655 ./scripts/kconfig/conf -m arch/$(ARCH)/Kconfig
657 defconfig: scripts/kconfig/conf
658 ./scripts/kconfig/conf -d arch/$(ARCH)/Kconfig
661 # Cleaning is done on three levels.
662 # make clean Delete all automatically generated files, including
663 # tools and firmware.
664 # make mrproper Delete the current configuration, and related files
665 # Any core files spread around are deleted as well
666 # make distclean Remove editor backup files, patch leftover files and the like
668 # Files removed with 'make clean'
669 CLEAN_FILES += vmlinux System.map MC*
671 # Files removed with 'make mrproper'
672 MRPROPER_FILES += \
673 include/linux/autoconf.h include/linux/version.h \
674 .version .config .config.old config.in config.old \
675 .menuconfig.log \
676 include/asm \
677 .hdepend include/linux/modversions.h \
678 tags TAGS cscope kernel.spec \
679 .tmp*
681 # Directories removed with 'make mrproper'
682 MRPROPER_DIRS += \
683 $(MODVERDIR) \
684 .tmp_export-objs \
685 include/config \
686 include/linux/modules
688 # clean - Delete all intermediate files
690 clean-dirs += $(addprefix _clean_,$(ALL_SUBDIRS) Documentation/DocBook scripts)
691 .PHONY: $(clean-dirs) clean archclean mrproper archmrproper distclean
692 $(clean-dirs):
693 $(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@)
695 quiet_cmd_rmclean = RM $$(CLEAN_FILES)
696 cmd_rmclean = rm -f $(CLEAN_FILES)
697 clean: archclean $(clean-dirs)
698 $(call cmd,rmclean)
699 @find . $(RCS_FIND_IGNORE) \
700 \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \
701 -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \) \
702 -type f -print | xargs rm -f
704 # mrproper - delete configuration + modules + core files
706 quiet_cmd_mrproper = RM $$(MRPROPER_DIRS) + $$(MRPROPER_FILES)
707 cmd_mrproper = rm -rf $(MRPROPER_DIRS) && rm -f $(MRPROPER_FILES)
708 mrproper distclean: clean archmrproper
709 @echo ' Making $@ in the srctree'
710 @find . $(RCS_FIND_IGNORE) \
711 \( -name '*.orig' -o -name '*.rej' -o -name '*~' \
712 -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
713 -o -name '.*.rej' -o -size 0 \
714 -o -name '*%' -o -name '.*.cmd' -o -name 'core' \) \
715 -type f -print | xargs rm -f
716 $(call cmd,mrproper)
718 # Generate tags for editors
719 # ---------------------------------------------------------------------------
721 define all-sources
722 ( find . $(RCS_FIND_IGNORE) \
723 \( -name include -o -name arch \) -prune -o \
724 -name '*.[chS]' -print; \
725 find arch/$(ARCH) $(RCS_FIND_IGNORE) \
726 -name '*.[chS]' -print; \
727 find include $(RCS_FIND_IGNORE) \
728 \( -name config -o -name 'asm-*' \) -prune \
729 -o -name '*.[chS]' -print; \
730 find include/asm-$(ARCH) $(RCS_FIND_IGNORE) \
731 -name '*.[chS]' -print; \
732 find include/asm-generic $(RCS_FIND_IGNORE) \
733 -name '*.[chS]' -print )
734 endef
736 quiet_cmd_cscope = MAKE $@
737 cmd_cscope = $(all-sources) | cscope -k -b -i -
739 quiet_cmd_TAGS = MAKE $@
740 cmd_TAGS = $(all-sources) | etags -
742 # Exuberant ctags works better with -I
744 quiet_cmd_tags = MAKE $@
745 define cmd_tags
746 rm -f $@; \
747 CTAGSF=`ctags --version | grep -i exuberant >/dev/null && echo "-I __initdata,__exitdata,EXPORT_SYMBOL,EXPORT_SYMBOL_NOVERS"`; \
748 $(all-sources) | xargs ctags $$CTAGSF -a
749 endef
751 cscope: FORCE
752 $(call cmd,cscope)
754 TAGS: FORCE
755 $(call cmd,TAGS)
757 tags: FORCE
758 $(call cmd,tags)
760 # RPM target
761 # ---------------------------------------------------------------------------
763 # If you do a make spec before packing the tarball you can rpm -ta it
765 spec:
766 . $(srctree)/scripts/mkspec >kernel.spec
768 # Build a tar ball, generate an rpm from it and pack the result
769 # There are two bits of magic here
770 # 1) The use of /. to avoid tar packing just the symlink
771 # 2) Removing the .dep files as they have source paths in them that
772 # will become invalid
774 rpm: clean spec
775 find . $(RCS_FIND_IGNORE) \
776 \( -size 0 -o -name .depend -o -name .hdepend \) \
777 -type f -print | xargs rm -f
778 set -e; \
779 cd $(TOPDIR)/.. ; \
780 ln -sf $(TOPDIR) $(KERNELPATH) ; \
781 tar -cvz $(RCS_TAR_IGNORE) -f $(KERNELPATH).tar.gz $(KERNELPATH)/. ; \
782 rm $(KERNELPATH) ; \
783 cd $(TOPDIR) ; \
784 $(CONFIG_SHELL) $(srctree)/scripts/mkversion > .version ; \
785 $(RPM) -ta $(TOPDIR)/../$(KERNELPATH).tar.gz ; \
786 rm $(TOPDIR)/../$(KERNELPATH).tar.gz
788 # Brief documentation of the typical targets used
789 # ---------------------------------------------------------------------------
791 help:
792 @echo 'Cleaning targets:'
793 @echo ' clean - remove most generated files but keep the config'
794 @echo ' mrproper - remove all generated files + config + various backup files'
795 @echo ''
796 @echo 'Configuration targets:'
797 @echo ' oldconfig - Update current config utilising a line-oriented program'
798 @echo ' menuconfig - Update current config utilising a menu based program'
799 @echo ' xconfig - Update current config utilising a QT based front-end'
800 @echo ' gconfig - Update current config utilising a GTK based front-end'
801 @echo ' defconfig - New config with default answer to all options'
802 @echo ' allmodconfig - New config selecting modules when possible'
803 @echo ' allyesconfig - New config where all options are accepted with yes'
804 @echo ' allnoconfig - New minimal config'
805 @echo ''
806 @echo 'Other generic targets:'
807 @echo ' all - Build all targets marked with [*]'
808 @echo '* vmlinux - Build the bare kernel'
809 @echo '* modules - Build all modules'
810 @echo ' modules_install - Install all modules'
811 @echo ' dir/ - Build all files in dir and below'
812 @echo ' dir/file.[ois] - Build specified target only'
813 @echo ' rpm - Build a kernel as an RPM package'
814 @echo ' tags/TAGS - Generate tags file for editors'
815 @echo ''
816 @echo 'Documentation targets:'
817 @$(MAKE) --no-print-directory -f Documentation/DocBook/Makefile dochelp
818 @echo ''
819 @echo 'Architecture specific targets ($(ARCH)):'
820 @$(if $(archhelp),$(archhelp),\
821 echo ' No architecture specific help defined for $(ARCH)')
822 @echo ''
823 @echo ' make V=0|1 [targets] 0 => quiet build (default), 1 => verbose build'
824 @echo ' make C=1 [targets] Check all c source with checker tool'
825 @echo ''
826 @echo 'Execute "make" or "make all" to build all targets marked with [*] '
827 @echo 'For further info browse Documentation/kbuild/*'
830 # Documentation targets
831 # ---------------------------------------------------------------------------
832 sgmldocs psdocs pdfdocs htmldocs: scripts/docproc FORCE
833 $(Q)$(MAKE) $(build)=Documentation/DocBook $@
835 # Scripts to check various things for consistency
836 # ---------------------------------------------------------------------------
838 checkconfig:
839 find * $(RCS_FIND_IGNORE) \
840 -name '*.[hcS]' -type f -print | sort \
841 | xargs $(PERL) -w scripts/checkconfig.pl
843 checkincludes:
844 find * $(RCS_FIND_IGNORE) \
845 -name '*.[hcS]' -type f -print | sort \
846 | xargs $(PERL) -w scripts/checkincludes.pl
848 else # ifneq ($(filter-out $(noconfig_targets),$(MAKECMDGOALS)),)
850 # We're called with both targets which do and do not need
851 # .config included. Handle them one after the other.
852 # ===========================================================================
854 %:: FORCE
855 $(Q)$(MAKE) $@
857 endif # ifeq ($(filter-out $(noconfig_targets),$(MAKECMDGOALS)),)
858 endif # ifdef include_config
860 # FIXME Should go into a make.lib or something
861 # ===========================================================================
863 a_flags = -Wp,-MD,$(depfile) $(AFLAGS) $(AFLAGS_KERNEL) $(NOSTDINC_FLAGS) \
864 $(modkern_aflags) $(EXTRA_AFLAGS) $(AFLAGS_$(*F).o)
866 quiet_cmd_as_s_S = CPP $@
867 cmd_as_s_S = $(CPP) $(a_flags) -o $@ $<
869 quiet_cmd_as_o_S = AS $@
870 cmd_as_o_S = $(CC) $(a_flags) -c -o $@ $<
872 # read all saved command lines
874 targets := $(wildcard $(sort $(targets)))
875 cmd_files := $(wildcard .*.cmd $(foreach f,$(targets),$(dir $(f)).$(notdir $(f)).cmd))
877 ifneq ($(cmd_files),)
878 include $(cmd_files)
879 endif
881 # execute the command and also postprocess generated .d dependencies
882 # file
884 if_changed_dep = $(if $(strip $? $(filter-out FORCE $(wildcard $^),$^)\
885 $(filter-out $(cmd_$(1)),$(cmd_$@))\
886 $(filter-out $(cmd_$@),$(cmd_$(1)))),\
887 @set -e; \
888 $(if $($(quiet)cmd_$(1)),echo ' $(subst ','\'',$($(quiet)cmd_$(1)))';) \
889 $(cmd_$(1)); \
890 scripts/fixdep $(depfile) $@ '$(subst $$,$$$$,$(subst ','\'',$(cmd_$(1))))' > $(@D)/.$(@F).tmp; \
891 rm -f $(depfile); \
892 mv -f $(@D)/.$(@F).tmp $(@D)/.$(@F).cmd)
894 # Usage: $(call if_changed_rule,foo)
895 # will check if $(cmd_foo) changed, or any of the prequisites changed,
896 # and if so will execute $(rule_foo)
898 if_changed_rule = $(if $(strip $? \
899 $(filter-out $(cmd_$(1)),$(cmd_$(@F)))\
900 $(filter-out $(cmd_$(@F)),$(cmd_$(1)))),\
901 @$(rule_$(1)))
903 # If quiet is set, only print short version of command
905 cmd = @$(if $($(quiet)cmd_$(1)),echo ' $($(quiet)cmd_$(1))' &&) $(cmd_$(1))
907 # filechk is used to check if the content of a generated file is updated.
908 # Sample usage:
909 # define filechk_sample
910 # echo $KERNELRELEASE
911 # endef
912 # version.h : Makefile
913 # $(call filechk,sample)
914 # The rule defined shall write to stdout the content of the new file.
915 # The existing file will be compared with the new one.
916 # - If no file exist it is created
917 # - If the content differ the new file is used
918 # - If they are equal no change, and no timestamp update
920 define filechk
921 @set -e; \
922 echo ' CHK $@'; \
923 $(filechk_$(1)) < $< > $@.tmp; \
924 if [ -r $@ ] && cmp -s $@ $@.tmp; then \
925 rm -f $@.tmp; \
926 else \
927 echo ' UPD $@'; \
928 mv -f $@.tmp $@; \
930 endef
932 # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.build obj=dir
933 # Usage:
934 # $(Q)$(MAKE) $(build)=dir
935 build := -f scripts/Makefile.build obj
937 # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.clean obj=dir
938 # Usage:
939 # $(Q)$(MAKE) $(clean)=dir
940 clean := -f scripts/Makefile.clean obj
942 # $(call descend,<dir>,<target>)
943 # Recursively call a sub-make in <dir> with target <target>
944 # Usage is deprecated, because make does not see this as an invocation of make.
945 descend =$(Q)$(MAKE) -f scripts/Makefile.build obj=$(1) $(2)
947 FORCE: