Restrict the ARM architecture to use only one set of I/O functions.
[barebox-mini2440.git] / Makefile
blob2d4a833bd395db3d525ea2e5f2f680023641a635
1 VERSION = 2
2 PATCHLEVEL = 0
3 SUBLEVEL = 0
4 EXTRAVERSION =-rc9
5 NAME = Amissive Actinocutious Kiwi
7 # *DOCUMENTATION*
8 # To see a list of typical targets execute "make help"
9 # More info can be located in ./README
10 # Comments in this file are targeted only to the developer, do not
11 # expect to learn how to build the kernel reading this file.
13 # Do not:
14 # o use make's built-in rules and variables
15 # (this increases performance and avoid hard-to-debug behavour);
16 # o print "Entering directory ...";
17 MAKEFLAGS += -rR --no-print-directory
19 # We are using a recursive build, so we need to do a little thinking
20 # to get the ordering right.
22 # Most importantly: sub-Makefiles should only ever modify files in
23 # their own directory. If in some directory we have a dependency on
24 # a file in another dir (which doesn't happen often, but it's often
25 # unavoidable when linking the built-in.o targets which finally
26 # turn into uboot), we will call a sub make in that other dir, and
27 # after that we are sure that everything which is in that other dir
28 # is now up to date.
30 # The only cases where we need to modify files which have global
31 # effects are thus separated out and done before the recursive
32 # descending is started. They are now explicitly listed as the
33 # prepare rule.
35 # To put more focus on warnings, be less verbose as default
36 # Use 'make V=1' to see the full commands
38 ifdef V
39 ifeq ("$(origin V)", "command line")
40 KBUILD_VERBOSE = $(V)
41 endif
42 endif
43 ifndef KBUILD_VERBOSE
44 KBUILD_VERBOSE = 0
45 endif
47 # Call a source code checker (by default, "sparse") as part of the
48 # C compilation.
50 # Use 'make C=1' to enable checking of only re-compiled files.
51 # Use 'make C=2' to enable checking of *all* source files, regardless
52 # of whether they are re-compiled or not.
54 # See the file "Documentation/sparse.txt" for more details, including
55 # where to get the "sparse" utility.
57 ifdef C
58 ifeq ("$(origin C)", "command line")
59 KBUILD_CHECKSRC = $(C)
60 endif
61 endif
62 ifndef KBUILD_CHECKSRC
63 KBUILD_CHECKSRC = 0
64 endif
66 # Use make M=dir to specify directory of external module to build
67 # Old syntax make ... SUBDIRS=$PWD is still supported
68 # Setting the environment variable KBUILD_EXTMOD take precedence
69 ifdef SUBDIRS
70 KBUILD_EXTMOD ?= $(SUBDIRS)
71 endif
72 ifdef M
73 ifeq ("$(origin M)", "command line")
74 KBUILD_EXTMOD := $(M)
75 endif
76 endif
79 # kbuild supports saving output files in a separate directory.
80 # To locate output files in a separate directory two syntaxes are supported.
81 # In both cases the working directory must be the root of the kernel src.
82 # 1) O=
83 # Use "make O=dir/to/store/output/files/"
85 # 2) Set KBUILD_OUTPUT
86 # Set the environment variable KBUILD_OUTPUT to point to the directory
87 # where the output files shall be placed.
88 # export KBUILD_OUTPUT=dir/to/store/output/files/
89 # make
91 # The O= assignment takes precedence over the KBUILD_OUTPUT environment
92 # variable.
95 # KBUILD_SRC is set on invocation of make in OBJ directory
96 # KBUILD_SRC is not intended to be used by the regular user (for now)
97 ifeq ($(KBUILD_SRC),)
99 # OK, Make called in directory where kernel src resides
100 # Do we want to locate output files in a separate directory?
101 ifdef O
102 ifeq ("$(origin O)", "command line")
103 KBUILD_OUTPUT := $(O)
104 endif
105 endif
107 # That's our default target when none is given on the command line
108 PHONY := _all
109 _all:
111 ifneq ($(KBUILD_OUTPUT),)
112 # Invoke a second make in the output directory, passing relevant variables
113 # check that the output directory actually exists
114 saved-output := $(KBUILD_OUTPUT)
115 KBUILD_OUTPUT := $(shell cd $(KBUILD_OUTPUT) && /bin/pwd)
116 $(if $(KBUILD_OUTPUT),, \
117 $(error output directory "$(saved-output)" does not exist))
119 PHONY += $(MAKECMDGOALS)
121 $(filter-out _all,$(MAKECMDGOALS)) _all:
122 $(if $(KBUILD_VERBOSE:1=),@)$(MAKE) -C $(KBUILD_OUTPUT) \
123 KBUILD_SRC=$(CURDIR) \
124 KBUILD_EXTMOD="$(KBUILD_EXTMOD)" -f $(CURDIR)/Makefile $@
126 # Leave processing to above invocation of make
127 skip-makefile := 1
128 endif # ifneq ($(KBUILD_OUTPUT),)
129 endif # ifeq ($(KBUILD_SRC),)
131 # We process the rest of the Makefile if this is the final invocation of make
132 ifeq ($(skip-makefile),)
134 # If building an external module we do not care about the all: rule
135 # but instead _all depend on modules
136 PHONY += all
137 _all: all
139 srctree := $(if $(KBUILD_SRC),$(KBUILD_SRC),$(CURDIR))
140 objtree := $(CURDIR)
141 src := $(srctree)
142 obj := $(objtree)
144 VPATH := $(srctree)$(if $(KBUILD_EXTMOD),:$(KBUILD_EXTMOD))
146 export srctree objtree VPATH
148 # Cross compiling and selecting different set of gcc/bin-utils
149 # ---------------------------------------------------------------------------
151 # When performing cross compilation for other architectures ARCH shall be set
152 # to the target architecture. (See arch/* for the possibilities).
153 # ARCH can be set during invocation of make:
154 # make ARCH=ia64
155 # Another way is to have ARCH set in the environment.
156 # The default ARCH is the host where make is executed.
158 # CROSS_COMPILE specify the prefix used for all executables used
159 # during compilation. Only gcc and related bin-utils executables
160 # are prefixed with $(CROSS_COMPILE).
161 # CROSS_COMPILE can be set on the command line
162 # make CROSS_COMPILE=ia64-linux-
163 # Alternatively CROSS_COMPILE can be set in the environment.
164 # Default value for CROSS_COMPILE is not to prefix executables
166 ARCH ?= sandbox
167 CROSS_COMPILE ?=
169 # Architecture as present in compile.h
170 UTS_MACHINE := $(ARCH)
172 KCONFIG_CONFIG ?= .config
174 # SHELL used by kbuild
175 CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
176 else if [ -x /bin/bash ]; then echo /bin/bash; \
177 else echo sh; fi ; fi)
179 HOSTCC = gcc
180 HOSTCXX = g++
181 HOSTCFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
182 HOSTCXXFLAGS = -O2
184 # Decide whether to build built-in, modular, or both.
185 # Normally, just do built-in.
187 KBUILD_MODULES :=
188 KBUILD_BUILTIN := 1
190 # If we have only "make modules", don't compile built-in objects.
191 # When we're building modules with modversions, we need to consider
192 # the built-in objects during the descend as well, in order to
193 # make sure the checksums are up to date before we record them.
195 ifeq ($(MAKECMDGOALS),modules)
196 KBUILD_BUILTIN := $(if $(CONFIG_MODVERSIONS),1)
197 endif
199 # If we have "make <whatever> modules", compile modules
200 # in addition to whatever we do anyway.
201 # Just "make" or "make all" shall build modules as well
203 ifneq ($(filter all _all modules,$(MAKECMDGOALS)),)
204 KBUILD_MODULES := 1
205 endif
207 export KBUILD_MODULES KBUILD_BUILTIN
208 export KBUILD_CHECKSRC KBUILD_SRC
210 # Beautify output
211 # ---------------------------------------------------------------------------
213 # Normally, we echo the whole command before executing it. By making
214 # that echo $($(quiet)$(cmd)), we now have the possibility to set
215 # $(quiet) to choose other forms of output instead, e.g.
217 # quiet_cmd_cc_o_c = Compiling $(RELDIR)/$@
218 # cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $<
220 # If $(quiet) is empty, the whole command will be printed.
221 # If it is set to "quiet_", only the short version will be printed.
222 # If it is set to "silent_", nothing will be printed at all, since
223 # the variable $(silent_cmd_cc_o_c) doesn't exist.
225 # A simple variant is to prefix commands with $(Q) - that's useful
226 # for commands that shall be hidden in non-verbose mode.
228 # $(Q)ln $@ :<
230 # If KBUILD_VERBOSE equals 0 then the above command will be hidden.
231 # If KBUILD_VERBOSE equals 1 then the above command is displayed.
233 ifeq ($(KBUILD_VERBOSE),1)
234 quiet =
236 else
237 quiet=quiet_
238 Q = @
239 endif
241 # If the user is running make -s (silent mode), suppress echoing of
242 # commands
244 ifneq ($(findstring s,$(MAKEFLAGS)),)
245 quiet=silent_
246 endif
248 export quiet Q KBUILD_VERBOSE
251 # Look for make include files relative to root of kernel src
252 MAKEFLAGS += --include-dir=$(srctree)
254 # We need some generic definitions.
255 include $(srctree)/scripts/Kbuild.include
257 # Make variables (CC, etc...)
259 AS = $(CROSS_COMPILE)as
260 LD = $(CROSS_COMPILE)ld
261 CC = $(CROSS_COMPILE)gcc
262 CPP = $(CC) -E
263 AR = $(CROSS_COMPILE)ar
264 NM = $(CROSS_COMPILE)nm
265 STRIP = $(CROSS_COMPILE)strip
266 OBJCOPY = $(CROSS_COMPILE)objcopy
267 OBJDUMP = $(CROSS_COMPILE)objdump
268 AWK = awk
269 GENKSYMS = scripts/genksyms/genksyms
270 DEPMOD = /sbin/depmod
271 KALLSYMS = scripts/kallsyms
272 PERL = perl
273 CHECK = sparse
275 CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ -Wbitwise $(CF)
276 CFLAGS_KERNEL =
277 AFLAGS_KERNEL =
279 LDFLAGS_MODULE = -T common/module.lds
281 # When compiling out-of-tree modules, put MODVERDIR in the module
282 # tree rather than in the kernel tree. The kernel tree might
283 # even be read-only.
284 export MODVERDIR := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/).tmp_versions
286 # Use LINUXINCLUDE when you must reference the include/ directory.
287 # Needed to be compatible with the O= option
288 LINUXINCLUDE := -Iinclude \
289 $(if $(KBUILD_SRC),-Iinclude2 -I$(srctree)/include) \
290 -include include/linux/autoconf.h
292 CPPFLAGS := -D__KERNEL__ -D__U_BOOT__ $(LINUXINCLUDE) -fno-builtin -ffreestanding
294 CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
295 -fno-strict-aliasing -fno-common -Os -pipe
296 AFLAGS := -D__ASSEMBLY__
298 # Read KERNELRELEASE from include/config/kernel.release (if it exists)
299 KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null)
300 KERNELVERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
302 export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION
303 export ARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC
304 export CPP AR NM STRIP OBJCOPY OBJDUMP MAKE AWK GENKSYMS PERL UTS_MACHINE
305 export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS
307 export CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS
308 export CFLAGS CFLAGS_KERNEL
309 export AFLAGS AFLAGS_KERNEL
311 # Files to ignore in find ... statements
313 RCS_FIND_IGNORE := \( -name SCCS -o -name BitKeeper -o -name .svn -o -name CVS -o -name .pc -o -name .hg -o -name .git \) -prune -o
314 export RCS_TAR_IGNORE := --exclude SCCS --exclude BitKeeper --exclude .svn --exclude CVS --exclude .pc --exclude .hg --exclude .git
316 # ===========================================================================
317 # Rules shared between *config targets and build targets
319 # Basic helpers built in scripts/
320 PHONY += scripts_basic
321 scripts_basic:
322 $(Q)$(MAKE) $(build)=scripts/basic
324 # To avoid any implicit rule to kick in, define an empty command.
325 scripts/basic/%: scripts_basic ;
327 PHONY += outputmakefile
328 # outputmakefile generates a Makefile in the output directory, if using a
329 # separate output directory. This allows convenient use of make in the
330 # output directory.
331 outputmakefile:
332 ifneq ($(KBUILD_SRC),)
333 $(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile \
334 $(srctree) $(objtree) $(VERSION) $(PATCHLEVEL)
335 endif
337 # To make sure we do not include .config for any of the *config targets
338 # catch them early, and hand them over to scripts/kconfig/Makefile
339 # It is allowed to specify more targets when calling make, including
340 # mixing *config targets and build targets.
341 # For example 'make oldconfig all'.
342 # Detect when mixed targets is specified, and make a second invocation
343 # of make so .config is not included in this case either (for *config).
345 no-dot-config-targets := clean mrproper distclean \
346 cscope TAGS tags help %docs check% \
347 include/linux/version.h headers_% \
348 kernelrelease kernelversion
350 config-targets := 0
351 mixed-targets := 0
352 dot-config := 1
354 ifneq ($(filter $(no-dot-config-targets), $(MAKECMDGOALS)),)
355 ifeq ($(filter-out $(no-dot-config-targets), $(MAKECMDGOALS)),)
356 dot-config := 0
357 endif
358 endif
360 ifneq ($(filter config %config,$(MAKECMDGOALS)),)
361 config-targets := 1
362 ifneq ($(filter-out config %config,$(MAKECMDGOALS)),)
363 mixed-targets := 1
364 endif
365 endif
367 ifeq ($(mixed-targets),1)
368 # ===========================================================================
369 # We're called with mixed targets (*config and build targets).
370 # Handle them one by one.
372 %:: FORCE
373 $(Q)$(MAKE) -C $(srctree) KBUILD_SRC= $@
375 else
376 ifeq ($(config-targets),1)
377 # ===========================================================================
378 # *config targets only - make sure prerequisites are updated, and descend
379 # in scripts/kconfig to make the *config target
381 # Read arch specific Makefile to set KBUILD_DEFCONFIG as needed.
382 # KBUILD_DEFCONFIG may point out an alternative default configuration
383 # used for 'make defconfig'
384 include $(srctree)/arch/$(ARCH)/Makefile
385 export KBUILD_DEFCONFIG
387 config %config: scripts_basic outputmakefile FORCE
388 $(Q)mkdir -p include/linux include/config
389 $(Q)$(MAKE) $(build)=scripts/kconfig $@
391 else
392 # ===========================================================================
393 # Build targets only - this includes uboot, arch specific targets, clean
394 # targets and others. In general all targets except *config targets.
396 # Additional helpers built in scripts/
397 # Carefully list dependencies so we do not try to build scripts twice
398 # in parallel
399 PHONY += scripts
400 scripts: scripts_basic include/config/auto.conf
401 $(Q)$(MAKE) $(build)=$(@)
403 # Objects we will link into uboot / subdirs we need to visit
404 common-y := common/ drivers/ commands/ lib/ net/ fs/
406 ifeq ($(dot-config),1)
407 # Read in config
408 -include include/config/auto.conf
410 # Read in dependencies to all Kconfig* files, make sure to run
411 # oldconfig if changes are detected.
412 -include include/config/auto.conf.cmd
414 # To avoid any implicit rule to kick in, define an empty command
415 $(KCONFIG_CONFIG) include/config/auto.conf.cmd: ;
417 # If .config is newer than include/config/auto.conf, someone tinkered
418 # with it and forgot to run make oldconfig.
419 # if auto.conf.cmd is missing then we are probably in a cleaned tree so
420 # we execute the config step to be sure to catch updated Kconfig files
421 include/config/auto.conf: $(KCONFIG_CONFIG) include/config/auto.conf.cmd
422 $(Q)$(MAKE) -f $(srctree)/Makefile silentoldconfig
424 else
425 # Dummy target needed, because used as prerequisite
426 include/config/auto.conf: ;
427 endif # $(dot-config)
429 # The all: target is the default when no target is given on the
430 # command line.
431 # This allow a user to issue only 'make' to build a kernel
432 # Defaults uboot but it is usually overridden in the arch makefile
433 all: uboot.bin
435 include $(srctree)/arch/$(ARCH)/Makefile
437 ifdef CONFIG_DEBUG_INFO
438 CFLAGS += -g
439 endif
441 # Force gcc to behave correct even for buggy distributions
442 CFLAGS += $(call cc-option, -fno-stack-protector)
444 # arch Makefile may override CC so keep this after arch Makefile is included
445 NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)
446 CHECKFLAGS += $(NOSTDINC_FLAGS)
448 # warn about C99 declaration after statement
449 CFLAGS += $(call cc-option,-Wdeclaration-after-statement,)
451 # disable pointer signed / unsigned warnings in gcc 4.0
452 CFLAGS += $(call cc-option,-Wno-pointer-sign,)
454 # Default kernel image to build when no specific target is given.
455 # KBUILD_IMAGE may be overruled on the command line or
456 # set in the environment
457 # Also any assignments in arch/$(ARCH)/Makefile take precedence over
458 # this default value
459 export KBUILD_IMAGE ?= uboot
461 uboot-dirs := $(patsubst %/,%,$(filter %/, $(common-y)))
463 uboot-alldirs := $(sort $(uboot-dirs) $(patsubst %/,%,$(filter %/, \
464 $(common-n) $(common-) \
465 $(core-n) $(core-) $(drivers-n) $(drivers-) \
466 $(net-n) $(net-) $(libs-n) $(libs-))))
468 common-y := $(patsubst %/, %/built-in.o, $(common-y))
470 # Build uboot
471 # ---------------------------------------------------------------------------
472 # uboot is built from the objects selected by $(uboot-init) and
473 # $(uboot-main). Most are built-in.o files from top-level directories
474 # in the kernel tree, others are specified in arch/$(ARCH)Makefile.
475 # Ordering when linking is important, and $(uboot-init) must be first.
477 # FIXME: This picture is wrong for U-Boot. We have no init, driver, mm
479 # uboot
482 # +-< $(uboot-init)
483 # | +--< init/version.o + more
485 # +--< $(uboot-main)
486 # | +--< driver/built-in.o mm/built-in.o + more
488 # +-< kallsyms.o (see description in CONFIG_KALLSYMS section)
490 # uboot version cannot be updated during normal
491 # descending-into-subdirs phase since we do not yet know if we need to
492 # update uboot.
494 # System.map is generated to document addresses of all kernel symbols
496 uboot-common := $(common-y)
497 uboot-all := $(uboot-common)
498 uboot-lds := $(lds-y)
500 # Rule to link uboot
501 # May be overridden by arch/$(ARCH)/Makefile
502 quiet_cmd_uboot__ ?= LD $@
503 cmd_uboot__ ?= $(LD) $(LDFLAGS) $(LDFLAGS_uboot) -o $@ \
504 -T $(uboot-lds) $(uboot-head) \
505 --start-group $(uboot-common) --end-group \
506 $(filter-out $(uboot-lds) $(uboot-common) FORCE ,$^)
508 # Generate new uboot version
509 quiet_cmd_uboot_version = GEN .version
510 cmd_uboot_version = set -e; \
511 if [ ! -r .version ]; then \
512 rm -f .version; \
513 echo 1 >.version; \
514 else \
515 mv .version .old_version; \
516 expr 0$$(cat .old_version) + 1 >.version; \
517 fi; \
520 # Generate System.map
521 quiet_cmd_sysmap = SYSMAP
522 cmd_sysmap = $(CONFIG_SHELL) $(srctree)/scripts/mksysmap
524 # Link of uboot
525 # Generate System.map and verify that the content is consistent
526 # Use + in front of the uboot_version rule to silent warning with make -j2
527 # First command is ':' to allow us to use + in front of the rule
528 define rule_uboot__
531 $(call cmd,uboot__)
533 $(Q)echo 'cmd_$@ := $(cmd_uboot__)' > $(@D)/.$(@F).cmd
535 $(Q)$(if $($(quiet)cmd_sysmap), \
536 echo ' $($(quiet)cmd_sysmap) System.map' &&) \
537 $(cmd_sysmap) $@ System.map; \
538 if [ $$? -ne 0 ]; then \
539 rm -f $@; \
540 /bin/false; \
542 endef
544 ifdef CONFIG_KALLSYMS
545 # Generate section listing all symbols and add it into uboot $(kallsyms.o)
546 # It's a three stage process:
547 # o .tmp_uboot1 has all symbols and sections, but __kallsyms is
548 # empty
549 # Running kallsyms on that gives us .tmp_kallsyms1.o with
550 # the right size - uboot version is updated during this step
551 # o .tmp_uboot2 now has a __kallsyms section of the right size,
552 # but due to the added section, some addresses have shifted.
553 # From here, we generate a correct .tmp_kallsyms2.o
554 # o The correct .tmp_kallsyms2.o is linked into the final uboot.
555 # o Verify that the System.map from uboot matches the map from
556 # .tmp_uboot2, just in case we did not generate kallsyms correctly.
557 # o If CONFIG_KALLSYMS_EXTRA_PASS is set, do an extra pass using
558 # .tmp_uboot3 and .tmp_kallsyms3.o. This is only meant as a
559 # temporary bypass to allow the kernel to be built while the
560 # maintainers work out what went wrong with kallsyms.
562 ifdef CONFIG_KALLSYMS_EXTRA_PASS
563 last_kallsyms := 3
564 else
565 last_kallsyms := 2
566 endif
568 kallsyms.o := .tmp_kallsyms$(last_kallsyms).o
570 define verify_kallsyms
571 $(Q)$(if $($(quiet)cmd_sysmap), \
572 echo ' $($(quiet)cmd_sysmap) .tmp_System.map' &&) \
573 $(cmd_sysmap) .tmp_uboot$(last_kallsyms) .tmp_System.map
574 $(Q)cmp -s System.map .tmp_System.map || \
575 (echo Inconsistent kallsyms data; \
576 echo Try setting CONFIG_KALLSYMS_EXTRA_PASS; \
577 rm .tmp_kallsyms* ; /bin/false )
578 endef
580 # Update uboot version before link
581 # Use + in front of this rule to silent warning about make -j1
582 # First command is ':' to allow us to use + in front of this rule
583 cmd_ksym_ld = $(cmd_uboot__)
584 define rule_ksym_ld
586 +$(call cmd,uboot_version)
587 $(call cmd,uboot__)
588 $(Q)echo 'cmd_$@ := $(cmd_uboot__)' > $(@D)/.$(@F).cmd
589 endef
591 # Generate .S file with all kernel symbols
592 quiet_cmd_kallsyms = KSYM $@
593 cmd_kallsyms = $(NM) -g -n $< | $(KALLSYMS) > $@
595 .tmp_kallsyms1.o .tmp_kallsyms2.o .tmp_kallsyms3.o: %.o: %.S scripts FORCE
596 $(call if_changed_dep,as_o_S)
598 .tmp_kallsyms%.S: .tmp_uboot% $(KALLSYMS)
599 $(call cmd,kallsyms)
601 # .tmp_uboot1 must be complete except kallsyms, so update uboot version
602 .tmp_uboot1: $(uboot-lds) $(uboot-all) FORCE
603 $(call if_changed_rule,ksym_ld)
605 .tmp_uboot2: $(uboot-lds) $(uboot-all) .tmp_kallsyms1.o FORCE
606 $(call if_changed,uboot__)
608 .tmp_uboot3: $(uboot-lds) $(uboot-all) .tmp_kallsyms2.o FORCE
609 $(call if_changed,uboot__)
611 # Needs to visit scripts/ before $(KALLSYMS) can be used.
612 $(KALLSYMS): scripts ;
614 # Generate some data for debugging strange kallsyms problems
615 debug_kallsyms: .tmp_map$(last_kallsyms)
617 .tmp_map%: .tmp_uboot% FORCE
618 ($(OBJDUMP) -h $< | $(AWK) '/^ +[0-9]/{print $$4 " 0 " $$2}'; $(NM) $<) | sort > $@
620 .tmp_map3: .tmp_map2
622 .tmp_map2: .tmp_map1
624 endif # ifdef CONFIG_KALLSYMS
626 # Do modpost on a prelinked vmlinux. The finally linked vmlinux has
627 # relevant sections renamed as per the linker script.
628 quiet_cmd_uboot-modpost = LD $@
629 cmd_uboot-modpost = $(LD) $(LDFLAGS) -r -o $@ \
630 $(vmlinux-init) --start-group $(uboot-main) --end-group \
631 $(filter-out $(uboot-init) $(uboot-main) $(uboot-lds) FORCE ,$^)
632 define rule_uboot-modpost
634 +$(call cmd,uboot-modpost)
635 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost $@
636 $(Q)echo 'cmd_$@ := $(cmd_uboot-modpost)' > $(dot-target).cmd
637 endef
639 uboot.bin: uboot
640 $(Q)$(OBJCOPY) -O binary uboot uboot.bin
641 $(Q)$(OBJDUMP) -d uboot > uboot.S
643 # uboot image
644 uboot: $(uboot-lds) $(uboot-head) $(uboot-common) $(kallsyms.o) FORCE
645 $(call uboot-modpost)
646 $(call if_changed_rule,uboot__)
647 $(Q)rm -f .old_version
649 # The actual objects are generated when descending,
650 # make sure no implicit rule kicks in
651 $(sort $(uboot-head) $(uboot-common) ) $(uboot-lds): $(uboot-dirs) ;
653 # Handle descending into subdirectories listed in $(uboot-dirs)
654 # Preset locale variables to speed up the build process. Limit locale
655 # tweaks to this spot to avoid wrong language settings when running
656 # make menuconfig etc.
657 # Error messages still appears in the original language
659 PHONY += $(uboot-dirs)
660 $(uboot-dirs): prepare scripts
661 $(Q)$(MAKE) $(build)=$@
663 # Build the kernel release string
665 # The KERNELRELEASE value built here is stored in the file
666 # include/config/kernel.release, and is used when executing several
667 # make targets, such as "make install" or "make modules_install."
669 # The eventual kernel release string consists of the following fields,
670 # shown in a hierarchical format to show how smaller parts are concatenated
671 # to form the larger and final value, with values coming from places like
672 # the Makefile, kernel config options, make command line options and/or
673 # SCM tag information.
675 # $(KERNELVERSION)
676 # $(VERSION) eg, 2
677 # $(PATCHLEVEL) eg, 6
678 # $(SUBLEVEL) eg, 18
679 # $(EXTRAVERSION) eg, -rc6
680 # $(localver-full)
681 # $(localver)
682 # localversion* (all localversion* files)
683 # $(CONFIG_LOCALVERSION) (from kernel config setting)
684 # $(localver-auto) (only if CONFIG_LOCALVERSION_AUTO is set)
685 # ./scripts/setlocalversion (SCM tag, if one exists)
686 # $(LOCALVERSION) (from make command line if provided)
688 # Note how the final $(localver-auto) string is included *only* if the
689 # kernel config option CONFIG_LOCALVERSION_AUTO is selected. Also, at the
690 # moment, only git is supported but other SCMs can edit the script
691 # scripts/setlocalversion and add the appropriate checks as needed.
693 nullstring :=
694 space := $(nullstring) # end of line
696 ___localver = $(objtree)/localversion* $(srctree)/localversion*
697 __localver = $(sort $(wildcard $(___localver)))
698 # skip backup files (containing '~')
699 _localver = $(foreach f, $(__localver), $(if $(findstring ~, $(f)),,$(f)))
701 localver = $(subst $(space),, \
702 $(shell cat /dev/null $(_localver)) \
703 $(patsubst "%",%,$(CONFIG_LOCALVERSION)))
705 # If CONFIG_LOCALVERSION_AUTO is set scripts/setlocalversion is called
706 # and if the SCM is know a tag from the SCM is appended.
707 # The appended tag is determined by the SCM used.
709 # Currently, only git is supported.
710 # Other SCMs can edit scripts/setlocalversion and add the appropriate
711 # checks as needed.
712 ifdef CONFIG_LOCALVERSION_AUTO
713 _localver-auto = $(shell $(CONFIG_SHELL) \
714 $(srctree)/scripts/setlocalversion $(srctree))
715 localver-auto = $(LOCALVERSION)$(_localver-auto)
716 endif
718 localver-full = $(localver)$(localver-auto)
720 # Store (new) KERNELRELASE string in include/config/kernel.release
721 kernelrelease = $(KERNELVERSION)$(localver-full)
722 include/config/kernel.release: include/config/auto.conf FORCE
723 $(Q)rm -f $@
724 $(Q)echo $(kernelrelease) > $@
727 # Things we need to do before we recursively start building the kernel
728 # or the modules are listed in "prepare".
729 # A multi level approach is used. prepareN is processed before prepareN-1.
730 # archprepare is used in arch Makefiles and when processed asm symlink,
731 # version.h and scripts_basic is processed / created.
733 # Listed in dependency order
734 PHONY += prepare archprepare prepare0 prepare1 prepare2 prepare3
736 # prepare-all is deprecated, use prepare as valid replacement
737 PHONY += prepare-all
739 # prepare3 is used to check if we are building in a separate output directory,
740 # and if so do:
741 # 1) Check that make has not been executed in the kernel src $(srctree)
742 # 2) Create the include2 directory, used for the second asm symlink
743 prepare3: include/config/kernel.release
744 ifneq ($(KBUILD_SRC),)
745 @echo ' Using $(srctree) as source for kernel'
746 $(Q)if [ -f $(srctree)/.config -o -d $(srctree)/include/config ]; then \
747 echo " $(srctree) is not clean, please run 'make mrproper'";\
748 echo " in the '$(srctree)' directory.";\
749 /bin/false; \
751 $(Q)if [ ! -d include2 ]; then mkdir -p include2; fi;
752 $(Q)ln -fsn $(srctree)/include/asm-$(ARCH) include2/asm
753 endif
755 # prepare2 creates a makefile if using a separate output directory
756 prepare2: prepare3 outputmakefile
758 prepare1: prepare2 include/linux/version.h include/linux/utsrelease.h \
759 include/asm include/config.h include/config/auto.conf
761 ifneq ($(KBUILD_MODULES),)
762 $(Q)mkdir -p $(MODVERDIR)
763 $(Q)rm -f $(MODVERDIR)/*
764 endif
766 archprepare: prepare1 scripts_basic
768 prepare0: archprepare FORCE
769 $(Q)$(MAKE) $(build)=.
771 # All the preparing..
772 prepare prepare-all: prepare0
774 # Leave this as default for preprocessing uboot.lds.S, which is now
775 # done in arch/$(ARCH)/kernel/Makefile
777 export CPPFLAGS_uboot.lds += -P -C -U$(ARCH)
779 # FIXME: The asm symlink changes when $(ARCH) changes. That's
780 # hard to detect, but I suppose "make mrproper" is a good idea
781 # before switching between archs anyway.
783 include/asm:
784 @echo ' SYMLINK $@ -> include/asm-$(ARCH)'
785 $(Q)if [ ! -d include ]; then mkdir -p include; fi;
786 @ln -fsn asm-$(ARCH) $@
788 include/config.h: include/config/auto.conf
789 @echo ' SYMLINK $@ -> board/$(board-y)/config.h'
790 ifneq ($(KBUILD_SRC),)
791 $(Q)ln -fsn $(srctree)/board/$(board-y)/config.h $@
792 else
793 @ln -fsn ../board/$(board-y)/config.h $@
794 endif
796 # Generate some files
797 # ---------------------------------------------------------------------------
799 # KERNELRELEASE can change from a few different places, meaning version.h
800 # needs to be updated, so this check is forced on all builds
802 uts_len := 64
803 define filechk_utsrelease.h
804 if [ `echo -n "$(KERNELRELEASE)" | wc -c ` -gt $(uts_len) ]; then \
805 echo '"$(KERNELRELEASE)" exceeds $(uts_len) characters' >&2; \
806 exit 1; \
807 fi; \
808 (echo \#define UTS_RELEASE \"$(KERNELRELEASE)\";)
809 endef
811 define filechk_version.h
812 (echo \#define LINUX_VERSION_CODE $(shell \
813 expr $(VERSION) \* 65536 + $(PATCHLEVEL) \* 256 + $(SUBLEVEL)); \
814 echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))';)
815 endef
817 include/linux/version.h: $(srctree)/Makefile FORCE
818 $(call filechk,version.h)
820 include/linux/utsrelease.h: include/config/kernel.release FORCE
821 $(call filechk,utsrelease.h)
823 # ---------------------------------------------------------------------------
825 PHONY += depend dep
826 depend dep:
827 @echo '*** Warning: make $@ is unnecessary now.'
829 # ---------------------------------------------------------------------------
830 # Modules
832 ifdef CONFIG_MODULES
834 # By default, build modules as well
836 all: modules
838 # Build modules
840 PHONY += modules
841 modules: $(uboot-dirs) $(if $(KBUILD_BUILTIN),uboot)
842 @echo ' Building modules, stage 2.';
843 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
846 # Target to prepare building external modules
847 PHONY += modules_prepare
848 modules_prepare: prepare scripts
850 # Target to install modules
851 PHONY += modules_install
852 modules_install: _modinst_ _modinst_post
854 PHONY += _modinst_
855 _modinst_:
856 @if [ -z "`$(DEPMOD) -V 2>/dev/null | grep module-init-tools`" ]; then \
857 echo "Warning: you may need to install module-init-tools"; \
858 echo "See http://www.codemonkey.org.uk/docs/post-halloween-2.6.txt";\
859 sleep 1; \
861 @rm -rf $(MODLIB)/kernel
862 @rm -f $(MODLIB)/source
863 @mkdir -p $(MODLIB)/kernel
864 @ln -s $(srctree) $(MODLIB)/source
865 @if [ ! $(objtree) -ef $(MODLIB)/build ]; then \
866 rm -f $(MODLIB)/build ; \
867 ln -s $(objtree) $(MODLIB)/build ; \
869 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst
871 # If System.map exists, run depmod. This deliberately does not have a
872 # dependency on System.map since that would run the dependency tree on
873 # vmlinux. This depmod is only for convenience to give the initial
874 # boot a modules.dep even before / is mounted read-write. However the
875 # boot script depmod is the master version.
876 ifeq "$(strip $(INSTALL_MOD_PATH))" ""
877 depmod_opts :=
878 else
879 depmod_opts := -b $(INSTALL_MOD_PATH) -r
880 endif
881 PHONY += _modinst_post
882 _modinst_post: _modinst_
883 if [ -r System.map -a -x $(DEPMOD) ]; then $(DEPMOD) -ae -F System.map $(depmod_opts) $(KERNELRELEASE); fi
885 else # CONFIG_MODULES
887 # Modules not configured
888 # ---------------------------------------------------------------------------
890 modules modules_install: FORCE
891 @echo
892 @echo "The present kernel configuration has modules disabled."
893 @echo "Type 'make config' and enable loadable module support."
894 @echo "Then build a kernel with module support enabled."
895 @echo
896 @exit 1
898 endif # CONFIG_MODULES
901 # Cleaning is done on three levels.
902 # make clean Delete most generated files
903 # Leave enough to build external modules
904 # make mrproper Delete the current configuration, and all generated files
905 # make distclean Remove editor backup files, patch leftover files and the like
907 # Directories & files removed with 'make clean'
908 CLEAN_DIRS += $(MODVERDIR)
909 CLEAN_FILES += uboot System.map include/uboot_default_env.h \
910 .tmp_version .tmp_uboot* uboot.bin uboot.S \
911 .tmp_kallsyms* uboot_default_env
913 # Directories & files removed with 'make mrproper'
914 MRPROPER_DIRS += include/config include2 usr/include
915 MRPROPER_FILES += .config .config.old include/asm .version .old_version \
916 include/linux/autoconf.h include/linux/version.h \
917 include/linux/utsrelease.h include/config.h \
918 Module.symvers tags TAGS cscope*
920 # clean - Delete most, but leave enough to build external modules
922 clean: rm-dirs := $(CLEAN_DIRS)
923 clean: rm-files := $(CLEAN_FILES)
924 clean-dirs := $(addprefix _clean_,$(srctree) $(uboot-alldirs))
926 PHONY += $(clean-dirs) clean archclean
927 $(clean-dirs):
928 $(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@)
930 clean: archclean $(clean-dirs)
931 $(call cmd,rmdirs)
932 $(call cmd,rmfiles)
933 @find . $(RCS_FIND_IGNORE) \
934 \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \
935 -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \
936 -o -name '*.symtypes' \) \
937 -type f -print | xargs rm -f
939 # mrproper - Delete all generated files, including .config
941 mrproper: rm-dirs := $(wildcard $(MRPROPER_DIRS))
942 mrproper: rm-files := $(wildcard $(MRPROPER_FILES))
943 mrproper-dirs := $(addprefix _mrproper_,scripts)
945 PHONY += $(mrproper-dirs) mrproper archmrproper
946 $(mrproper-dirs):
947 $(Q)$(MAKE) $(clean)=$(patsubst _mrproper_%,%,$@)
949 mrproper: clean archmrproper $(mrproper-dirs)
950 $(call cmd,rmdirs)
951 $(call cmd,rmfiles)
953 # distclean
955 PHONY += distclean
957 distclean: mrproper
958 @find $(srctree) $(RCS_FIND_IGNORE) \
959 \( -name '*.orig' -o -name '*.rej' -o -name '*~' \
960 -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
961 -o -name '.*.rej' -o -size 0 \
962 -o -name '*%' -o -name '.*.cmd' -o -name 'core' \) \
963 -type f -print | xargs rm -f
966 # Packaging of the kernel to various formats
967 # ---------------------------------------------------------------------------
968 # rpm target kept for backward compatibility
969 package-dir := $(srctree)/scripts/package
971 %pkg: include/config/kernel.release FORCE
972 $(Q)$(MAKE) $(build)=$(package-dir) $@
973 rpm: include/config/kernel.release FORCE
974 $(Q)$(MAKE) $(build)=$(package-dir) $@
977 # Brief documentation of the typical targets used
978 # ---------------------------------------------------------------------------
980 boards := $(wildcard $(srctree)/arch/$(ARCH)/configs/*_defconfig)
981 boards := $(notdir $(boards))
983 help:
984 @echo 'Cleaning targets:'
985 @echo ' clean - Remove most generated files but keep the config and'
986 @echo ' enough build support to build external modules'
987 @echo ' mrproper - Remove all generated files + config + various backup files'
988 @echo ' distclean - mrproper + remove editor backup and patch files'
989 @echo ' docs - start doxygen for all output types (only HTML - FIXME)'
990 @echo ' htmldocs - create documentation in HTML format'
991 @echo ''
992 @echo 'Configuration targets:'
993 @$(MAKE) -f $(srctree)/scripts/kconfig/Makefile help
994 @echo ''
995 @echo 'Other generic targets:'
996 @echo ' all - Build all targets marked with [*]'
997 @echo '* uboot - Build the bare kernel'
998 @echo ' dir/ - Build all files in dir and below'
999 @echo ' dir/file.[ois] - Build specified target only'
1000 @echo ' dir/file.ko - Build module including final link'
1001 @echo ' tags/TAGS - Generate tags file for editors'
1002 @echo ' cscope - Generate cscope index'
1003 @echo ' (default: $(INSTALL_HDR_PATH))'
1004 @echo ''
1005 @echo 'Static analysers'
1006 @echo ' checkstack - Generate a list of stack hogs'
1007 @echo ' namespacecheck - Name space analysis on compiled kernel'
1008 @if [ -r include/asm-$(ARCH)/Kbuild ]; then \
1009 echo ' headers_check - Sanity check on exported headers'; \
1011 @echo ''
1012 @echo 'Architecture specific targets ($(ARCH)):'
1013 @$(if $(archhelp),$(archhelp),\
1014 echo ' No architecture specific help defined for $(ARCH)')
1015 @echo ''
1016 @$(if $(boards), \
1017 $(foreach b, $(boards), \
1018 printf " %-24s - Build for %s\\n" $(b) $(subst _defconfig,,$(b));) \
1019 echo '')
1021 @echo ' make V=0|1 [targets] 0 => quiet build (default), 1 => verbose build'
1022 @echo ' make V=2 [targets] 2 => give reason for rebuild of target'
1023 @echo ' make O=dir [targets] Locate all output files in "dir", including .config'
1024 @echo ' make C=1 [targets] Check all c source with $$CHECK (sparse by default)'
1025 @echo ' make C=2 [targets] Force check of all c source with $$CHECK'
1026 @echo ''
1027 @echo 'Execute "make" or "make all" to build all targets marked with [*] '
1028 @echo 'For further info see the ./README file'
1030 # Generate doxygen docs
1031 # ---------------------------------------------------------------------------
1032 .PHONY += docs htmldocs
1034 docs : htmldocs
1036 htmldocs:
1037 @echo 'Running doxygen with local Doxyfile'
1038 $(Q)doxygen Doxyfile
1040 # Generate tags for editors
1041 # ---------------------------------------------------------------------------
1043 #We want __srctree to totally vanish out when KBUILD_OUTPUT is not set
1044 #(which is the most common case IMHO) to avoid unneeded clutter in the big tags file.
1045 #Adding $(srctree) adds about 20M on i386 to the size of the output file!
1047 ifeq ($(src),$(obj))
1048 __srctree =
1049 else
1050 __srctree = $(srctree)/
1051 endif
1053 ifeq ($(ALLSOURCE_ARCHS),)
1054 ifeq ($(ARCH),um)
1055 ALLINCLUDE_ARCHS := $(ARCH) $(SUBARCH)
1056 else
1057 ALLINCLUDE_ARCHS := $(ARCH)
1058 endif
1059 else
1060 #Allow user to specify only ALLSOURCE_PATHS on the command line, keeping existing behavour.
1061 ALLINCLUDE_ARCHS := $(ALLSOURCE_ARCHS)
1062 endif
1064 ALLSOURCE_ARCHS := $(ARCH)
1066 define find-sources
1067 ( find $(__srctree) $(RCS_FIND_IGNORE) \
1068 \( -name include -o -name arch \) -prune -o \
1069 -name $1 -print; \
1070 for ARCH in $(ALLSOURCE_ARCHS) ; do \
1071 find $(__srctree)arch/$${ARCH} $(RCS_FIND_IGNORE) \
1072 -name $1 -print; \
1073 done ; \
1074 find $(__srctree)include $(RCS_FIND_IGNORE) \
1075 \( -name config -o -name 'asm-*' \) -prune \
1076 -o -name $1 -print; \
1077 for ARCH in $(ALLINCLUDE_ARCHS) ; do \
1078 find $(__srctree)include/asm-$${ARCH} $(RCS_FIND_IGNORE) \
1079 -name $1 -print; \
1080 done ; \
1081 find $(__srctree)include/asm-generic $(RCS_FIND_IGNORE) \
1082 -name $1 -print )
1083 endef
1085 define all-sources
1086 $(call find-sources,'*.[chS]')
1087 endef
1088 define all-kconfigs
1089 $(call find-sources,'Kconfig*')
1090 endef
1091 define all-defconfigs
1092 $(call find-sources,'defconfig')
1093 endef
1095 define xtags
1096 if $1 --version 2>&1 | grep -iq exuberant; then \
1097 $(all-sources) | xargs $1 -a \
1098 -I __initdata,__exitdata,__acquires,__releases \
1099 -I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL \
1100 --extra=+f --c-kinds=+px \
1101 --regex-asm='/ENTRY\(([^)]*)\).*/\1/'; \
1102 $(all-kconfigs) | xargs $1 -a \
1103 --langdef=kconfig \
1104 --language-force=kconfig \
1105 --regex-kconfig='/^[[:blank:]]*config[[:blank:]]+([[:alnum:]_]+)/\1/'; \
1106 $(all-defconfigs) | xargs -r $1 -a \
1107 --langdef=dotconfig \
1108 --language-force=dotconfig \
1109 --regex-dotconfig='/^#?[[:blank:]]*(CONFIG_[[:alnum:]_]+)/\1/'; \
1110 elif $1 --version 2>&1 | grep -iq emacs; then \
1111 $(all-sources) | xargs $1 -a; \
1112 $(all-kconfigs) | xargs $1 -a \
1113 --regex='/^[ \t]*config[ \t]+\([a-zA-Z0-9_]+\)/\1/'; \
1114 $(all-defconfigs) | xargs -r $1 -a \
1115 --regex='/^#?[ \t]?\(CONFIG_[a-zA-Z0-9_]+\)/\1/'; \
1116 else \
1117 $(all-sources) | xargs $1 -a; \
1119 endef
1121 quiet_cmd_cscope-file = FILELST cscope.files
1122 cmd_cscope-file = (echo \-k; echo \-q; $(all-sources)) > cscope.files
1124 quiet_cmd_cscope = MAKE cscope.out
1125 cmd_cscope = cscope -b
1127 cscope: FORCE
1128 $(call cmd,cscope-file)
1129 $(call cmd,cscope)
1131 quiet_cmd_TAGS = MAKE $@
1132 define cmd_TAGS
1133 rm -f $@; \
1134 $(call xtags,etags)
1135 endef
1137 TAGS: FORCE
1138 $(call cmd,TAGS)
1140 quiet_cmd_tags = MAKE $@
1141 define cmd_tags
1142 rm -f $@; \
1143 $(call xtags,ctags)
1144 endef
1146 tags: FORCE
1147 $(call cmd,tags)
1150 endif #ifeq ($(config-targets),1)
1151 endif #ifeq ($(mixed-targets),1)
1153 # Single targets
1154 # ---------------------------------------------------------------------------
1155 # Single targets are compatible with:
1156 # - build whith mixed source and output
1157 # - build with separate output dir 'make O=...'
1158 # - external modules
1160 # target-dir => where to store outputfile
1161 # build-dir => directory in kernel source tree to use
1163 build-dir = $(patsubst %/,%,$(dir $@))
1164 target-dir = $(dir $@)
1166 %.s: %.c prepare scripts FORCE
1167 $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
1168 %.i: %.c prepare scripts FORCE
1169 $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
1170 %.o: %.c prepare scripts FORCE
1171 $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
1172 %.lst: %.c prepare scripts FORCE
1173 $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
1174 %.s: %.S prepare scripts FORCE
1175 $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
1176 %.o: %.S prepare scripts FORCE
1177 $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
1178 %.symtypes: %.c prepare scripts FORCE
1179 $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
1181 # Modules
1182 / %/: prepare scripts FORCE
1183 $(Q)$(MAKE) $(build)=$(build-dir)
1184 %.ko: prepare scripts FORCE
1185 $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
1186 $(build)=$(build-dir) $(@:.ko=.o)
1187 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
1189 # FIXME Should go into a make.lib or something
1190 # ===========================================================================
1192 quiet_cmd_rmdirs = $(if $(wildcard $(rm-dirs)),CLEAN $(wildcard $(rm-dirs)))
1193 cmd_rmdirs = rm -rf $(rm-dirs)
1195 quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),CLEAN $(wildcard $(rm-files)))
1196 cmd_rmfiles = rm -f $(rm-files)
1199 a_flags = -Wp,-MD,$(depfile) $(AFLAGS) $(AFLAGS_KERNEL) \
1200 $(NOSTDINC_FLAGS) $(CPPFLAGS) \
1201 $(modkern_aflags) $(EXTRA_AFLAGS) $(AFLAGS_$(basetarget).o)
1203 quiet_cmd_as_o_S = AS $@
1204 cmd_as_o_S = $(CC) $(a_flags) -c -o $@ $<
1206 # read all saved command lines
1208 targets := $(wildcard $(sort $(targets)))
1209 cmd_files := $(wildcard .*.cmd $(foreach f,$(targets),$(dir $(f)).$(notdir $(f)).cmd))
1211 ifneq ($(cmd_files),)
1212 $(cmd_files): ; # Do not try to update included dependency files
1213 include $(cmd_files)
1214 endif
1216 # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.clean obj=dir
1217 # Usage:
1218 # $(Q)$(MAKE) $(clean)=dir
1219 clean := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.clean obj
1221 endif # skip-makefile
1223 PHONY += FORCE
1224 FORCE:
1226 # Cancel implicit rules on top Makefile, `-rR' will apply to sub-makes.
1227 Makefile: ;
1229 # Declare the contents of the .PHONY variable as phony. We keep that
1230 # information in a variable se we can use it in if_changed and friends.
1231 .PHONY: $(PHONY)
1234 # sanity checks for check default environemnt
1236 ifdef CONFIG_DEFAULT_ENVIRONMENT
1238 ifeq ($(CONFIG_DEFAULT_ENVIRONMENT_PATH),"")
1239 $(error default environment path empty))
1240 endif
1242 saved-env_path := $(CONFIG_DEFAULT_ENVIRONMENT_PATH)
1243 CONFIG_DEFAULT_ENVIRONMENT_PATH := $(shell cd $(if $(filter /%,$(CONFIG_DEFAULT_ENVIRONMENT_PATH)),,$(srctree)/)$(CONFIG_DEFAULT_ENVIRONMENT_PATH) && /bin/pwd)
1244 $(if $(CONFIG_DEFAULT_ENVIRONMENT_PATH),, \
1245 $(error default environment path $(saved-env_path) does not exist))
1247 endif # ifdef CONFIG_DEFAULT_ENVIRONMENT