4 EXTRAVERSION = Palacios
9 # To see a list of typical targets execute "make help"
10 # More info can be located in ./README
11 # Comments in this file are targeted only to the developer, do not
12 # expect to learn how to build the kernel reading this file.
14 # Do not print "Entering directory ..."
15 MAKEFLAGS += --no-print-directory
17 # We are using a recursive build, so we need to do a little thinking
18 # to get the ordering right.
20 # Most importantly: sub-Makefiles should only ever modify files in
21 # their own directory. If in some directory we have a dependency on
22 # a file in another dir (which doesn't happen often, but it's often
23 # unavoidable when linking the built-in.o targets which finally
24 # turn into palacios), we will call a sub make in that other dir, and
25 # after that we are sure that everything which is in that other dir
28 # The only cases where we need to modify files which have global
29 # effects are thus separated out and done before the recursive
30 # descending is started. They are now explicitly listed as the
33 # To put more focus on warnings, be less verbose as default
34 # Use 'make V=1' to see the full commands
37 ifeq ("$(origin V)", "command line")
45 # Call sparse as part of compilation of C files
46 # Use 'make C=1' to enable sparse checking
49 ifeq ("$(origin C)", "command line")
50 KBUILD_CHECKSRC = $(C)
53 ifndef KBUILD_CHECKSRC
57 # Use make M=dir to specify directory of external module to build
58 # Old syntax make ... SUBDIRS=$PWD is still supported
59 # Setting the environment variable KBUILD_EXTMOD take precedence
61 KBUILD_EXTMOD ?= $(SUBDIRS)
64 ifeq ("$(origin M)", "command line")
70 # kbuild supports saving output files in a separate directory.
71 # To locate output files in a separate directory two syntaxes are supported.
72 # In both cases the working directory must be the root of the kernel src.
74 # Use "make O=dir/to/store/output/files/"
76 # 2) Set KBUILD_OUTPUT
77 # Set the environment variable KBUILD_OUTPUT to point to the directory
78 # where the output files shall be placed.
79 # export KBUILD_OUTPUT=dir/to/store/output/files/
82 # The O= assignment takes precedence over the KBUILD_OUTPUT environment
86 # KBUILD_SRC is set on invocation of make in OBJ directory
87 # KBUILD_SRC is not intended to be used by the regular user (for now)
90 # OK, Make called in directory where kernel src resides
91 # Do we want to locate output files in a separate directory?
93 ifeq ("$(origin O)", "command line")
98 # That's our default target when none is given on the command line
102 ifneq ($(KBUILD_OUTPUT),)
103 # Invoke a second make in the output directory, passing relevant variables
104 # check that the output directory actually exists
105 saved-output := $(KBUILD_OUTPUT)
106 KBUILD_OUTPUT := $(shell cd $(KBUILD_OUTPUT) && /bin/pwd)
107 $(if $(KBUILD_OUTPUT),, \
108 $(error output directory "$(saved-output)" does not exist))
110 PHONY += $(MAKECMDGOALS)
112 $(filter-out _all,$(MAKECMDGOALS)) _all:
113 $(if $(KBUILD_VERBOSE:1=),@)$(MAKE) -C $(KBUILD_OUTPUT) \
114 KBUILD_SRC=$(CURDIR) \
115 KBUILD_EXTMOD="$(KBUILD_EXTMOD)" -f $(CURDIR)/Makefile $@
117 # Leave processing to above invocation of make
119 endif # ifneq ($(KBUILD_OUTPUT),)
120 endif # ifeq ($(KBUILD_SRC),)
122 # We process the rest of the Makefile if this is the final invocation of make
123 ifeq ($(skip-makefile),)
125 # If building an external module we do not care about the all: rule
126 # but instead _all depend on modules
132 srctree := $(if $(KBUILD_SRC),$(KBUILD_SRC),$(CURDIR))
134 # FIXME - TOPDIR is obsolete, use srctree/objtree
139 VPATH := $(srctree)$(if $(KBUILD_EXTMOD),:$(KBUILD_EXTMOD))
141 export srctree objtree VPATH TOPDIR
144 # SUBARCH tells the usermode build what the underlying arch is. That is set
145 # first, and if a usermode build is happening, the "ARCH=um" on the command
146 # line overrides the setting of ARCH below. If a native build is happening,
147 # then ARCH is assigned, getting whatever value it gets normally, and
148 # SUBARCH is subsequently ignored.
150 SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ )
152 # Cross compiling and selecting different set of gcc/bin-utils
153 # ---------------------------------------------------------------------------
155 # When performing cross compilation for other architectures ARCH shall be set
156 # to the target architecture. (See arch/* for the possibilities).
157 # ARCH can be set during invocation of make:
159 # Another way is to have ARCH set in the environment.
160 # The default ARCH is the host where make is executed.
162 # CROSS_COMPILE specify the prefix used for all executables used
163 # during compilation. Only gcc and related bin-utils executables
164 # are prefixed with $(CROSS_COMPILE).
165 # CROSS_COMPILE can be set on the command line
166 # make CROSS_COMPILE=ia64-linux-
167 # Alternatively CROSS_COMPILE can be set in the environment.
168 # Default value for CROSS_COMPILE is not to prefix executables
169 # Note: Some architectures assign CROSS_COMPILE in their arch/*/Makefile
174 # Architecture as present in compile.h
175 UTS_MACHINE := $(ARCH)
177 # SHELL used by kbuild
178 CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
179 else if [ -x /bin/bash ]; then echo /bin/bash; \
180 else echo sh; fi ; fi)
184 HOSTCFLAGS = -Wall -Wstrict-prototypes -fomit-frame-pointer \
185 -Wno-unused -Wno-format-security -U_FORTIFY_SOURCE
188 # Decide whether to build built-in, modular, or both.
189 # Normally, just do built-in.
194 # If we have only "make modules", don't compile built-in objects.
195 # When we're building modules with modversions, we need to consider
196 # the built-in objects during the descend as well, in order to
197 # make sure the checksums are uptodate before we record them.
199 ifeq ($(MAKECMDGOALS),modules)
200 KBUILD_BUILTIN := $(if $(CONFIG_MODVERSIONS),1)
203 # If we have "make <whatever> modules", compile modules
204 # in addition to whatever we do anyway.
205 # Just "make" or "make all" shall build modules as well
207 ifneq ($(filter all _all modules,$(MAKECMDGOALS)),)
211 ifeq ($(MAKECMDGOALS),)
215 export KBUILD_MODULES KBUILD_BUILTIN
216 export KBUILD_CHECKSRC KBUILD_SRC KBUILD_EXTMOD
219 # ---------------------------------------------------------------------------
221 # Normally, we echo the whole command before executing it. By making
222 # that echo $($(quiet)$(cmd)), we now have the possibility to set
223 # $(quiet) to choose other forms of output instead, e.g.
225 # quiet_cmd_cc_o_c = Compiling $(RELDIR)/$@
226 # cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $<
228 # If $(quiet) is empty, the whole command will be printed.
229 # If it is set to "quiet_", only the short version will be printed.
230 # If it is set to "silent_", nothing wil be printed at all, since
231 # the variable $(silent_cmd_cc_o_c) doesn't exist.
233 # A simple variant is to prefix commands with $(Q) - that's useful
234 # for commands that shall be hidden in non-verbose mode.
238 # If KBUILD_VERBOSE equals 0 then the above command will be hidden.
239 # If KBUILD_VERBOSE equals 1 then the above command is displayed.
241 ifeq ($(KBUILD_VERBOSE),1)
249 # If the user is running make -s (silent mode), suppress echoing of
252 ifneq ($(findstring s,$(MAKEFLAGS)),)
256 export quiet Q KBUILD_VERBOSE
259 # Look for make include files relative to root of kernel src
260 MAKEFLAGS += --include-dir=$(srctree)
262 # We need some generic definitions
263 include $(srctree)/scripts/Kbuild.include
265 # For maximum performance (+ possibly random breakage, uncomment
270 # Make variables (CC, etc...)
272 AS = $(CROSS_COMPILE)as
273 LD = $(CROSS_COMPILE)ld
274 CC = $(CROSS_COMPILE)gcc
276 AR = $(CROSS_COMPILE)ar
277 NM = $(CROSS_COMPILE)nm
278 STRIP = $(CROSS_COMPILE)strip
279 OBJCOPY = $(CROSS_COMPILE)objcopy
280 OBJDUMP = $(CROSS_COMPILE)objdump
282 GENKSYMS = scripts/genksyms/genksyms
283 DEPMOD = /sbin/depmod
284 KALLSYMS = scripts/kallsyms
293 # Use V3_INCLUDE when you must reference the include/ directory.
294 # Needed to be compatible with the O= option
295 V3_INCLUDE := -Ipalacios/include \
296 $(if $(KBUILD_SRC),-I$(srctree)/palacios/include) \
297 -include palacios/include/autoconf.h
299 CPPFLAGS := $(V3_INCLUDE) -D__V3VEE__
301 CFLAGS := -fno-stack-protector -Wall -Werror -fPIC -mno-red-zone -fno-common
306 LDFLAGS := --whole-archive
308 ifeq ($(call cc-option-yn, -fgnu89-inline),y)
309 CFLAGS += -fgnu89-inline
314 # Read KERNELRELEASE from .kernelrelease (if it exists)
315 #KERNELRELEASE = $(shell cat .kernelrelease 2> /dev/null)
316 #KERNELVERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
318 export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION \
319 ARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC \
320 CPP AR NM STRIP OBJCOPY OBJDUMP MAKE AWK GENKSYMS PERL UTS_MACHINE \
321 HOSTCXX HOSTCXXFLAGS CHECK
323 export CPPFLAGS NOSTDINC_FLAGS V3_INCLUDE OBJCOPYFLAGS LDFLAGS
324 export CFLAGS CFLAGS_KERNEL
325 export AFLAGS AFLAGS_KERNEL
327 # When compiling out-of-tree modules, put MODVERDIR in the module
328 # tree rather than in the kernel tree. The kernel tree might
330 export MODVERDIR := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/).tmp_versions
332 # Files to ignore in find ... statements
334 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
335 export RCS_TAR_IGNORE := --exclude SCCS --exclude BitKeeper --exclude .svn --exclude CVS --exclude .pc --exclude .hg --exclude .git
337 # ===========================================================================
338 # Rules shared between *config targets and build targets
340 # Basic helpers built in scripts/
341 PHONY += scripts_basic
343 $(Q)$(MAKE) $(build)=scripts/basic
345 # To avoid any implicit rule to kick in, define an empty command.
346 scripts/basic/%: scripts_basic ;
348 PHONY += outputmakefile
349 # outputmakefile generates a Makefile in the output directory, if using a
350 # separate output directory. This allows convenient use of make in the
353 ifneq ($(KBUILD_SRC),)
354 $(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile \
355 $(srctree) $(objtree) $(VERSION) $(PATCHLEVEL)
358 # To make sure we do not include .config for any of the *config targets
359 # catch them early, and hand them over to scripts/kconfig/Makefile
360 # It is allowed to specify more targets when calling make, including
361 # mixing *config targets and build targets.
362 # For example 'make oldconfig all'.
363 # Detect when mixed targets is specified, and make a second invocation
364 # of make so .config is not included in this case either (for *config).
366 no-dot-config-targets := clean mrproper distclean \
367 cscope TAGS tags help %docs check%
373 ifneq ($(filter $(no-dot-config-targets), $(MAKECMDGOALS)),)
374 ifeq ($(filter-out $(no-dot-config-targets), $(MAKECMDGOALS)),)
379 ifeq ($(KBUILD_EXTMOD),)
380 ifneq ($(filter config %config,$(MAKECMDGOALS)),)
382 ifneq ($(filter-out config %config,$(MAKECMDGOALS)),)
388 ifeq ($(mixed-targets),1)
389 # ===========================================================================
390 # We're called with mixed targets (*config and build targets).
391 # Handle them one by one.
394 $(Q)$(MAKE) -C $(srctree) KBUILD_SRC= $@
397 ifeq ($(config-targets),1)
398 # ===========================================================================
399 # *config targets only - make sure prerequisites are updated, and descend
400 # in scripts/kconfig to make the *config target
402 # Read arch specific Makefile to set KBUILD_DEFCONFIG as needed.
403 # KBUILD_DEFCONFIG may point out an alternative default configuration
404 # used for 'make defconfig'
405 include $(srctree)/Makefile.$(ARCH)
406 export KBUILD_DEFCONFIG
408 config %config: scripts_basic outputmakefile FORCE
409 $(Q)mkdir -p palacios/include/config
410 $(Q)$(MAKE) $(build)=scripts/kconfig $@
411 # $(Q)$(MAKE) -C $(srctree) KBUILD_SRC= .kernelrelease
414 # ===========================================================================
415 # Build targets only - this includes Palacios arch specific targets, clean
416 # targets and others. In general all targets except *config targets.
419 # Additional helpers built in scripts/
420 # Carefully list dependencies so we do not try to build scripts twice
423 scripts: scripts_basic palacios/include/config/MARKER
424 $(Q)$(MAKE) $(build)=$(@)
426 scripts_basic: palacios/include/autoconf.h
428 # Objects we will link into palacios / subdirs we need to visit
429 #drivers-y := drivers/
432 core-y := palacios/src/palacios/
433 libs-y := palacios/lib/$(ARCH)/
434 devices-y := palacios/src/devices/
435 modules-y := modules/
437 ifeq ($(dot-config),1)
438 # In this section, we need .config
440 # Read in dependencies to all Kconfig* files, make sure to run
441 # oldconfig if changes are detected.
446 # If .config needs to be updated, it will be done via the dependency
447 # that autoconf has on .config.
448 # To avoid any implicit rule to kick in, define an empty command
449 .config .kconfig.d: ;
451 # If .config is newer than palacios/include/autoconf.h, someone tinkered
452 # with it and forgot to run make oldconfig.
453 # If kconfig.d is missing then we are probarly in a cleaned tree so
454 # we execute the config step to be sure to catch updated Kconfig files
455 palacios/include/autoconf.h: .kconfig.d .config
456 $(Q)mkdir -p palacios/include/config
457 $(Q)$(MAKE) -f $(srctree)/Makefile silentoldconfig
459 # Dummy target needed, because used as prerequisite
460 palacios/include/autoconf.h: ;
463 DEFAULT_EXTRA_TARGETS=
465 # The all: target is the default when no target is given on the
467 # This allow a user to issue only 'make' to build a kernel including modules
468 # Defaults palacios but it is usually overriden in the arch makefile
469 all: palacios $(DEFAULT_EXTRA_TARGETS)
472 ifdef CONFIG_FRAME_POINTER
473 CFLAGS += -fno-omit-frame-pointer $(call cc-option,-fno-optimize-sibling-calls,)
475 CFLAGS += -fomit-frame-pointer
479 ifdef CONFIG_UNWIND_INFO
480 CFLAGS += -fasynchronous-unwind-tables
483 ifdef CONFIG_DEBUG_INFO
490 include $(srctree)/Makefile.$(ARCH)
492 # arch Makefile may override CC so keep this after arch Makefile is included
496 # disable pointer signedness warnings in gcc 4.0
497 CFLAGS += $(call cc-option,-Wno-pointer-sign,)
499 # Default kernel image to build when no specific target is given.
500 # KBUILD_IMAGE may be overruled on the commandline or
501 # set in the environment
502 # Also any assignments in /Makefile.$(ARCH) take precedence over
504 export KBUILD_IMAGE ?= palacios
507 # INSTALL_PATH specifies where to place the updated kernel and system map
508 # images. Default is /boot, but you can set it to other values
509 export INSTALL_PATH ?= /build
515 palacios-dirs := $(patsubst %/,%,$(filter %/, \
516 $(core-y) $(devices-y) $(libs-y)) $(modules-y))
518 #palacios-alldirs := $(sort $(palacios-dirs) $(patsubst %/,%,$(filter %/, \
519 # $(core-n) $(core-) $(devices-n) $(devices-) \
520 # $(libs-n) $(libs-))))
523 palacios-cleandirs := $(sort $(palacios-dirs) $(patsubst %/,%,$(filter %/, \
524 $(core-n) $(core-) $(devices-n) $(devices-) $(modules-n) $(modules-))))
528 core-y := $(patsubst %/, %/built-in.o, $(core-y))
529 devices-y := $(patsubst %/, %/built-in.o, $(devices-y))
530 libs-y := $(patsubst %/, %/built-in.o, $(libs-y))
531 modules-y := $(patsubst %/, %/built-in.o, $(modules-y))
532 #core-y := $(patsubst %/, %/lib.a, $(core-y))
533 #devices-y := $(patsubst %/, %/lib.a, $(devices-y))
535 # $(patsubst %/, %/built-in.o, $(libs-y))
539 # ---------------------------------------------------------------------------
540 # Palacios is build from the objects selected by $(palacios-init) and
541 # $(palacios). Most are built-in.o files from top-level directories
542 # in the kernel tree, others are specified in Makefile.
543 # Ordering when linking is important, and $(palacios-init) must be first.
549 # | +--< devices/built-in.o + more
554 palacios := $(core-y) $(devices-y) $(libs-y) $(modules-y)
556 # Rule to link palacios - also used during CONFIG_KALLSYMS
557 # May be overridden by /Makefile.$(ARCH)
558 quiet_cmd_palacios__ ?= AR $@
559 cmd_palacios__ ?= $(AR) rcs $@ $^
563 # Generate new palacios version
564 quiet_cmd_palacios_version = GEN .version
565 cmd_palacios_version = set -e; \
566 if [ ! -r .version ]; then \
570 mv .version .old_version; \
571 expr 0$$(cat .old_version) + 1 >.version; \
576 # If CONFIG_KALLSYMS is set .version is already updated
577 # Generate System.map and verify that the content is consistent
578 # Use + in front of the palacios_version rule to silent warning with make -j2
579 # First command is ':' to allow us to use + in front of the rule
580 define rule_palacios__
582 $(call cmd,palacios__)
583 $(Q)echo 'cmd_$@ := $(cmd_palacios__)' > $(@D)/.$(@F).cmd
589 # palacios image - including updated kernel symbols
590 libv3vee.a: $(palacios)
591 $(call if_changed_rule,palacios__)
595 palacios.asm: palacios
596 $(OBJDUMP) --disassemble $< > $@
598 # The actual objects are generated when descending,
599 # make sure no implicit rule kicks in
600 $(sort $(palacios)) : $(palacios-dirs) ;
602 # Handle descending into subdirectories listed in $(palacios-dirs)
603 # Preset locale variables to speed up the build process. Limit locale
604 # tweaks to this spot to avoid wrong language settings when running
605 # make menuconfig etc.
606 # Error messages still appears in the original language
608 PHONY += $(palacios-dirs)
609 $(palacios-dirs): prepare scripts
610 $(Q)$(MAKE) $(build)=$@
616 # Things we need to do before we recursively start building the kernel
617 # or the modules are listed in "prepare".
618 # A multi level approach is used. prepareN is processed before prepareN-1.
619 # archprepare is used in arch Makefiles and when processed arch symlink,
620 # version.h and scripts_basic is processed / created.
622 # Listed in dependency order
623 PHONY += prepare archprepare prepare0 prepare1 prepare2 prepare3
625 # prepare-all is deprecated, use prepare as valid replacement
628 # prepare3 is used to check if we are building in a separate output directory,
630 # 1) Check that make has not been executed in the kernel src $(srctree)
632 ifneq ($(KBUILD_SRC),)
633 @echo ' Using $(srctree) as source for kernel'
634 $(Q)if [ -f $(srctree)/.config ]; then \
635 echo " $(srctree) is not clean, please run 'make mrproper'";\
636 echo " in the '$(srctree)' directory.";\
641 # prepare2 creates a makefile if using a separate output directory
642 prepare2: prepare3 outputmakefile
644 prepare1: prepare2 palacios/include/config/MARKER
646 archprepare: prepare1 scripts_basic
648 prepare0: archprepare FORCE
649 $(Q)$(MAKE) $(build)=.
651 # All the preparing..
652 prepare prepare-all: prepare0
656 palacios/include/config/MARKER: scripts/basic/split-include palacios/include/autoconf.h
657 @echo ' SPLIT palacios/include/autoconf.h -> palacios/include/config/*'
658 @scripts/basic/split-include palacios/include/autoconf.h palacios/include/config
663 # ---------------------------------------------------------------------------
667 @echo '*** Warning: make $@ is unnecessary now.'
672 # Cleaning is done on three levels.
673 # make clean Delete most generated files
674 # Leave enough to build external modules
675 # make mrproper Delete the current configuration, and all generated files
676 # make distclean Remove editor backup files, patch leftover files and the like
678 # Directories & files removed with 'make clean'
679 CLEAN_DIRS += $(MODVERDIR)
680 CLEAN_FILES += v3vee.asm \
681 .tmp_version .tmp_palacios*
683 # Directories & files removed with 'make mrproper'
684 MRPROPER_DIRS += palacios/include/config
685 MRPROPER_FILES += .config .config.old .version .old_version \
686 palacios/include/autoconf.h \
690 # \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \
693 # clean - Delete most, but leave enough to build external modules
695 clean: rm-dirs := $(CLEAN_DIRS)
696 clean: rm-files := $(CLEAN_FILES)
697 clean-dirs := $(addprefix _clean_,$(srctree) $(palacios-cleandirs))
699 PHONY += $(clean-dirs) clean archclean
701 $(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@)
704 clean: archclean $(clean-dirs)
707 @find . $(RCS_FIND_IGNORE) \
708 \( -name 'lib' \) -prune -o \
709 \( -name '*.[oas]' -o -name '.*.cmd' \
710 -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \) \
711 -type f -print | xargs rm -f
713 # mrproper - Delete all generated files, including .config
715 mrproper: rm-dirs := $(wildcard $(MRPROPER_DIRS))
716 mrproper: rm-files := $(wildcard $(MRPROPER_FILES))
717 #mrproper-dirs := $(addprefix _mrproper_,Documentation/DocBook scripts)
718 mrproper-dirs := $(addprefix _mrproper_, scripts)
720 PHONY += $(mrproper-dirs) mrproper archmrproper
722 $(Q)$(MAKE) $(clean)=$(patsubst _mrproper_%,%,$@)
724 mrproper: clean archmrproper $(mrproper-dirs)
733 @find $(srctree) $(RCS_FIND_IGNORE) \
734 \( -name '*.orig' -o -name '*.rej' -o -name '*~' \
735 -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
736 -o -name '.*.rej' -o -size 0 \
737 -o -name '*%' -o -name '.*.cmd' -o -name 'core' \) \
738 -type f -print | xargs rm -f
741 # Packaging of the kernel to various formats
742 # ---------------------------------------------------------------------------
743 # rpm target kept for backward compatibility
744 package-dir := $(srctree)/scripts/package
747 $(Q)$(MAKE) $(build)=$(package-dir) $@
749 $(Q)$(MAKE) $(build)=$(package-dir) $@
752 # Brief documentation of the typical targets used
753 # ---------------------------------------------------------------------------
757 @echo 'Cleaning targets:'
758 @echo ' clean - remove most generated files but keep the config'
759 @echo ' mrproper - remove all generated files + config + various backup files'
761 @echo 'Configuration targets:'
762 @$(MAKE) -f $(srctree)/scripts/kconfig/Makefile help
764 @echo 'Other generic targets:'
765 @echo ' all - Build all targets marked with [*]'
766 @echo '* palacios - Build the palacios VMM'
767 @echo ' dir/ - Build all files in dir and below'
768 @echo ' dir/file.[ois] - Build specified target only'
769 @echo ' dir/file.ko - Build module including final link'
770 @echo ' rpm - Build a kernel as an RPM package'
771 @echo ' tags/TAGS - Generate tags file for editors'
772 @echo ' cscope - Generate cscope index'
774 @echo 'Kernel packaging:'
775 @$(MAKE) $(build)=$(package-dir) help
777 @echo 'Documentation targets:'
778 @$(MAKE) -f $(srctree)/Documentation/DocBook/Makefile dochelp
780 @echo 'Architecture specific targets ($(ARCH)):'
781 @$(if $(archhelp),$(archhelp),\
782 echo ' No architecture specific help defined for $(ARCH)')
784 @echo ' make V=0|1 [targets] 0 => quiet build (default), 1 => verbose build'
785 @echo ' make O=dir [targets] Locate all output files in "dir", including .config'
786 @echo ' make C=1 [targets] Check all c source with $$CHECK (sparse)'
787 @echo ' make C=2 [targets] Force check of all c source with $$CHECK (sparse)'
789 @echo 'Execute "make" or "make all" to build all targets marked with [*] '
790 @echo 'For further info see the ./README file'
793 # Documentation targets
794 # ---------------------------------------------------------------------------
795 %docs: scripts_basic FORCE
796 $(Q)$(MAKE) $(build)=Documentation/DocBook $@
799 # Generate tags for editors
800 # ---------------------------------------------------------------------------
802 #We want __srctree to totally vanish out when KBUILD_OUTPUT is not set
803 #(which is the most common case IMHO) to avoid unneeded clutter in the big tags file.
804 #Adding $(srctree) adds about 20M on i386 to the size of the output file!
809 __srctree = $(srctree)/
812 ifeq ($(ALLSOURCE_ARCHS),)
814 ALLINCLUDE_ARCHS := $(ARCH) $(SUBARCH)
816 ALLINCLUDE_ARCHS := $(ARCH)
819 #Allow user to specify only ALLSOURCE_PATHS on the command line, keeping existing behaviour.
820 ALLINCLUDE_ARCHS := $(ALLSOURCE_ARCHS)
823 ALLSOURCE_ARCHS := $(ARCH)
826 ( find $(__srctree)palacios $(RCS_FIND_IGNORE) \
827 \( -name lib \) -prune -o \
828 -name '*.[chS]' -print; )
831 quiet_cmd_cscope-file = FILELST cscope.files
832 cmd_cscope-file = (echo \-k; echo \-q; $(all-sources)) > cscope.files
834 quiet_cmd_cscope = MAKE cscope.out
835 cmd_cscope = cscope -b
838 $(call cmd,cscope-file)
841 quiet_cmd_TAGS = MAKE $@
844 ETAGSF=`etags --version | grep -i exuberant >/dev/null && \
845 echo "-I __initdata,__exitdata,__acquires,__releases \
846 -I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL \
847 --extra=+f --c-kinds=+px"`; \
848 $(all-sources) | xargs etags $$ETAGSF -a
855 quiet_cmd_tags = MAKE $@
858 CTAGSF=`ctags --version | grep -i exuberant >/dev/null && \
859 echo "-I __initdata,__exitdata,__acquires,__releases \
860 -I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL \
861 --extra=+f --c-kinds=+px"`; \
862 $(all-sources) | xargs ctags $$CTAGSF -a
869 # Scripts to check various things for consistency
870 # ---------------------------------------------------------------------------
872 endif #ifeq ($(config-targets),1)
873 endif #ifeq ($(mixed-targets),1)
879 # ---------------------------------------------------------------------------
880 # Single targets are compatible with:
881 # - build whith mixed source and output
882 # - build with separate output dir 'make O=...'
885 # target-dir => where to store outputfile
886 # build-dir => directory in kernel source tree to use
888 build-dir = $(patsubst %/,%,$(dir $@))
889 target-dir = $(dir $@)
892 %.s: %.c prepare scripts FORCE
893 $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
894 %.i: %.c prepare scripts FORCE
895 $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
896 %.o: %.c prepare scripts FORCE
897 $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
898 %.lst: %.c prepare scripts FORCE
899 $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
900 %.s: %.S prepare scripts FORCE
901 $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
902 %.o: %.S prepare scripts FORCE
903 $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
906 / %/: prepare scripts FORCE
907 $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
908 $(build)=$(build-dir)
909 %.ko: prepare scripts FORCE
910 $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
911 $(build)=$(build-dir) $(@:.ko=.o)
912 $(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modpost
914 # FIXME Should go into a make.lib or something
915 # ===========================================================================
917 quiet_cmd_rmdirs = $(if $(wildcard $(rm-dirs)),CLEAN $(wildcard $(rm-dirs)))
918 cmd_rmdirs = rm -rf $(rm-dirs)
920 quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),CLEAN $(wildcard $(rm-files)))
921 cmd_rmfiles = rm -f $(rm-files)
924 a_flags = -Wp,-MD,$(depfile) $(AFLAGS) $(AFLAGS_KERNEL) \
925 $(NOSTDINC_FLAGS) $(CPPFLAGS) \
926 $(modkern_aflags) $(EXTRA_AFLAGS) $(AFLAGS_$(*F).o)
928 quiet_cmd_as_o_S = AS $@
929 cmd_as_o_S = $(CC) $(a_flags) -c -o $@ $<
931 # read all saved command lines
933 targets := $(wildcard $(sort $(targets)))
934 cmd_files := $(wildcard .*.cmd $(foreach f,$(targets),$(dir $(f)).$(notdir $(f)).cmd))
936 ifneq ($(cmd_files),)
937 $(cmd_files): ; # Do not try to update included dependency files
941 # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.clean obj=dir
943 # $(Q)$(MAKE) $(clean)=dir
944 clean := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.clean obj
946 endif # skip-makefile
948 # Force the O variable for user and init_task (not set by kbuild?)
949 user init_task: O:=$(if $O,$O,$(objtree))
950 # Build Palacios user-space libraries and example programs
952 if [ ! -d $O/$@ ]; then mkdir $O/$@; fi
965 # Declare the contents of the .PHONY variable as phony. We keep that
966 # information in a variable se we can use it in if_changed and friends.