User:Hfastedge/diffTest

VERSION = 2 PATCHLEVEL = 5 SUBLEVEL = 44 EXTRAVERSION =


 * 1) *DOCUMENTATION*
 * 2) To see a list of typical targets execute "make help"
 * 3) More info can be located in ./Documentation/kbuild
 * 4) Comments in this file are targeted only to the developer, do not
 * 5) expect to learn how to build the kernel reading this file.


 * 1) We are using a recursive build, so we need to do a little thinking
 * 2) to get the ordering right.
 * 3) Most importantly: sub-Makefiles should only ever modify files in
 * 4) their own directory. If in some directory we have a dependency on
 * 5) a file in another dir (which doesn't happen often, but it's of
 * 6) unavoidable when linking the built-in.o targets which finally
 * 7) turn into vmlinux), we will call a sub make in that other dir, and
 * 8) after that we are sure that everything which is in that other dir
 * 9) is now up to date.
 * 10) The only cases where we need to modify files which have global
 * 11) effects are thus separated out and done before the recursive
 * 12) descending is started. They are now explicitly listed as the
 * 13) prepare rule.
 * 1) descending is started. They are now explicitly listed as the
 * 2) prepare rule.

KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)


 * 1) SUBARCH tells the usermode build what the underlying arch is.  That is set
 * 2) first, and if a usermode build is happening, the "ARCH=um" on the command
 * 3) line overrides the setting of ARCH below.  If a native build is happening,
 * 4) then ARCH is assigned, getting whatever value it gets normally, and
 * 5) SUBARCH is subsequently ignored.

SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/) ARCH := $(SUBARCH)

KERNELPATH=kernel-$(shell echo $(KERNELRELEASE) | sed -e "s/-//g")

CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \	 else if [ -x /bin/bash ]; then echo /bin/bash; \	  else echo sh; fi ; fi) TOPDIR	:= $(CURDIR)

HOSTCC 	= gcc HOSTCFLAGS	= -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer

CROSS_COMPILE 	=


 * 1) 	That's our default target when none is given on the command line

all:	vmlinux


 * 1) 	Decide whether to build built-in, modular, or both.
 * 2) 	Normally, just do built-in.

KBUILD_MODULES := KBUILD_BUILTIN := 1


 * 1) 	If we have only "make modules", don't compile built-in objects.

ifeq ($(MAKECMDGOALS),modules) KBUILD_BUILTIN := endif


 * 1) 	If we have "make modules", compile modules
 * 2) 	in addition to whatever we do anyway.

ifneq ($(filter modules,$(MAKECMDGOALS)),) KBUILD_MODULES := 1 endif


 * 1) 	Just "make" or "make all" shall build modules as well

ifeq ($(MAKECMDGOALS),) KBUILD_MODULES := 1 endif

ifneq ($(filter all,$(MAKECMDGOALS)),) KBUILD_MODULES := 1 endif

export KBUILD_MODULES KBUILD_BUILTIN KBUILD_VERBOSE


 * 1) Beautify output
 * 2) Normally, we echo the whole command before executing it. By making
 * 3) that echo $($(quiet)$(cmd)), we now have the possibility to set
 * 4) $(quiet) to choose other forms of output instead, e.g.
 * 5)         quiet_cmd_cc_o_c = Compiling $(RELDIR)/$@
 * 6)         cmd_cc_o_c       = $(CC) $(c_flags) -c -o $@ $<
 * 7) If $(quiet) is empty, the whole command will be printed.
 * 8) If it is set to "quiet_", only the short version will be printed.
 * 9) If it is set to "silent_", nothing wil be printed at all, since
 * 10) the variable $(silent_cmd_cc_o_c) doesn't exist.
 * 1) If $(quiet) is empty, the whole command will be printed.
 * 2) If it is set to "quiet_", only the short version will be printed.
 * 3) If it is set to "silent_", nothing wil be printed at all, since
 * 4) the variable $(silent_cmd_cc_o_c) doesn't exist.


 * 1) 	For now, leave verbose as default

ifndef KBUILD_VERBOSE KBUILD_VERBOSE = 1 endif

MAKEFLAGS += --no-print-directory


 * 1) 	If the user wants quiet mode, echo short versions of the commands
 * 2) 	only

ifneq ($(KBUILD_VERBOSE),1) quiet=quiet_ endif


 * 1) 	If the user is running make -s (silent mode), suppress echoing of
 * 2) 	commands

ifneq ($(findstring s,$(MAKEFLAGS)),) quiet=silent_ endif

export quiet KBUILD_VERBOSE


 * 1) 	Paths to obj / src tree

src	:=. obj	:=. srctree :=. objtree :=.

export srctree objtree


 * 1) 	Make variables (CC, etc...)

AS		= $(CROSS_COMPILE)as LD		= $(CROSS_COMPILE)ld CC		= $(CROSS_COMPILE)gcc CPP		= $(CC) -E AR		= $(CROSS_COMPILE)ar NM		= $(CROSS_COMPILE)nm STRIP		= $(CROSS_COMPILE)strip OBJCOPY		= $(CROSS_COMPILE)objcopy OBJDUMP		= $(CROSS_COMPILE)objdump MAKEFILES	= .config GENKSYMS	= /sbin/genksyms DEPMOD		= /sbin/depmod KALLSYMS	= /sbin/kallsyms PERL		= perl MODFLAGS	= -DMODULE CFLAGS_MODULE  = $(MODFLAGS) AFLAGS_MODULE  = $(MODFLAGS) CFLAGS_KERNEL	= AFLAGS_KERNEL	= NOSTDINC_FLAGS = -nostdinc -iwithprefix include

CPPFLAGS	:= -D__KERNEL__ -Iinclude CFLAGS 		:= $(CPPFLAGS) -Wall -Wstrict-prototypes -Wno-trigraphs -O2 \ -fomit-frame-pointer -fno-strict-aliasing -fno-common AFLAGS		:= -D__ASSEMBLY__ $(CPPFLAGS)

export	VERSION PATCHLEVEL SUBLEVEL EXTRAVERSION KERNELRELEASE ARCH \ CONFIG_SHELL TOPDIR HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC \ CPP AR NM STRIP OBJCOPY OBJDUMP MAKE MAKEFILES GENKSYMS PERL

export CPPFLAGS NOSTDINC_FLAGS OBJCOPYFLAGS LDFLAGS export CFLAGS CFLAGS_KERNEL CFLAGS_MODULE export AFLAGS AFLAGS_KERNEL AFLAGS_MODULE

depfile = $(subst $(comma),_,$(@D)/.$(@F).d)
 * 1) The temporary file to save gcc -MD generated dependencies must not
 * 2) contain a comma

noconfig_targets := xconfig menuconfig config oldconfig randconfig \ defconfig allyesconfig allnoconfig allmodconfig \ clean mrproper distclean \ help tags TAGS sgmldocs psdocs pdfdocs htmldocs \ checkconfig checkhelp checkincludes

RCS_FIND_IGNORE := \( -name SCCS -o -name BitKeeper -o -name .svn -o -name CVS \) -prune -o RCS_TAR_IGNORE := --exclude SCCS --exclude BitKeeper --exclude .svn --exclude CVS


 * 1) Helpers built in scripts/

scripts/docproc scripts/fixdep scripts/split-include : scripts ;

.PHONY: scripts scripts: +@$(call descend,scripts,)


 * 1) Objects we will link into vmlinux / subdirs we need to visit

init-y		:= init/ drivers-y	:= drivers/ sound/ net-y		:= net/ libs-y		:= lib/ core-y		:= SUBDIRS		:=

ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)

include-config := 1

-include .config

endif

include arch/$(ARCH)/Makefile

core-y		+= kernel/ mm/ fs/ ipc/ security/

SUBDIRS		+= $(patsubst %/,%,$(filter %/, $(init-y) $(init-m) \ $(core-y) $(core-m) $(drivers-y) $(drivers-m) \ $(net-y) $(net-m) $(libs-y) $(libs-m)))

ALL_SUBDIRS    := $(SUBDIRS) $(patsubst %/,%,$(filter %/, $(init-n) $(init-) \ $(core-n) $(core-) $(drivers-n) $(drivers-) \ $(net-n) $(net-) $(libs-n) $(libs-)))

init-y		:= $(patsubst %/, %/built-in.o, $(init-y)) core-y		:= $(patsubst %/, %/built-in.o, $(core-y)) drivers-y	:= $(patsubst %/, %/built-in.o, $(drivers-y)) net-y		:= $(patsubst %/, %/built-in.o, $(net-y)) libs-y		:= $(patsubst %/, %/lib.a, $(libs-y))

ifdef include-config


 * 1) Here goes the main Makefile
 * 2) If the user gave a *config target, it'll be handled in another
 * 3) section below, since in this case we cannot include .config
 * 4) Same goes for other targets like clean/mrproper etc, which
 * 5) don't need .config, either
 * 1) Same goes for other targets like clean/mrproper etc, which
 * 2) don't need .config, either


 * 1) 	In this section, we need .config


 * 1) 	If .config doesn't exist - tough luck

.config: arch/$(ARCH)/config.in # FIXME $(shell find . -name Config.in) @echo '***' @if [ -f $@ ]; then \ echo '*** The tree was updated, so your .config may be'; \ echo '*** out of date!'; \ else \ echo '*** You have not yet configured your kernel!'; \ fi @echo '***' @echo '*** Please run some configurator (e.g. "make oldconfig" or'	@echo '*** "make menuconfig" or "make xconfig").' @echo '***' @exit 1

ifdef CONFIG_MODULES export EXPORT_FLAGS := -DEXPORT_SYMTAB endif


 * 1) INSTALL_PATH specifies where to place the updated kernel and system map
 * 2) images.  Uncomment if you want to place them anywhere other than root.
 * 1) images.  Uncomment if you want to place them anywhere other than root.


 * 1) export	INSTALL_PATH=/boot


 * 1) INSTALL_MOD_PATH specifies a prefix to MODLIB for module directory
 * 2) relocations required by build roots.  This is not defined in the
 * 3) makefile but the arguement can be passed to make if needed.
 * 1) makefile but the arguement can be passed to make if needed.

MODLIB	:= $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE) export MODLIB


 * 1) Build vmlinux


 * 1) 	This is a bit tricky: If we need to relink vmlinux, we want
 * 2) 	the version number incremented, which means recompile init/version.o
 * 3) 	and relink init/init.o. However, we cannot do this during the
 * 4)       normal descending-into-subdirs phase, since at that time
 * 5)       we cannot yet know if we will need to relink vmlinux.
 * 6) 	So we descend into init/ inside the rule for vmlinux again.

vmlinux-objs := $(HEAD) $(init-y) $(core-y) $(libs-y) $(drivers-y) $(net-y)

quiet_cmd_vmlinux__ = LD     $@ define cmd_vmlinux__ $(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) $(HEAD) $(init-y) \ --start-group \ $(core-y) \ $(libs-y) \ $(drivers-y) \ $(net-y) \ --end-group \ $(filter .tmp_kallsyms%,$^) \ -o $@ endef


 * 1) 	set -e makes the rule exit immediately on error

define rule_vmlinux__ set -e $(if $(filter .tmp_kallsyms%,$^),,	 echo '  Generating build number'	  . scripts/mkversion > .tmp_version	  mv -f .tmp_version .version	  +$(call descend,init,)	) $(call cmd,vmlinux__) echo 'cmd_$@ := $(cmd_vmlinux__)' > $(@D)/.$(@F).cmd endef

define rule_vmlinux $(rule_vmlinux__) $(NM) $@ | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | sort > System.map endef

LDFLAGS_vmlinux += -T arch/$(ARCH)/vmlinux.lds.s


 * 1) 	Generate section listing all symbols and add it into vmlinux
 * 2) 	It's a three stage process:
 * 3) 	o .tmp_vmlinux1 has all symbols and sections, but __kallsyms is
 * 4) 	 empty
 * 5) 	 Running kallsyms on that gives as .tmp_kallsyms1.o with
 * 6) 	 the right size
 * 7) 	o .tmp_vmlinux2 now has a __kallsyms section of the right size,
 * 8) 	 but due to the added section, some addresses have shifted
 * 9) 	 From here, we generate a correct .tmp_kallsyms2.o
 * 10) 	o The correct .tmp_kallsyms2.o is linked into the final vmlinux.

ifdef CONFIG_KALLSYMS

kallsyms.o := .tmp_kallsyms2.o

quiet_cmd_kallsyms = KSYM   $@ cmd_kallsyms = $(KALLSYMS) $< > $@

.tmp_kallsyms1.o: .tmp_vmlinux1 $(call cmd,kallsyms)

.tmp_kallsyms2.o: .tmp_vmlinux2 $(call cmd,kallsyms)

.tmp_vmlinux1: $(vmlinux-objs) arch/$(ARCH)/vmlinux.lds.s FORCE $(call if_changed_rule,vmlinux__)

.tmp_vmlinux2: $(vmlinux-objs) .tmp_kallsyms1.o arch/$(ARCH)/vmlinux.lds.s FORCE $(call if_changed_rule,vmlinux__)

endif


 * 1) 	Finally the vmlinux rule

vmlinux: $(vmlinux-objs) $(kallsyms.o) arch/$(ARCH)/vmlinux.lds.s FORCE $(call if_changed_rule,vmlinux)


 * 1) 	The actual objects are generated when descending,
 * 2) 	make sure no implicit rule kicks in

$(sort $(vmlinux-objs)): $(SUBDIRS) ;


 * 1) 	Handle descending into subdirectories listed in $(SUBDIRS)

.PHONY: $(SUBDIRS) $(SUBDIRS): .hdepend prepare +@$(call descend,$@,)


 * 1) 	Things we need done before we descend to build or make
 * 2) 	module versions are listed in "prepare"

.PHONY: prepare prepare: include/linux/version.h include/asm include/config/MARKER @echo ' Starting the build. KBUILD_BUILTIN=$(KBUILD_BUILTIN) KBUILD_MODULES=$(KBUILD_MODULES)'


 * 1) 	This can be used by arch/$ARCH/Makefile to preprocess
 * 2) 	their vmlinux.lds.S file

AFLAGS_vmlinux.lds.o += -P -C -U$(ARCH)

arch/$(ARCH)/vmlinux.lds.s: %.s: %.S scripts FORCE $(call if_changed_dep,as_s_S)

targets += arch/$(ARCH)/vmlinux.lds.s


 * 1) Single targets

%.s: %.c scripts FORCE +@$(call descend,$(@D),$@) %.i: %.c scripts FORCE +@$(call descend,$(@D),$@) %.o: %.c scripts FORCE +@$(call descend,$(@D),$@) %.lst: %.c scripts FORCE +@$(call descend,$(@D),$@) %.s: %.S scripts FORCE +@$(call descend,$(@D),$@) %.o: %.S scripts FORCE +@$(call descend,$(@D),$@)


 * 1) 	FIXME: The asm symlink changes when $(ARCH) changes. That's
 * 2) 	hard to detect, but I suppose "make mrproper" is a good idea
 * 3) 	before switching between archs anyway.

include/asm: @echo ' Making asm->asm-$(ARCH) symlink' @ln -s asm-$(ARCH) $@


 * 1) 	Split autoconf.h into include/linux/config/*

include/config/MARKER: scripts/split-include include/linux/autoconf.h	@echo ' SPLIT  include/linux/autoconf.h -> include/config/*' @scripts/split-include include/linux/autoconf.h include/config @touch $@


 * 1) 	if .config is newer than include/linux/autoconf.h, someone tinkered
 * 2) 	with it and forgot to run make oldconfig

include/linux/autoconf.h: .config @echo '***' @echo '*** You changed .config w/o running make *config?' @echo '*** Please run "make oldconfig"' @echo '***' @exit 1


 * 1) Generate some files


 * 1) 	version.h changes when $(KERNELRELEASE) etc change, as defined in
 * 2) 	this Makefile

uts_len := 64

include/linux/version.h: Makefile @if expr length "$(KERNELRELEASE)" \> $(uts_len) >/dev/null ; then \ echo '"$(KERNELRELEASE)" exceeds $(uts_len) characters' >&2; \ exit 1; \ fi; @echo -n ' Generating $@' @(echo \#define UTS_RELEASE \"$(KERNELRELEASE)\"; \	 echo \#define LINUX_VERSION_CODE `expr $(VERSION) \\* 65536 + $(PATCHLEVEL) \\* 256 + $(SUBLEVEL)`; \	 echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))'; \	) > $@.tmp @$(update-if-changed)


 * 1) Generate module versions


 * 1) 	The targets are still named depend / dep for traditional
 * 2) 	reasons, but the only thing we do here is generating
 * 3) 	the module version checksums.

.PHONY: depend dep $(patsubst %,_sfdep_%,$(SUBDIRS))

depend dep: .hdepend


 * 1) 	.hdepend is our (misnomed) marker for whether we've
 * 2) 	generated module versions

make-versions := $(strip $(if $(filter dep depend,$(MAKECMDGOALS)),1) \			 $(if $(wildcard .hdepend),,1))

.hdepend: prepare FORCE ifneq ($(make-versions),) @$(MAKE) include/linux/modversions.h	@touch $@ endif

ifdef CONFIG_MODVERSIONS


 * 1) 	Update modversions.h, but only if it would change.

include/linux/modversions.h: FORCE @rm -rf .tmp_export-objs @$(MAKE) $(patsubst %,_sfdep_%,$(SUBDIRS)) @echo -n ' Generating $@' @( echo "#ifndef _LINUX_MODVERSIONS_H";\	  echo "#define _LINUX_MODVERSIONS_H"; \	   echo "#include "; \	   cd .tmp_export-objs >/dev/null; \	   for f in `find modules -name \*.ver -print | sort`; do \	     echo "#include "; \	   done; \	   echo "#endif"; \	) > $@.tmp; \ $(update-if-changed)

$(patsubst %,_sfdep_%,$(SUBDIRS)): FORCE +@$(call descend,$(patsubst _sfdep_%,%,$@),fastdep)

else # !CONFIG_MODVERSIONS

.PHONY: include/linux/modversions.h

include/linux/modversions.h:

endif # CONFIG_MODVERSIONS


 * 1) Modules
 * 1) Modules

ifdef CONFIG_MODULES


 * 1) 	Build modules

ifdef CONFIG_MODVERSIONS MODFLAGS += -include include/linux/modversions.h endif

.PHONY: modules modules: $(SUBDIRS)


 * 1) 	Install modules

.PHONY: modules_install modules_install: _modinst_ $(patsubst %, _modinst_%, $(SUBDIRS)) _modinst_post

.PHONY: _modinst_ _modinst_: @rm -rf $(MODLIB)/kernel @rm -f $(MODLIB)/build @mkdir -p $(MODLIB)/kernel @ln -s $(TOPDIR) $(MODLIB)/build

ifeq "$(strip $(INSTALL_MOD_PATH))" "" depmod_opts	:= else depmod_opts	:= -b $(INSTALL_MOD_PATH) -r endif .PHONY: _modinst_post _modinst_post: if [ -r System.map ]; then $(DEPMOD) -ae -F System.map $(depmod_opts) $(KERNELRELEASE); fi
 * 1) If System.map exists, run depmod.  This deliberately does not have a
 * 2) dependency on System.map since that would run the dependency tree on
 * 3) vmlinux.  This depmod is only for convenience to give the initial
 * 4) boot a modules.dep even before / is mounted read-write.  However the
 * 5) boot script depmod is the master version.

.PHONY: $(patsubst %, _modinst_%, $(SUBDIRS)) $(patsubst %, _modinst_%, $(SUBDIRS)) : +@$(call descend,$(patsubst _modinst_%,%,$@),modules_install)

else # CONFIG_MODULES


 * 1) Modules not configured

modules modules_install: FORCE @echo @echo "The present kernel configuration has modules disabled." @echo "Type 'make config' and enable loadable module support." @echo "Then build a kernel with module support enabled." @echo @exit 1

endif # CONFIG_MODULES


 * 1) Generate asm-offsets.h

define generate-asm-offsets.h	(set -e; \	 echo "#ifndef __ASM_OFFSETS_H__"; \	 echo "#define __ASM_OFFSETS_H__"; \	 echo "/*"; \	 echo " * DO NOT MODIFY."; \	 echo " *"; \	 echo " * This file was generated by arch/$(ARCH)/Makefile"; \	 echo " *"; \	 echo " */"; \	 echo ""; \	 sed -ne "/^->/{s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}"; \	 echo ""; \	 echo "#endif" ) endef


 * 1) RPM target


 * 1) 	If you do a make spec before packing the tarball you can rpm -ta it

spec: . scripts/mkspec >kernel.spec


 * 1) 	Build a tar ball, generate an rpm from it and pack the result
 * 2) 	There arw two bits of magic here
 * 3) 	1) The use of /. to avoid tar packing just the symlink
 * 4) 	2) Removing the .dep files as they have source paths in them that
 * 5) 	  will become invalid

rpm:	clean spec find. $(RCS_FIND_IGNORE) \ \( -size 0 -o -name .depend -o -name .hdepend \) \ -type f -print | xargs rm -f set -e; \ cd $(TOPDIR)/.. ; \	ln -sf $(TOPDIR) $(KERNELPATH) ; \ tar -cvz $(RCS_TAR_IGNORE) -f $(KERNELPATH).tar.gz $(KERNELPATH)/. ; \	rm $(KERNELPATH) ; \ cd $(TOPDIR) ; \ . scripts/mkversion > .version ; \ rpm -ta $(TOPDIR)/../$(KERNELPATH).tar.gz ; \ rm $(TOPDIR)/../$(KERNELPATH).tar.gz

else # ifdef include-config

ifeq ($(filter-out $(noconfig_targets),$(MAKECMDGOALS)),)


 * 1) Targets which don't need .config
 * 2) These targets basically have their own Makefile - not quite, but at
 * 3) least its own exclusive section in the same Makefile. The reason for
 * 4) this is the following:
 * 5) To know the configuration, the main Makefile has to include
 * 6) .config. That's a obviously a problem when .config doesn't exist
 * 7) yet, but that could be kludged around with only including it if it
 * 8) exists.
 * 9) However, the larger problem is: If you run make *config, make will
 * 10) include the old .config, then execute your *config. It will then
 * 11) notice that a piece it included (.config) did change and restart from
 * 12) scratch. Which will cause execution of *config again. You get the
 * 13) picture.
 * 14) If we don't explicitly let the Makefile know that .config is changed
 * 15) by *config (the old way), it won't reread .config after *config,
 * 16) thus working with possibly stale values - we don't that either.
 * 17) So we divide things: This part here is for making *config targets,
 * 18) and other targets which should work when no .config exists yet.
 * 19) The main part above takes care of the rest after a .config exists.
 * 1) So we divide things: This part here is for making *config targets,
 * 2) and other targets which should work when no .config exists yet.
 * 3) The main part above takes care of the rest after a .config exists.


 * 1) Kernel configuration

.PHONY: oldconfig xconfig menuconfig config \ make_with_config

xconfig: +@$(call descend,scripts,scripts/kconfig.tk) wish -f scripts/kconfig.tk

menuconfig: +@$(call descend,scripts,lxdialog) $(CONFIG_SHELL) $(src)/scripts/Menuconfig arch/$(ARCH)/config.in

config: $(CONFIG_SHELL) $(src)/scripts/Configure arch/$(ARCH)/config.in

oldconfig: $(CONFIG_SHELL) $(src)/scripts/Configure -d arch/$(ARCH)/config.in

randconfig: $(CONFIG_SHELL) $(src)/scripts/Configure -r arch/$(ARCH)/config.in

allyesconfig: $(CONFIG_SHELL) $(src)/scripts/Configure -y arch/$(ARCH)/config.in

allnoconfig: $(CONFIG_SHELL) $(src)/scripts/Configure -n arch/$(ARCH)/config.in

allmodconfig: $(CONFIG_SHELL) $(src)/scripts/Configure -m arch/$(ARCH)/config.in

defconfig: yes '' | $(CONFIG_SHELL) $(src)/scripts/Configure -d arch/$(ARCH)/config.in


 * 1) Cleaning is done on three levels.
 * 2) make clean     Delete all automatically generated files, including
 * 3)                tools and firmware.
 * 4) make mrproper  Delete the current configuration, and related files
 * 5)                Any core files spread around is deleted as well
 * 6) make distclean Remove editor backup files, patch leftover files and the like
 * 1) make distclean Remove editor backup files, patch leftover files and the like

CLEAN_FILES += vmlinux System.map MC*
 * 1) Files removed with 'make clean'

MRPROPER_FILES += \ include/linux/autoconf.h include/linux/version.h \ .version .config .config.old config.in config.old \ .menuconfig.log \ include/asm \ .hdepend include/linux/modversions.h \ tags TAGS kernel.spec \ .tmp*
 * 1) Files removed with 'make mrproper'

MRPROPER_DIRS += \ .tmp_export-objs \ include/config \ include/linux/modules
 * 1) Directories removed with 'make mrproper'

clean-dirs += $(ALL_SUBDIRS) Documentation/DocBook scripts
 * 1) clean - Delete all intermediate files

$(addprefix _clean_,$(clean-dirs)): $(MAKE) MAKEFILES= -rR -f scripts/Makefile.clean obj=$(patsubst _clean_%,%,$@)

quiet_cmd_rmclean = RM $$(CLEAN_FILES) cmd_rmclean	 = rm -f $(CLEAN_FILES) clean: archclean $(addprefix _clean_,$(clean-dirs)) $(call cmd,rmclean) @find. $(RCS_FIND_IGNORE) \ \( -name '*.[oas]' -o -name '.*.cmd' -o -name '.*.d' \		-o -name '.*.tmp' \) -type f -print | xargs rm -f

quiet_cmd_mrproper = RM $$(MRPROPER_DIRS) + $$(MRPROPER_FILES) cmd_mrproper = rm -rf $(MRPROPER_DIRS) && rm -f $(MRPROPER_FILES) mrproper distclean: clean archmrproper @echo ' Making $@ in the srctree' @find. $(RCS_FIND_IGNORE) \ \( -name '*.orig' -o -name '*.rej' -o -name '*~' \		-o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \	 	-o -name '.*.rej' -o -size 0 \		-o -name '*%' -o -name '.*.cmd' -o -name 'core' \) \ -type f -print | xargs rm -f $(call cmd,mrproper)
 * 1) mrproper - delete configuration + modules + core files


 * 1) Generate tags for editors

define all-sources ( find . $(RCS_FIND_IGNORE) \	      \( -name include -o -name arch \) -prune -o \	       -name '*.[chS]' -print; \	  find arch/$(ARCH) $(RCS_FIND_IGNORE) \	       -name '*.[chS]' -print; \	  find include $(RCS_FIND_IGNORE) \	       \( -name config -o -name 'asm-*' \) -prune \	       -o -name '*.[chS]' -print; \	  find include/asm-$(ARCH) $(RCS_FIND_IGNORE) \	       -name '*.[chS]' -print; \	  find include/asm-generic $(RCS_FIND_IGNORE) \	       -name '*.[chS]' -print ) endef

quiet_cmd_TAGS = MAKE  $@ cmd_TAGS = $(all-sources) | etags -


 * 1) 	Exuberant ctags works better with -I

quiet_cmd_tags = MAKE  $@ define cmd_tags rm -f $@; \ CTAGSF=`ctags --version | grep -i exuberant >/dev/null && echo "-I __initdata,__exitdata,EXPORT_SYMBOL,EXPORT_SYMBOL_NOVERS"`; \ $(all-sources) | xargs ctags $$CTAGSF -a endef

TAGS: FORCE $(call cmd,TAGS)

tags: FORCE $(call cmd,tags)


 * 1) Brief documentation of the typical targets used

help: @echo 'Cleaning targets:' @echo '  clean		- remove most generated files but keep the config' @echo '  mrproper	- remove all generated files including the config' @echo '  distclean	- mrproper + remove files generated by editors and patch' @echo '' @echo 'Configuration targets:' @echo '  oldconfig	- Update current config utilising a line-oriented program' @echo '  menuconfig	- Update current config utilising a menu based program' @echo '  xconfig	- Update current config utilising a X-based program' @echo '  defconfig	- New config with default answer to all options' @echo '  allmodconfig	- New config selecting modules when possible' @echo '  allyesconfig	- New config where all options are accepted with yes' @echo '  allnoconfig	- New minimal config' @echo '' @echo 'Other generic targets:' @echo '  all		- Build all targets marked with [*]' @echo '  dep           - Create module version information' @echo '* vmlinux	- Build the bare kernel' @echo '* modules	- Build all modules' @echo '  dir/file.[ois]- Build specified target only' @echo '  rpm		- Build a kernel as an RPM package' @echo '  tags/TAGS	- Generate tags file for editors' @echo '' @echo 'Documentation targets:' @$(MAKE) --no-print-directory -f Documentation/DocBook/Makefile dochelp @echo '' @echo 'Architecture specific targets ($(ARCH)):' @$(MAKE) --no-print-directory -f arch/$(ARCH)/boot/Makefile archhelp @echo '' @echo 'Execute "make" or "make all" to build all targets marked with [*] ' @echo 'For further info browse Documentation/kbuild/*'

sgmldocs psdocs pdfdocs htmldocs: scripts +@$(call descend,Documentation/DocBook,$@)
 * 1) Documentation targets


 * 1) Scripts to check various things for consistency

checkconfig: find * $(RCS_FIND_IGNORE) \ -name '*.[hcS]' -type f -print | sort \ | xargs $(PERL) -w scripts/checkconfig.pl

checkhelp: find * $(RCS_FIND_IGNORE) \ -name [cC]onfig.in -print | sort \ | xargs $(PERL) -w scripts/checkhelp.pl

checkincludes: find * $(RCS_FIND_IGNORE) \ -name '*.[hcS]' -type f -print | sort \ | xargs $(PERL) -w scripts/checkincludes.pl

else # ifneq ($(filter-out $(noconfig_targets),$(MAKECMDGOALS)),)


 * 1) We're called with both targets which do and do not need
 * 2) .config included. Handle them one after the other.

%:: FORCE $(MAKE) $@

endif # ifeq ($(filter-out $(noconfig_targets),$(MAKECMDGOALS)),) endif # ifdef include-config


 * 1) FIXME Should go into a make.lib or something

echo_target = $@

a_flags = -Wp,-MD,$(depfile) $(AFLAGS) $(NOSTDINC_FLAGS) \ $(modkern_aflags) $(EXTRA_AFLAGS) $(AFLAGS_$(*F).o)

quiet_cmd_as_s_S = CPP    $(echo_target) cmd_as_s_S      = $(CPP) $(a_flags)   -o $@ $<


 * 1) read all saved command lines

targets := $(wildcard $(sort $(targets))) cmd_files := $(wildcard .*.cmd $(foreach f,$(targets),$(dir $(f)).$(notdir $(f)).cmd))

ifneq ($(cmd_files),) include $(cmd_files) endif


 * 1) execute the command and also postprocess generated .d dependencies
 * 2) file

if_changed_dep = $(if $(strip $? $(filter-out FORCE $(wildcard $^),$^)\ $(filter-out $(cmd_$(1)),$(cmd_$@))\ $(filter-out $(cmd_$@),$(cmd_$(1)))),\	@set -e; \	$(if $($(quiet)cmd_$(1)),echo ' $($(quiet)cmd_$(1))';) \	$(cmd_$(1)); \	scripts/fixdep $(depfile) $@ '$(cmd_$(1))' > $(@D)/.$(@F).tmp; \	rm -f $(depfile); \	mv -f $(@D)/.$(@F).tmp $(@D)/.$(@F).cmd)


 * 1) Usage: $(call if_changed_rule,foo)
 * 2) will check if $(cmd_foo) changed, or any of the prequisites changed,
 * 3) and if so will execute $(rule_foo)

if_changed_rule = $(if $(strip $? \		              $(filter-out $(cmd_$(1)),$(cmd_$(@F)))\ $(filter-out $(cmd_$(@F)),$(cmd_$(1)))),\	              @$(rule_$(1)))


 * 1) If quiet is set, only print short version of command

cmd = @$(if $($(quiet)cmd_$(1)),echo ' $($(quiet)cmd_$(1))' &&) $(cmd_$(1))

define update-if-changed if [ -r $@ ] && cmp -s $@ $@.tmp; then \ echo ' (unchanged)'; \ rm -f $@.tmp; \ else \ echo ' (updated)'; \ mv -f $@.tmp $@; \ fi endef


 * 1) 	$(call descend,, )
 * 2) 	Recursively call a sub-make in with target

ifeq ($(KBUILD_VERBOSE),1) descend = echo '$(MAKE) -f $(1)/Makefile $(2)'; endif descend += $(MAKE) -f $(1)/Makefile obj=$(1) $(2)

FORCE: