Wipe out the last remains of arch/mips64/boot, rot in pieces ...
[linux-2.6/linux-mips.git] / Makefile
blob1fad15233c0cb59bada7aa5d421683d39a1a8c8c
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 := mips
38 # Remove hyphens since they have special meaning in RPM filenames
39 KERNELPATH=kernel-$(subst -,,$(KERNELRELEASE))
41 # Cross compiling and selecting different set of gcc/bin-utils
42 # ---------------------------------------------------------------------------
44 # When performing cross compilation for other architectures ARCH shall be set
45 # to the target architecture. (See arch/* for the possibilities).
46 # ARCH can be set during invocation of make:
47 # make ARCH=ia64
48 # Another way is to have ARCH set in the environment.
49 # The default ARCH is the host where make is executed.
51 # CROSS_COMPILE specify the prefix used for all executables used
52 # during compilation. Only gcc and related bin-utils executables
53 # are prefixed with $(CROSS_COMPILE).
54 # CROSS_COMPILE can be set on the command line
55 # make CROSS_COMPILE=ia64-linux-
56 # Alternatively CROSS_COMPILE can be set in the environment.
57 # Default value for CROSS_COMPILE is not to prefix executables
58 # Note: Some architectures assign CROSS_COMPILE in their arch/*/Makefile
60 ARCH ?= $(SUBARCH)
61 CROSS_COMPILE ?=
63 # Architecture as present in compile.h
65 UTS_MACHINE := $(ARCH)
67 # SHELL used by kbuild
68 CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
69 else if [ -x /bin/bash ]; then echo /bin/bash; \
70 else echo sh; fi ; fi)
71 TOPDIR := $(CURDIR)
73 HOSTCC = gcc
74 HOSTCXX = g++
75 HOSTCFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
76 HOSTCXXFLAGS = -O2
79 # That's our default target when none is given on the command line
80 # Note that 'modules' will be added as a prerequisite as well,
81 # in the CONFIG_MODULES part below
83 all: vmlinux
85 # Decide whether to build built-in, modular, or both.
86 # Normally, just do built-in.
88 KBUILD_MODULES :=
89 KBUILD_BUILTIN := 1
91 # If we have only "make modules", don't compile built-in objects.
92 # When we're building modules with modversions, we need to consider
93 # the built-in objects during the descend as well, in order to
94 # make sure the checksums are uptodate before we record them.
96 ifeq ($(MAKECMDGOALS),modules)
97 KBUILD_BUILTIN := $(if $(CONFIG_MODVERSIONS),1)
98 endif
100 # If we have "make <whatever> modules", compile modules
101 # in addition to whatever we do anyway.
102 # Just "make" or "make all" shall build modules as well
104 ifneq ($(filter all modules,$(MAKECMDGOALS)),)
105 KBUILD_MODULES := 1
106 endif
108 ifeq ($(MAKECMDGOALS),)
109 KBUILD_MODULES := 1
110 endif
112 export KBUILD_MODULES KBUILD_BUILTIN KBUILD_VERBOSE KBUILD_CHECKSRC
114 # Beautify output
115 # ---------------------------------------------------------------------------
117 # Normally, we echo the whole command before executing it. By making
118 # that echo $($(quiet)$(cmd)), we now have the possibility to set
119 # $(quiet) to choose other forms of output instead, e.g.
121 # quiet_cmd_cc_o_c = Compiling $(RELDIR)/$@
122 # cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $<
124 # If $(quiet) is empty, the whole command will be printed.
125 # If it is set to "quiet_", only the short version will be printed.
126 # If it is set to "silent_", nothing wil be printed at all, since
127 # the variable $(silent_cmd_cc_o_c) doesn't exist.
129 # To put more focus on warnings, less verbose as default
131 ifdef V
132 ifeq ("$(origin V)", "command line")
133 KBUILD_VERBOSE = $(V)
134 endif
135 endif
136 ifndef KBUILD_VERBOSE
137 KBUILD_VERBOSE = 0
138 endif
140 ifdef C
141 ifeq ("$(origin C)", "command line")
142 KBUILD_CHECKSRC = $(C)
143 endif
144 endif
145 ifndef KBUILD_CHECKSRC
146 KBUILD_CHECKSRC = 0
147 endif
150 MAKEFLAGS += --no-print-directory
152 # For maximum performance (+ possibly random breakage, uncomment
153 # the following)
155 #MAKEFLAGS += -rR
157 # If the user wants quiet mode, echo short versions of the commands
158 # only
160 ifeq ($(KBUILD_VERBOSE),1)
161 quiet =
163 else
164 quiet=quiet_
165 Q = @
166 endif
168 # If the user is running make -s (silent mode), suppress echoing of
169 # commands
171 ifneq ($(findstring s,$(MAKEFLAGS)),)
172 quiet=silent_
173 endif
175 export quiet Q KBUILD_VERBOSE
177 # Paths to obj / src tree
179 src := .
180 obj := .
181 srctree := .
182 objtree := .
184 export srctree objtree
186 # Make variables (CC, etc...)
188 AS = $(CROSS_COMPILE)as
189 LD = $(CROSS_COMPILE)ld
190 CC = $(CROSS_COMPILE)gcc
191 CPP = $(CC) -E
192 AR = $(CROSS_COMPILE)ar
193 NM = $(CROSS_COMPILE)nm
194 STRIP = $(CROSS_COMPILE)strip
195 OBJCOPY = $(CROSS_COMPILE)objcopy
196 OBJDUMP = $(CROSS_COMPILE)objdump
197 AWK = awk
198 RPM := $(shell if [ -x "/usr/bin/rpmbuild" ]; then echo rpmbuild; \
199 else echo rpm; fi)
200 GENKSYMS = scripts/genksyms/genksyms
201 DEPMOD = /sbin/depmod
202 KALLSYMS = scripts/kallsyms
203 PERL = perl
204 CHECK = sparse
205 MODFLAGS = -DMODULE
206 CFLAGS_MODULE = $(MODFLAGS)
207 AFLAGS_MODULE = $(MODFLAGS)
208 LDFLAGS_MODULE = -r
209 CFLAGS_KERNEL =
210 AFLAGS_KERNEL =
212 NOSTDINC_FLAGS = -nostdinc -iwithprefix include
214 CPPFLAGS := -D__KERNEL__ -Iinclude
215 CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes -Wno-trigraphs -O2 \
216 -fno-strict-aliasing -fno-common
217 AFLAGS := -D__ASSEMBLY__ $(CPPFLAGS)
219 export VERSION PATCHLEVEL SUBLEVEL EXTRAVERSION KERNELRELEASE ARCH \
220 CONFIG_SHELL TOPDIR HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC \
221 CPP AR NM STRIP OBJCOPY OBJDUMP MAKE AWK GENKSYMS PERL UTS_MACHINE \
222 HOSTCXX HOSTCXXFLAGS LDFLAGS_BLOB LDFLAGS_MODULE CHECK
224 export CPPFLAGS NOSTDINC_FLAGS OBJCOPYFLAGS LDFLAGS
225 export CFLAGS CFLAGS_KERNEL CFLAGS_MODULE
226 export AFLAGS AFLAGS_KERNEL AFLAGS_MODULE
228 export MODVERDIR := .tmp_versions
230 # The temporary file to save gcc -MD generated dependencies must not
231 # contain a comma
232 comma := ,
233 depfile = $(subst $(comma),_,$(@D)/.$(@F).d)
235 noconfig_targets := xconfig gconfig menuconfig config oldconfig randconfig \
236 defconfig allyesconfig allnoconfig allmodconfig \
237 clean mrproper distclean rpm \
238 help tags TAGS cscope sgmldocs psdocs pdfdocs htmldocs \
239 checkconfig checkhelp checkincludes
241 RCS_FIND_IGNORE := \( -name SCCS -o -name BitKeeper -o -name .svn -o -name CVS \) -prune -o
242 RCS_TAR_IGNORE := --exclude SCCS --exclude BitKeeper --exclude .svn --exclude CVS
244 # Helpers built in scripts/
245 # ---------------------------------------------------------------------------
247 scripts/docproc scripts/fixdep scripts/split-include : scripts ;
249 .PHONY: scripts
250 scripts:
251 $(Q)$(MAKE) $(build)=scripts
253 # Objects we will link into vmlinux / subdirs we need to visit
254 # ---------------------------------------------------------------------------
256 init-y := init/
257 drivers-y := drivers/ sound/
258 net-y := net/
259 libs-y := lib/
260 core-y := usr/
261 SUBDIRS :=
263 ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
265 export include_config := 1
267 -include .config
269 endif
271 include arch/$(ARCH)/Makefile
273 core-y += kernel/ mm/ fs/ ipc/ security/ crypto/
275 SUBDIRS += $(patsubst %/,%,$(filter %/, $(init-y) $(init-m) \
276 $(core-y) $(core-m) $(drivers-y) $(drivers-m) \
277 $(net-y) $(net-m) $(libs-y) $(libs-m)))
279 ALL_SUBDIRS := $(sort $(SUBDIRS) $(patsubst %/,%,$(filter %/, \
280 $(init-n) $(init-) \
281 $(core-n) $(core-) $(drivers-n) $(drivers-) \
282 $(net-n) $(net-) $(libs-n) $(libs-))))
284 init-y := $(patsubst %/, %/built-in.o, $(init-y))
285 core-y := $(patsubst %/, %/built-in.o, $(core-y))
286 drivers-y := $(patsubst %/, %/built-in.o, $(drivers-y))
287 net-y := $(patsubst %/, %/built-in.o, $(net-y))
288 libs-y1 := $(patsubst %/, %/lib.a, $(libs-y))
289 libs-y2 := $(patsubst %/, %/built-in.o, $(libs-y))
290 libs-y := $(libs-y1) $(libs-y2)
292 ifdef include_config
294 # Here goes the main Makefile
295 # ===========================================================================
297 # If the user gave a *config target, it'll be handled in another
298 # section below, since in this case we cannot include .config
299 # Same goes for other targets like clean/mrproper etc, which
300 # don't need .config, either
302 # In this section, we need .config
304 -include .config.cmd
306 ifndef CONFIG_FRAME_POINTER
307 CFLAGS += -fomit-frame-pointer
308 endif
311 # INSTALL_PATH specifies where to place the updated kernel and system map
312 # images. Uncomment if you want to place them anywhere other than root.
315 #export INSTALL_PATH=/boot
318 # INSTALL_MOD_PATH specifies a prefix to MODLIB for module directory
319 # relocations required by build roots. This is not defined in the
320 # makefile but the arguement can be passed to make if needed.
323 MODLIB := $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE)
324 export MODLIB
326 # Build vmlinux
327 # ---------------------------------------------------------------------------
329 # This is a bit tricky: If we need to relink vmlinux, we want
330 # the version number incremented, which means recompile init/version.o
331 # and relink init/init.o. However, we cannot do this during the
332 # normal descending-into-subdirs phase, since at that time
333 # we cannot yet know if we will need to relink vmlinux.
334 # So we descend into init/ inside the rule for vmlinux again.
335 head-y += $(HEAD)
336 vmlinux-objs := $(head-y) $(init-y) $(core-y) $(libs-y) $(drivers-y) $(net-y)
338 quiet_cmd_vmlinux__ = LD $@
339 define cmd_vmlinux__
340 $(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) $(head-y) $(init-y) \
341 --start-group \
342 $(core-y) \
343 $(libs-y) \
344 $(drivers-y) \
345 $(net-y) \
346 --end-group \
347 $(filter .tmp_kallsyms%,$^) \
348 -o $@
349 endef
351 # set -e makes the rule exit immediately on error
353 define rule_vmlinux__
354 set -e; \
355 $(if $(filter .tmp_kallsyms%,$^),, \
356 echo ' GEN .version'; \
357 . $(srctree)/scripts/mkversion > .tmp_version; \
358 mv -f .tmp_version .version; \
359 $(MAKE) $(build)=init; \
361 $(if $($(quiet)cmd_vmlinux__), \
362 echo ' $($(quiet)cmd_vmlinux__)' &&) \
363 $(cmd_vmlinux__); \
364 echo 'cmd_$@ := $(cmd_vmlinux__)' > $(@D)/.$(@F).cmd
365 endef
367 define rule_vmlinux
368 $(rule_vmlinux__); \
369 $(NM) $@ | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | sort > System.map
370 endef
372 LDFLAGS_vmlinux += -T arch/$(ARCH)/vmlinux.lds.s
374 # Generate section listing all symbols and add it into vmlinux
375 # It's a three stage process:
376 # o .tmp_vmlinux1 has all symbols and sections, but __kallsyms is
377 # empty
378 # Running kallsyms on that gives us .tmp_kallsyms1.o with
379 # the right size
380 # o .tmp_vmlinux2 now has a __kallsyms section of the right size,
381 # but due to the added section, some addresses have shifted
382 # From here, we generate a correct .tmp_kallsyms2.o
383 # o The correct .tmp_kallsyms2.o is linked into the final vmlinux.
385 ifdef CONFIG_KALLSYMS
387 kallsyms.o := .tmp_kallsyms2.o
389 quiet_cmd_kallsyms = KSYM $@
390 cmd_kallsyms = $(NM) -n $< | $(KALLSYMS) > $@
392 .tmp_kallsyms1.o .tmp_kallsyms2.o: %.o: %.S scripts FORCE
393 $(call if_changed_dep,as_o_S)
395 .tmp_kallsyms%.S: .tmp_vmlinux%
396 $(call cmd,kallsyms)
398 .tmp_vmlinux1: $(vmlinux-objs) arch/$(ARCH)/vmlinux.lds.s FORCE
399 +$(call if_changed_rule,vmlinux__)
401 .tmp_vmlinux2: $(vmlinux-objs) .tmp_kallsyms1.o arch/$(ARCH)/vmlinux.lds.s FORCE
402 $(call if_changed_rule,vmlinux__)
404 endif
406 # Finally the vmlinux rule
408 vmlinux: $(vmlinux-objs) $(kallsyms.o) arch/$(ARCH)/vmlinux.lds.s FORCE
409 $(call if_changed_rule,vmlinux)
411 # The actual objects are generated when descending,
412 # make sure no implicit rule kicks in
414 $(sort $(vmlinux-objs)): $(SUBDIRS) ;
416 # Handle descending into subdirectories listed in $(SUBDIRS)
418 .PHONY: $(SUBDIRS)
419 $(SUBDIRS): prepare
420 $(Q)$(MAKE) $(build)=$@
422 # Things we need done before we descend to build or make
423 # module versions are listed in "prepare"
425 .PHONY: prepare
426 prepare: include/linux/version.h include/asm include/config/MARKER
427 ifdef KBUILD_MODULES
428 ifeq ($(origin SUBDIRS),file)
429 $(Q)rm -rf $(MODVERDIR)
430 else
431 @echo '*** Warning: Overriding SUBDIRS on the command line can cause'
432 @echo '*** inconsistencies'
433 endif
434 endif
435 $(if $(CONFIG_MODULES),$(Q)mkdir -p $(MODVERDIR))
437 # This can be used by arch/$ARCH/Makefile to preprocess
438 # their vmlinux.lds.S file
440 AFLAGS_vmlinux.lds.o += -P -C -U$(ARCH)
442 arch/$(ARCH)/vmlinux.lds.s: %.s: %.S scripts FORCE
443 $(call if_changed_dep,as_s_S)
445 targets += arch/$(ARCH)/vmlinux.lds.s
447 # Single targets
448 # ---------------------------------------------------------------------------
450 %.s: %.c scripts FORCE
451 $(Q)$(MAKE) $(build)=$(@D) $@
452 %.i: %.c scripts FORCE
453 $(Q)$(MAKE) $(build)=$(@D) $@
454 %.o: %.c scripts FORCE
455 $(Q)$(MAKE) $(build)=$(@D) $@
456 %/: scripts prepare FORCE
457 $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) $(build)=$(@D)
458 %.lst: %.c scripts FORCE
459 $(Q)$(MAKE) $(build)=$(@D) $@
460 %.s: %.S scripts FORCE
461 $(Q)$(MAKE) $(build)=$(@D) $@
462 %.o: %.S scripts FORCE
463 $(Q)$(MAKE) $(build)=$(@D) $@
465 # FIXME: The asm symlink changes when $(ARCH) changes. That's
466 # hard to detect, but I suppose "make mrproper" is a good idea
467 # before switching between archs anyway.
469 include/asm:
470 @echo ' Making asm->asm-$(ARCH) symlink'
471 @ln -s asm-$(ARCH) $@
473 # Split autoconf.h into include/linux/config/*
475 include/config/MARKER: scripts/split-include include/linux/autoconf.h
476 @echo ' SPLIT include/linux/autoconf.h -> include/config/*'
477 @scripts/split-include include/linux/autoconf.h include/config
478 @touch $@
480 # if .config is newer than include/linux/autoconf.h, someone tinkered
481 # with it and forgot to run make oldconfig
483 include/linux/autoconf.h: .config scripts/fixdep
484 $(Q)$(MAKE) $(build)=scripts/kconfig scripts/kconfig/conf
485 ./scripts/kconfig/conf -s arch/$(ARCH)/Kconfig
487 # Generate some files
488 # ---------------------------------------------------------------------------
490 # version.h changes when $(KERNELRELEASE) etc change, as defined in
491 # this Makefile
493 uts_len := 64
495 define filechk_version.h
496 if expr length "$(KERNELRELEASE)" \> $(uts_len) >/dev/null ; then \
497 echo '"$(KERNELRELEASE)" exceeds $(uts_len) characters' >&2; \
498 exit 1; \
499 fi; \
500 (echo \#define UTS_RELEASE \"$(KERNELRELEASE)\"; \
501 echo \#define LINUX_VERSION_CODE `expr $(VERSION) \\* 65536 + $(PATCHLEVEL) \\* 256 + $(SUBLEVEL)`; \
502 echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))'; \
504 endef
506 include/linux/version.h: Makefile
507 $(call filechk,version.h)
509 # ---------------------------------------------------------------------------
511 .PHONY: depend dep
512 depend dep:
513 @echo '*** Warning: make $@ is unnecessary now.'
515 # ---------------------------------------------------------------------------
516 # Modules
518 ifdef CONFIG_MODULES
520 # By default, build modules as well
522 all: modules
524 # Build modules
526 .PHONY: modules
527 modules: $(SUBDIRS) $(if $(KBUILD_BUILTIN),vmlinux)
528 @echo ' Building modules, stage 2.';
529 $(Q)$(MAKE) -rR -f scripts/Makefile.modpost
531 # Install modules
533 .PHONY: modules_install
534 modules_install: _modinst_ _modinst_post
536 .PHONY: _modinst_
537 _modinst_:
538 @rm -rf $(MODLIB)/kernel
539 @rm -f $(MODLIB)/build
540 @mkdir -p $(MODLIB)/kernel
541 @ln -s $(TOPDIR) $(MODLIB)/build
542 $(Q)$(MAKE) -rR -f scripts/Makefile.modinst
544 # If System.map exists, run depmod. This deliberately does not have a
545 # dependency on System.map since that would run the dependency tree on
546 # vmlinux. This depmod is only for convenience to give the initial
547 # boot a modules.dep even before / is mounted read-write. However the
548 # boot script depmod is the master version.
549 ifeq "$(strip $(INSTALL_MOD_PATH))" ""
550 depmod_opts :=
551 else
552 depmod_opts := -b $(INSTALL_MOD_PATH) -r
553 endif
554 .PHONY: _modinst_post
555 _modinst_post: _modinst_
556 if [ -r System.map ]; then $(DEPMOD) -ae -F System.map $(depmod_opts) $(KERNELRELEASE); fi
558 else # CONFIG_MODULES
560 # Modules not configured
561 # ---------------------------------------------------------------------------
563 modules modules_install: FORCE
564 @echo
565 @echo "The present kernel configuration has modules disabled."
566 @echo "Type 'make config' and enable loadable module support."
567 @echo "Then build a kernel with module support enabled."
568 @echo
569 @exit 1
571 endif # CONFIG_MODULES
573 # Generate asm-offsets.h
574 # ---------------------------------------------------------------------------
576 define filechk_gen-asm-offsets
577 (set -e; \
578 echo "#ifndef __ASM_OFFSETS_H__"; \
579 echo "#define __ASM_OFFSETS_H__"; \
580 echo "/*"; \
581 echo " * DO NOT MODIFY."; \
582 echo " *"; \
583 echo " * This file was generated by arch/$(ARCH)/Makefile"; \
584 echo " *"; \
585 echo " */"; \
586 echo ""; \
587 sed -ne "/^->/{s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}"; \
588 echo ""; \
589 echo "#endif" )
590 endef
592 else # ifdef include_config
594 ifeq ($(filter-out $(noconfig_targets),$(MAKECMDGOALS)),)
596 # Targets which don't need .config
597 # ===========================================================================
599 # These targets basically have their own Makefile - not quite, but at
600 # least its own exclusive section in the same Makefile. The reason for
601 # this is the following:
602 # To know the configuration, the main Makefile has to include
603 # .config. That's a obviously a problem when .config doesn't exist
604 # yet, but that could be kludged around with only including it if it
605 # exists.
606 # However, the larger problem is: If you run make *config, make will
607 # include the old .config, then execute your *config. It will then
608 # notice that a piece it included (.config) did change and restart from
609 # scratch. Which will cause execution of *config again. You get the
610 # picture.
611 # If we don't explicitly let the Makefile know that .config is changed
612 # by *config (the old way), it won't reread .config after *config,
613 # thus working with possibly stale values - we don't that either.
615 # So we divide things: This part here is for making *config targets,
616 # and other targets which should work when no .config exists yet.
617 # The main part above takes care of the rest after a .config exists.
619 # Kernel configuration
620 # ---------------------------------------------------------------------------
622 .PHONY: oldconfig xconfig gconfig menuconfig config \
623 make_with_config rpm
625 scripts/kconfig/conf scripts/kconfig/mconf scripts/kconfig/qconf scripts/kconfig/gconf: scripts/fixdep FORCE
626 $(Q)$(MAKE) $(build)=scripts/kconfig $@
628 xconfig: scripts/kconfig/qconf
629 ./scripts/kconfig/qconf arch/$(ARCH)/Kconfig
631 gconfig: scripts/kconfig/gconf
632 ./scripts/kconfig/gconf arch/$(ARCH)/Kconfig
634 menuconfig: scripts/kconfig/mconf
635 $(Q)$(MAKE) $(build)=scripts/lxdialog
636 ./scripts/kconfig/mconf arch/$(ARCH)/Kconfig
638 config: scripts/kconfig/conf
639 ./scripts/kconfig/conf arch/$(ARCH)/Kconfig
641 oldconfig: scripts/kconfig/conf
642 ./scripts/kconfig/conf -o arch/$(ARCH)/Kconfig
644 randconfig: scripts/kconfig/conf
645 ./scripts/kconfig/conf -r arch/$(ARCH)/Kconfig
647 allyesconfig: scripts/kconfig/conf
648 ./scripts/kconfig/conf -y arch/$(ARCH)/Kconfig
650 allnoconfig: scripts/kconfig/conf
651 ./scripts/kconfig/conf -n arch/$(ARCH)/Kconfig
653 allmodconfig: scripts/kconfig/conf
654 ./scripts/kconfig/conf -m arch/$(ARCH)/Kconfig
656 defconfig: scripts/kconfig/conf
657 ./scripts/kconfig/conf -d arch/$(ARCH)/Kconfig
660 # Cleaning is done on three levels.
661 # make clean Delete all automatically generated files, including
662 # tools and firmware.
663 # make mrproper Delete the current configuration, and related files
664 # Any core files spread around are deleted as well
665 # make distclean Remove editor backup files, patch leftover files and the like
667 # Files removed with 'make clean'
668 CLEAN_FILES += vmlinux System.map MC*
670 # Files removed with 'make mrproper'
671 MRPROPER_FILES += \
672 include/linux/autoconf.h include/linux/version.h \
673 .version .config .config.old config.in config.old \
674 .menuconfig.log \
675 include/asm \
676 .hdepend include/linux/modversions.h \
677 tags TAGS cscope kernel.spec \
678 .tmp*
680 # Directories removed with 'make mrproper'
681 MRPROPER_DIRS += \
682 $(MODVERDIR) \
683 .tmp_export-objs \
684 include/config \
685 include/linux/modules
687 # clean - Delete all intermediate files
689 clean-dirs += $(addprefix _clean_,$(ALL_SUBDIRS) Documentation/DocBook scripts)
690 .PHONY: $(clean-dirs) clean archclean mrproper archmrproper distclean
691 $(clean-dirs):
692 $(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@)
694 quiet_cmd_rmclean = RM $$(CLEAN_FILES)
695 cmd_rmclean = rm -f $(CLEAN_FILES)
696 clean: archclean $(clean-dirs)
697 $(call cmd,rmclean)
698 @find . $(RCS_FIND_IGNORE) \
699 \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \
700 -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \) \
701 -type f -print | xargs rm -f
703 # mrproper - delete configuration + modules + core files
705 quiet_cmd_mrproper = RM $$(MRPROPER_DIRS) + $$(MRPROPER_FILES)
706 cmd_mrproper = rm -rf $(MRPROPER_DIRS) && rm -f $(MRPROPER_FILES)
707 mrproper distclean: clean archmrproper
708 @echo ' Making $@ in the srctree'
709 @find . $(RCS_FIND_IGNORE) \
710 \( -name '*.orig' -o -name '*.rej' -o -name '*~' \
711 -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
712 -o -name '.*.rej' -o -size 0 \
713 -o -name '*%' -o -name '.*.cmd' -o -name 'core' \) \
714 -type f -print | xargs rm -f
715 $(call cmd,mrproper)
717 # Generate tags for editors
718 # ---------------------------------------------------------------------------
720 define all-sources
721 ( find . $(RCS_FIND_IGNORE) \
722 \( -name include -o -name arch \) -prune -o \
723 -name '*.[chS]' -print; \
724 find arch/$(ARCH) $(RCS_FIND_IGNORE) \
725 -name '*.[chS]' -print; \
726 find include $(RCS_FIND_IGNORE) \
727 \( -name config -o -name 'asm-*' \) -prune \
728 -o -name '*.[chS]' -print; \
729 find include/asm-$(ARCH) $(RCS_FIND_IGNORE) \
730 -name '*.[chS]' -print; \
731 find include/asm-generic $(RCS_FIND_IGNORE) \
732 -name '*.[chS]' -print )
733 endef
735 quiet_cmd_cscope = MAKE $@
736 cmd_cscope = $(all-sources) | cscope -k -b -i -
738 quiet_cmd_TAGS = MAKE $@
739 cmd_TAGS = $(all-sources) | etags -
741 # Exuberant ctags works better with -I
743 quiet_cmd_tags = MAKE $@
744 define cmd_tags
745 rm -f $@; \
746 CTAGSF=`ctags --version | grep -i exuberant >/dev/null && echo "-I __initdata,__exitdata,EXPORT_SYMBOL,EXPORT_SYMBOL_NOVERS"`; \
747 $(all-sources) | xargs ctags $$CTAGSF -a
748 endef
750 cscope: FORCE
751 $(call cmd,cscope)
753 TAGS: FORCE
754 $(call cmd,TAGS)
756 tags: FORCE
757 $(call cmd,tags)
759 # RPM target
760 # ---------------------------------------------------------------------------
762 # If you do a make spec before packing the tarball you can rpm -ta it
764 spec:
765 . $(srctree)/scripts/mkspec >kernel.spec
767 # Build a tar ball, generate an rpm from it and pack the result
768 # There are two bits of magic here
769 # 1) The use of /. to avoid tar packing just the symlink
770 # 2) Removing the .dep files as they have source paths in them that
771 # will become invalid
773 rpm: clean spec
774 find . $(RCS_FIND_IGNORE) \
775 \( -size 0 -o -name .depend -o -name .hdepend \) \
776 -type f -print | xargs rm -f
777 set -e; \
778 cd $(TOPDIR)/.. ; \
779 ln -sf $(TOPDIR) $(KERNELPATH) ; \
780 tar -cvz $(RCS_TAR_IGNORE) -f $(KERNELPATH).tar.gz $(KERNELPATH)/. ; \
781 rm $(KERNELPATH) ; \
782 cd $(TOPDIR) ; \
783 $(CONFIG_SHELL) $(srctree)/scripts/mkversion > .version ; \
784 $(RPM) -ta $(TOPDIR)/../$(KERNELPATH).tar.gz ; \
785 rm $(TOPDIR)/../$(KERNELPATH).tar.gz
787 # Brief documentation of the typical targets used
788 # ---------------------------------------------------------------------------
790 help:
791 @echo 'Cleaning targets:'
792 @echo ' clean - remove most generated files but keep the config'
793 @echo ' mrproper - remove all generated files + config + various backup files'
794 @echo ''
795 @echo 'Configuration targets:'
796 @echo ' oldconfig - Update current config utilising a line-oriented program'
797 @echo ' menuconfig - Update current config utilising a menu based program'
798 @echo ' xconfig - Update current config utilising a QT based front-end'
799 @echo ' gconfig - Update current config utilising a GTK based front-end'
800 @echo ' defconfig - New config with default answer to all options'
801 @echo ' allmodconfig - New config selecting modules when possible'
802 @echo ' allyesconfig - New config where all options are accepted with yes'
803 @echo ' allnoconfig - New minimal config'
804 @echo ''
805 @echo 'Other generic targets:'
806 @echo ' all - Build all targets marked with [*]'
807 @echo '* vmlinux - Build the bare kernel'
808 @echo '* modules - Build all modules'
809 @echo ' modules_install - Install all modules'
810 @echo ' dir/ - Build all files in dir and below'
811 @echo ' dir/file.[ois] - Build specified target only'
812 @echo ' rpm - Build a kernel as an RPM package'
813 @echo ' tags/TAGS - Generate tags file for editors'
814 @echo ''
815 @echo 'Documentation targets:'
816 @$(MAKE) --no-print-directory -f Documentation/DocBook/Makefile dochelp
817 @echo ''
818 @echo 'Architecture specific targets ($(ARCH)):'
819 @$(if $(archhelp),$(archhelp),\
820 echo ' No architecture specific help defined for $(ARCH)')
821 @echo ''
822 @echo ' make V=0|1 [targets] 0 => quiet build (default), 1 => verbose build'
823 @echo ' make C=1 [targets] Check all c source with checker tool'
824 @echo ''
825 @echo 'Execute "make" or "make all" to build all targets marked with [*] '
826 @echo 'For further info browse Documentation/kbuild/*'
829 # Documentation targets
830 # ---------------------------------------------------------------------------
831 sgmldocs psdocs pdfdocs htmldocs: scripts/docproc FORCE
832 $(Q)$(MAKE) $(build)=Documentation/DocBook $@
834 # Scripts to check various things for consistency
835 # ---------------------------------------------------------------------------
837 checkconfig:
838 find * $(RCS_FIND_IGNORE) \
839 -name '*.[hcS]' -type f -print | sort \
840 | xargs $(PERL) -w scripts/checkconfig.pl
842 checkincludes:
843 find * $(RCS_FIND_IGNORE) \
844 -name '*.[hcS]' -type f -print | sort \
845 | xargs $(PERL) -w scripts/checkincludes.pl
847 else # ifneq ($(filter-out $(noconfig_targets),$(MAKECMDGOALS)),)
849 # We're called with both targets which do and do not need
850 # .config included. Handle them one after the other.
851 # ===========================================================================
853 %:: FORCE
854 $(Q)$(MAKE) $@
856 endif # ifeq ($(filter-out $(noconfig_targets),$(MAKECMDGOALS)),)
857 endif # ifdef include_config
859 # FIXME Should go into a make.lib or something
860 # ===========================================================================
862 a_flags = -Wp,-MD,$(depfile) $(AFLAGS) $(AFLAGS_KERNEL) $(NOSTDINC_FLAGS) \
863 $(modkern_aflags) $(EXTRA_AFLAGS) $(AFLAGS_$(*F).o)
865 quiet_cmd_as_s_S = CPP $@
866 cmd_as_s_S = $(CPP) $(a_flags) -o $@ $<
868 quiet_cmd_as_o_S = AS $@
869 cmd_as_o_S = $(CC) $(a_flags) -c -o $@ $<
871 # read all saved command lines
873 targets := $(wildcard $(sort $(targets)))
874 cmd_files := $(wildcard .*.cmd $(foreach f,$(targets),$(dir $(f)).$(notdir $(f)).cmd))
876 ifneq ($(cmd_files),)
877 include $(cmd_files)
878 endif
880 # execute the command and also postprocess generated .d dependencies
881 # file
883 if_changed_dep = $(if $(strip $? $(filter-out FORCE $(wildcard $^),$^)\
884 $(filter-out $(cmd_$(1)),$(cmd_$@))\
885 $(filter-out $(cmd_$@),$(cmd_$(1)))),\
886 @set -e; \
887 $(if $($(quiet)cmd_$(1)),echo ' $(subst ','\'',$($(quiet)cmd_$(1)))';) \
888 $(cmd_$(1)); \
889 scripts/fixdep $(depfile) $@ '$(subst $$,$$$$,$(subst ','\'',$(cmd_$(1))))' > $(@D)/.$(@F).tmp; \
890 rm -f $(depfile); \
891 mv -f $(@D)/.$(@F).tmp $(@D)/.$(@F).cmd)
893 # Usage: $(call if_changed_rule,foo)
894 # will check if $(cmd_foo) changed, or any of the prequisites changed,
895 # and if so will execute $(rule_foo)
897 if_changed_rule = $(if $(strip $? \
898 $(filter-out $(cmd_$(1)),$(cmd_$(@F)))\
899 $(filter-out $(cmd_$(@F)),$(cmd_$(1)))),\
900 @$(rule_$(1)))
902 # If quiet is set, only print short version of command
904 cmd = @$(if $($(quiet)cmd_$(1)),echo ' $($(quiet)cmd_$(1))' &&) $(cmd_$(1))
906 # filechk is used to check if the content of a generated file is updated.
907 # Sample usage:
908 # define filechk_sample
909 # echo $KERNELRELEASE
910 # endef
911 # version.h : Makefile
912 # $(call filechk,sample)
913 # The rule defined shall write to stdout the content of the new file.
914 # The existing file will be compared with the new one.
915 # - If no file exist it is created
916 # - If the content differ the new file is used
917 # - If they are equal no change, and no timestamp update
919 define filechk
920 @set -e; \
921 echo ' CHK $@'; \
922 $(filechk_$(1)) < $< > $@.tmp; \
923 if [ -r $@ ] && cmp -s $@ $@.tmp; then \
924 rm -f $@.tmp; \
925 else \
926 echo ' UPD $@'; \
927 mv -f $@.tmp $@; \
929 endef
931 # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.build obj=dir
932 # Usage:
933 # $(Q)$(MAKE) $(build)=dir
934 build := -f scripts/Makefile.build obj
936 # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.clean obj=dir
937 # Usage:
938 # $(Q)$(MAKE) $(clean)=dir
939 clean := -f scripts/Makefile.clean obj
941 # $(call descend,<dir>,<target>)
942 # Recursively call a sub-make in <dir> with target <target>
943 # Usage is deprecated, because make does not see this as an invocation of make.
944 descend =$(Q)$(MAKE) -f scripts/Makefile.build obj=$(1) $(2)
946 FORCE: