Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2e1ca21d authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge master.kernel.org:/pub/scm/linux/kernel/git/sam/kbuild

* master.kernel.org:/pub/scm/linux/kernel/git/sam/kbuild: (46 commits)
  kbuild: remove obsoleted scripts/reference_* files
  kbuild: fix make help & make *pkg
  kconfig: fix time ordering of writes to .kconfig.d and include/linux/autoconf.h
  Kconfig: remove the CONFIG_CC_ALIGN_* options
  kbuild: add -fverbose-asm to i386 Makefile
  kbuild: clean-up genksyms
  kbuild: Lindent genksyms.c
  kbuild: fix genksyms build error
  kbuild: in makefile.txt note that Makefile is preferred name for kbuild files
  kbuild: replace PHONY with FORCE
  kbuild: Fix bug in crc symbol generating of kernel and modules
  kbuild: change kbuild to not rely on incorrect GNU make behavior
  kbuild: when warning symbols exported twice now tell user this is the problem
  kbuild: fix make dir/file.xx when asm symlink is missing
  kbuild: in the section mismatch check try harder to find symbols
  kbuild: fix section mismatch check for unwind on IA64
  kbuild: kill false positives from section mismatch warnings for powerpc
  kbuild: kill trailing whitespace in modpost & friends
  kbuild: small update of allnoconfig description
  kbuild: make namespace.pl CROSS_COMPILE happy
  ...

Trivial conflict in arch/ppc/boot/Makefile manually fixed up
parents 315ab19a eae0f536
Loading
Loading
Loading
Loading
+7 −1
Original line number Original line Diff line number Diff line
@@ -28,7 +28,7 @@ PS_METHOD = $(prefer-db2x)


###
###
# The targets that may be used.
# The targets that may be used.
.PHONY:	xmldocs sgmldocs psdocs pdfdocs htmldocs mandocs installmandocs
PHONY += xmldocs sgmldocs psdocs pdfdocs htmldocs mandocs installmandocs


BOOKS := $(addprefix $(obj)/,$(DOCBOOKS))
BOOKS := $(addprefix $(obj)/,$(DOCBOOKS))
xmldocs: $(BOOKS)
xmldocs: $(BOOKS)
@@ -211,3 +211,9 @@ clean-dirs := $(patsubst %.xml,%,$(DOCBOOKS))


#man put files in man subdir - traverse down
#man put files in man subdir - traverse down
subdir- := man/
subdir- := man/


# Declare the contents of the .PHONY variable as phony.  We keep that
# information in a variable se we can use it in if_changed and friends.

.PHONY: $(PHONY)
+100 −72
Original line number Original line Diff line number Diff line
@@ -17,6 +17,7 @@ This document describes the Linux kernel Makefiles.
	   --- 3.8 Command line dependency
	   --- 3.8 Command line dependency
	   --- 3.9 Dependency tracking
	   --- 3.9 Dependency tracking
	   --- 3.10 Special Rules
	   --- 3.10 Special Rules
	   --- 3.11 $(CC) support functions


	=== 4 Host Program support
	=== 4 Host Program support
	   --- 4.1 Simple Host Program
	   --- 4.1 Simple Host Program
@@ -38,7 +39,6 @@ This document describes the Linux kernel Makefiles.
	   --- 6.6 Commands useful for building a boot image
	   --- 6.6 Commands useful for building a boot image
	   --- 6.7 Custom kbuild commands
	   --- 6.7 Custom kbuild commands
	   --- 6.8 Preprocessing linker scripts
	   --- 6.8 Preprocessing linker scripts
	   --- 6.9 $(CC) support functions


	=== 7 Kbuild Variables
	=== 7 Kbuild Variables
	=== 8 Makefile language
	=== 8 Makefile language
@@ -106,9 +106,9 @@ This document is aimed towards normal developers and arch developers.
Most Makefiles within the kernel are kbuild Makefiles that use the
Most Makefiles within the kernel are kbuild Makefiles that use the
kbuild infrastructure. This chapter introduce the syntax used in the
kbuild infrastructure. This chapter introduce the syntax used in the
kbuild makefiles.
kbuild makefiles.
The preferred name for the kbuild files is 'Kbuild' but 'Makefile' will
The preferred name for the kbuild files are 'Makefile' but 'Kbuild' can
continue to be supported. All new developmen is expected to use the
be used and if both a 'Makefile' and a 'Kbuild' file exists then the 'Kbuild'
Kbuild filename.
file will be used.


Section 3.1 "Goal definitions" is a quick intro, further chapters provide
Section 3.1 "Goal definitions" is a quick intro, further chapters provide
more details, with real examples.
more details, with real examples.
@@ -385,6 +385,102 @@ more details, with real examples.
	to prerequisites are referenced with $(src) (because they are not
	to prerequisites are referenced with $(src) (because they are not
	generated files).
	generated files).


--- 3.11 $(CC) support functions

	The kernel may be build with several different versions of
	$(CC), each supporting a unique set of features and options.
	kbuild provide basic support to check for valid options for $(CC).
	$(CC) is useally the gcc compiler, but other alternatives are
	available.

    as-option
    	as-option is used to check if $(CC) when used to compile
	assembler (*.S) files supports the given option. An optional
	second option may be specified if first option are not supported.

	Example:
		#arch/sh/Makefile
		cflags-y += $(call as-option,-Wa$(comma)-isa=$(isa-y),)

	In the above example cflags-y will be assinged the the option
	-Wa$(comma)-isa=$(isa-y) if it is supported by $(CC).
	The second argument is optional, and if supplied will be used
	if first argument is not supported.

    cc-option
	cc-option is used to check if $(CC) support a given option, and not
	supported to use an optional second option.

	Example:
		#arch/i386/Makefile
		cflags-y += $(call cc-option,-march=pentium-mmx,-march=i586)

	In the above example cflags-y will be assigned the option
	-march=pentium-mmx if supported by $(CC), otherwise -march-i586.
	The second argument to cc-option is optional, and if omitted
	cflags-y will be assigned no value if first option is not supported.

   cc-option-yn
   	cc-option-yn is used to check if gcc supports a given option
	and return 'y' if supported, otherwise 'n'.

	Example:
		#arch/ppc/Makefile
		biarch := $(call cc-option-yn, -m32)
		aflags-$(biarch) += -a32
		cflags-$(biarch) += -m32
	
	In the above example $(biarch) is set to y if $(CC) supports the -m32
	option. When $(biarch) equals to y the expanded variables $(aflags-y)
	and $(cflags-y) will be assigned the values -a32 and -m32.

    cc-option-align
	gcc version >= 3.0 shifted type of options used to speify
	alignment of functions, loops etc. $(cc-option-align) whrn used
	as prefix to the align options will select the right prefix:
	gcc < 3.00
		cc-option-align = -malign
	gcc >= 3.00
		cc-option-align = -falign
	
	Example:
		CFLAGS += $(cc-option-align)-functions=4

	In the above example the option -falign-functions=4 is used for
	gcc >= 3.00. For gcc < 3.00 -malign-functions=4 is used.
	
    cc-version
	cc-version return a numerical version of the $(CC) compiler version.
	The format is <major><minor> where both are two digits. So for example
	gcc 3.41 would return 0341.
	cc-version is useful when a specific $(CC) version is faulty in one
	area, for example the -mregparm=3 were broken in some gcc version
	even though the option was accepted by gcc.

	Example:
		#arch/i386/Makefile
		cflags-y += $(shell \
		if [ $(call cc-version) -ge 0300 ] ; then \
			echo "-mregparm=3"; fi ;)

	In the above example -mregparm=3 is only used for gcc version greater
	than or equal to gcc 3.0.

    cc-ifversion
	cc-ifversion test the version of $(CC) and equals last argument if
	version expression is true.

	Example:
		#fs/reiserfs/Makefile
		EXTRA_CFLAGS := $(call cc-ifversion, -lt, 0402, -O1)

	In this example EXTRA_CFLAGS will be assigned the value -O1 if the
	$(CC) version is less than 4.2.
	cc-ifversion takes all the shell operators: 
	-eq, -ne, -lt, -le, -gt, and -ge
	The third parameter may be a text as in this example, but it may also
	be an expanded variable or a macro.



=== 4 Host Program support
=== 4 Host Program support


@@ -973,74 +1069,6 @@ When kbuild executes the following steps are followed (roughly):
	architecture specific files.
	architecture specific files.




--- 6.9 $(CC) support functions

	The kernel may be build with several different versions of
	$(CC), each supporting a unique set of features and options.
	kbuild provide basic support to check for valid options for $(CC).
	$(CC) is useally the gcc compiler, but other alternatives are
	available.

    cc-option
	cc-option is used to check if $(CC) support a given option, and not
	supported to use an optional second option.

	Example:
		#arch/i386/Makefile
		cflags-y += $(call cc-option,-march=pentium-mmx,-march=i586)

	In the above example cflags-y will be assigned the option
	-march=pentium-mmx if supported by $(CC), otherwise -march-i586.
	The second argument to cc-option is optional, and if omitted
	cflags-y will be assigned no value if first option is not supported.

   cc-option-yn
   	cc-option-yn is used to check if gcc supports a given option
	and return 'y' if supported, otherwise 'n'.

	Example:
		#arch/ppc/Makefile
		biarch := $(call cc-option-yn, -m32)
		aflags-$(biarch) += -a32
		cflags-$(biarch) += -m32
	
	In the above example $(biarch) is set to y if $(CC) supports the -m32
	option. When $(biarch) equals to y the expanded variables $(aflags-y)
	and $(cflags-y) will be assigned the values -a32 and -m32.

    cc-option-align
	gcc version >= 3.0 shifted type of options used to speify
	alignment of functions, loops etc. $(cc-option-align) whrn used
	as prefix to the align options will select the right prefix:
	gcc < 3.00
		cc-option-align = -malign
	gcc >= 3.00
		cc-option-align = -falign
	
	Example:
		CFLAGS += $(cc-option-align)-functions=4

	In the above example the option -falign-functions=4 is used for
	gcc >= 3.00. For gcc < 3.00 -malign-functions=4 is used.
	
    cc-version
	cc-version return a numerical version of the $(CC) compiler version.
	The format is <major><minor> where both are two digits. So for example
	gcc 3.41 would return 0341.
	cc-version is useful when a specific $(CC) version is faulty in one
	area, for example the -mregparm=3 were broken in some gcc version
	even though the option was accepted by gcc.

	Example:
		#arch/i386/Makefile
		cflags-y += $(shell \
		if [ $(call cc-version) -ge 0300 ] ; then \
			echo "-mregparm=3"; fi ;)

	In the above example -mregparm=3 is only used for gcc version greater
	than or equal to gcc 3.0.
	

=== 7 Kbuild Variables
=== 7 Kbuild Variables


The top Makefile exports the following variables:
The top Makefile exports the following variables:
+91 −7
Original line number Original line Diff line number Diff line
@@ -13,6 +13,7 @@ In this document you will find information about:
	   --- 2.2 Available targets
	   --- 2.2 Available targets
	   --- 2.3 Available options
	   --- 2.3 Available options
	   --- 2.4 Preparing the kernel tree for module build
	   --- 2.4 Preparing the kernel tree for module build
	   --- 2.5 Building separate files for a module
	=== 3. Example commands
	=== 3. Example commands
	=== 4. Creating a kbuild file for an external module
	=== 4. Creating a kbuild file for an external module
	=== 5. Include files
	=== 5. Include files
@@ -22,7 +23,10 @@ In this document you will find information about:
	=== 6. Module installation
	=== 6. Module installation
	   --- 6.1 INSTALL_MOD_PATH
	   --- 6.1 INSTALL_MOD_PATH
	   --- 6.2 INSTALL_MOD_DIR
	   --- 6.2 INSTALL_MOD_DIR
	=== 7. Module versioning
	=== 7. Module versioning & Module.symvers
	   --- 7.1 Symbols fron the kernel (vmlinux + modules)
	   --- 7.2 Symbols and external modules
	   --- 7.3 Symbols from another external module
	=== 8. Tips & Tricks
	=== 8. Tips & Tricks
	   --- 8.1 Testing for CONFIG_FOO_BAR
	   --- 8.1 Testing for CONFIG_FOO_BAR


@@ -88,7 +92,8 @@ when building an external module.
	make -C $KDIR M=$PWD modules_install
	make -C $KDIR M=$PWD modules_install
		Install the external module(s).
		Install the external module(s).
		Installation default is in /lib/modules/<kernel-version>/extra,
		Installation default is in /lib/modules/<kernel-version>/extra,
		but may be prefixed with INSTALL_MOD_PATH - see separate chapter.
		but may be prefixed with INSTALL_MOD_PATH - see separate
		chapter.


	make -C $KDIR M=$PWD clean
	make -C $KDIR M=$PWD clean
		Remove all generated files for the module - the kernel
		Remove all generated files for the module - the kernel
@@ -131,6 +136,16 @@ when building an external module.
	      Therefore a full kernel build needs to be executed to make
	      Therefore a full kernel build needs to be executed to make
	      module versioning work.
	      module versioning work.


--- 2.5 Building separate files for a module
	It is possible to build single files which is part of a module.
	This works equal for the kernel, a module and even for external
	modules.
	Examples (module foo.ko, consist of bar.o, baz.o):
		make -C $KDIR M=`pwd` bar.lst
		make -C $KDIR M=`pwd` bar.o
		make -C $KDIR M=`pwd` foo.ko
		make -C $KDIR M=`pwd` /
	


=== 3. Example commands
=== 3. Example commands


@@ -422,7 +437,7 @@ External modules are installed in the directory:
		=> Install dir: /lib/modules/$(KERNELRELEASE)/gandalf
		=> Install dir: /lib/modules/$(KERNELRELEASE)/gandalf




=== 7. Module versioning
=== 7. Module versioning & Module.symvers


Module versioning is enabled by the CONFIG_MODVERSIONS tag.
Module versioning is enabled by the CONFIG_MODVERSIONS tag.


@@ -432,10 +447,79 @@ when a module is loaded/used then the CRC values contained in the kernel are
compared with similar values in the module. If they are not equal then the
compared with similar values in the module. If they are not equal then the
kernel refuses to load the module.
kernel refuses to load the module.


During a kernel build a file named Module.symvers will be generated. This
Module.symvers contains a list of all exported symbols from a kernel build.
file includes the symbol version of all symbols within the kernel. If the 

Module.symvers file is saved from the last full kernel compile one does not
--- 7.1 Symbols fron the kernel (vmlinux + modules)
have to do a full kernel compile to build a module version's compatible module.

	During a kernel build a file named Module.symvers will be generated.
	Module.symvers contains all exported symbols from the kernel and
	compiled modules. For each symbols the corresponding CRC value
	is stored too.

	The syntax of the Module.symvers file is:
		<CRC>       <Symbol>           <module>
	Sample:
		0x2d036834  scsi_remove_host   drivers/scsi/scsi_mod

	For a kernel build without CONFIG_MODVERSIONING enabled the crc
	would read: 0x00000000

	Module.symvers serve two purposes.
	1) It list all exported symbols both from vmlinux and all modules
	2) It list CRC if CONFIG_MODVERSION is enabled

--- 7.2 Symbols and external modules

	When building an external module the build system needs access to
	the symbols from the kernel to check if all external symbols are
	defined. This is done in the MODPOST step and to obtain all
	symbols modpost reads Module.symvers from the kernel.
	If a Module.symvers file is present in the directory where
	the external module is being build this file will be read too.
	During the MODPOST step a new Module.symvers file will be written
	containing all exported symbols that was not defined in the kernel.
	
--- 7.3 Symbols from another external module

	Sometimes one external module uses exported symbols from another
	external module. Kbuild needs to have full knowledge on all symbols
	to avoid spitting out warnings about undefined symbols.
	Two solutions exist to let kbuild know all symbols of more than
	one external module.
	The method with a top-level kbuild file is recommended but may be
	impractical in certain situations.

	Use a top-level Kbuild file
		If you have two modules: 'foo', 'bar' and 'foo' needs symbols
		from 'bar' then one can use a common top-level kbuild file so
		both modules are compiled in same build.

		Consider following directory layout:
		./foo/ <= contains the foo module
		./bar/ <= contains the bar module
		The top-level Kbuild file would then look like:
		
		#./Kbuild: (this file may also be named Makefile)
			obj-y := foo/ bar/

		Executing:
			make -C $KDIR M=`pwd`

		will then do the expected and compile both modules with full
		knowledge on symbols from both modules.

	Use an extra Module.symvers file
		When an external module is build a Module.symvers file is
		generated containing all exported symbols which are not
		defined in the kernel.
		To get access to symbols from module 'bar' one can copy the
		Module.symvers file from the compilation of the 'bar' module
		to the directory where the 'foo' module is build.
		During the module build kbuild will read the Module.symvers
		file in the directory of the external module and when the
		build is finished a new Module.symvers file is created
		containing the sum of all symbols defined and not part of the
		kernel.
		
		
=== 8. Tips & Tricks
=== 8. Tips & Tricks


+0 −4
Original line number Original line Diff line number Diff line
@@ -56,10 +56,6 @@ Here is the solution:
    writing one file per option.  It updates only the files for options
    writing one file per option.  It updates only the files for options
    that have changed.
    that have changed.


    mkdep.c no longer generates warning messages for missing or unneeded
    <linux/config.h> lines.  The new top-level target 'make checkconfig'
    checks for these problems.

Flag Dependencies
Flag Dependencies


    Martin Von Loewis contributed another feature to this patch:
    Martin Von Loewis contributed another feature to this patch:
+99 −98
Original line number Original line Diff line number Diff line
@@ -95,7 +95,7 @@ ifdef O
endif
endif


# That's our default target when none is given on the command line
# That's our default target when none is given on the command line
.PHONY: _all
PHONY := _all
_all:
_all:


ifneq ($(KBUILD_OUTPUT),)
ifneq ($(KBUILD_OUTPUT),)
@@ -106,7 +106,7 @@ KBUILD_OUTPUT := $(shell cd $(KBUILD_OUTPUT) && /bin/pwd)
$(if $(KBUILD_OUTPUT),, \
$(if $(KBUILD_OUTPUT),, \
     $(error output directory "$(saved-output)" does not exist))
     $(error output directory "$(saved-output)" does not exist))


.PHONY: $(MAKECMDGOALS)
PHONY += $(MAKECMDGOALS)


$(filter-out _all,$(MAKECMDGOALS)) _all:
$(filter-out _all,$(MAKECMDGOALS)) _all:
	$(if $(KBUILD_VERBOSE:1=),@)$(MAKE) -C $(KBUILD_OUTPUT) \
	$(if $(KBUILD_VERBOSE:1=),@)$(MAKE) -C $(KBUILD_OUTPUT) \
@@ -123,7 +123,7 @@ ifeq ($(skip-makefile),)


# If building an external module we do not care about the all: rule
# If building an external module we do not care about the all: rule
# but instead _all depend on modules
# but instead _all depend on modules
.PHONY: all
PHONY += all
ifeq ($(KBUILD_EXTMOD),)
ifeq ($(KBUILD_EXTMOD),)
_all: all
_all: all
else
else
@@ -137,7 +137,7 @@ objtree := $(CURDIR)
src		:= $(srctree)
src		:= $(srctree)
obj		:= $(objtree)
obj		:= $(objtree)


VPATH		:= $(srctree)
VPATH		:= $(srctree)$(if $(KBUILD_EXTMOD),:$(KBUILD_EXTMOD))


export srctree objtree VPATH TOPDIR
export srctree objtree VPATH TOPDIR


@@ -151,7 +151,7 @@ export srctree objtree VPATH TOPDIR
SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
				  -e s/arm.*/arm/ -e s/sa110/arm/ \
				  -e s/arm.*/arm/ -e s/sa110/arm/ \
				  -e s/s390x/s390/ -e s/parisc64/parisc/ \
				  -e s/s390x/s390/ -e s/parisc64/parisc/ \
				  -e s/ppc.*/powerpc/ )
				  -e s/ppc.*/powerpc/ -e s/mips.*/mips/ )


# Cross compiling and selecting different set of gcc/bin-utils
# Cross compiling and selecting different set of gcc/bin-utils
# ---------------------------------------------------------------------------
# ---------------------------------------------------------------------------
@@ -258,38 +258,6 @@ endif


export quiet Q KBUILD_VERBOSE
export quiet Q KBUILD_VERBOSE


######
# cc support functions to be used (only) in arch/$(ARCH)/Makefile
# See documentation in Documentation/kbuild/makefiles.txt

# as-option
# Usage: cflags-y += $(call as-option, -Wa$(comma)-isa=foo,)

as-option = $(shell if $(CC) $(CFLAGS) $(1) -Wa,-Z -c -o /dev/null \
	     -xassembler /dev/null > /dev/null 2>&1; then echo "$(1)"; \
	     else echo "$(2)"; fi ;)

# cc-option
# Usage: cflags-y += $(call cc-option, -march=winchip-c6, -march=i586)

cc-option = $(shell if $(CC) $(CFLAGS) $(1) -S -o /dev/null -xc /dev/null \
             > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;)

# cc-option-yn
# Usage: flag := $(call cc-option-yn, -march=winchip-c6)
cc-option-yn = $(shell if $(CC) $(CFLAGS) $(1) -S -o /dev/null -xc /dev/null \
                > /dev/null 2>&1; then echo "y"; else echo "n"; fi;)

# cc-option-align
# Prefix align with either -falign or -malign
cc-option-align = $(subst -functions=0,,\
	$(call cc-option,-falign-functions=0,-malign-functions=0))

# cc-version
# Usage gcc-ver := $(call cc-version $(CC))
cc-version = $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-version.sh \
              $(if $(1), $(1), $(CC)))



# Look for make include files relative to root of kernel src
# Look for make include files relative to root of kernel src
MAKEFLAGS += --include-dir=$(srctree)
MAKEFLAGS += --include-dir=$(srctree)
@@ -369,14 +337,14 @@ export RCS_TAR_IGNORE := --exclude SCCS --exclude BitKeeper --exclude .svn --exc
# Rules shared between *config targets and build targets
# Rules shared between *config targets and build targets


# Basic helpers built in scripts/
# Basic helpers built in scripts/
.PHONY: scripts_basic
PHONY += scripts_basic
scripts_basic:
scripts_basic:
	$(Q)$(MAKE) $(build)=scripts/basic
	$(Q)$(MAKE) $(build)=scripts/basic


# To avoid any implicit rule to kick in, define an empty command.
# To avoid any implicit rule to kick in, define an empty command.
scripts/basic/%: scripts_basic ;
scripts/basic/%: scripts_basic ;


.PHONY: outputmakefile
PHONY += outputmakefile
# outputmakefile generate a Makefile to be placed in output directory, if
# outputmakefile generate a Makefile to be placed in output directory, if
# using a seperate output directory. This allows convinient use
# using a seperate output directory. This allows convinient use
# of make in output directory
# of make in output directory
@@ -452,7 +420,7 @@ ifeq ($(KBUILD_EXTMOD),)
# Additional helpers built in scripts/
# Additional helpers built in scripts/
# Carefully list dependencies so we do not try to build scripts twice
# Carefully list dependencies so we do not try to build scripts twice
# in parrallel
# in parrallel
.PHONY: scripts
PHONY += scripts
scripts: scripts_basic include/config/MARKER
scripts: scripts_basic include/config/MARKER
	$(Q)$(MAKE) $(build)=$(@)
	$(Q)$(MAKE) $(build)=$(@)


@@ -504,13 +472,6 @@ else
CFLAGS		+= -O2
CFLAGS		+= -O2
endif
endif


#Add align options if CONFIG_CC_* is not equal to 0
add-align = $(if $(filter-out 0,$($(1))),$(cc-option-align)$(2)=$($(1)))
CFLAGS		+= $(call add-align,CONFIG_CC_ALIGN_FUNCTIONS,-functions)
CFLAGS		+= $(call add-align,CONFIG_CC_ALIGN_LABELS,-labels)
CFLAGS		+= $(call add-align,CONFIG_CC_ALIGN_LOOPS,-loops)
CFLAGS		+= $(call add-align,CONFIG_CC_ALIGN_JUMPS,-jumps)

ifdef CONFIG_FRAME_POINTER
ifdef CONFIG_FRAME_POINTER
CFLAGS		+= -fno-omit-frame-pointer $(call cc-option,-fno-optimize-sibling-calls,)
CFLAGS		+= -fno-omit-frame-pointer $(call cc-option,-fno-optimize-sibling-calls,)
else
else
@@ -756,7 +717,7 @@ $(sort $(vmlinux-init) $(vmlinux-main)) $(vmlinux-lds): $(vmlinux-dirs) ;
# make menuconfig etc.
# make menuconfig etc.
# Error messages still appears in the original language
# Error messages still appears in the original language


.PHONY: $(vmlinux-dirs)
PHONY += $(vmlinux-dirs)
$(vmlinux-dirs): prepare scripts
$(vmlinux-dirs): prepare scripts
	$(Q)$(MAKE) $(build)=$@
	$(Q)$(MAKE) $(build)=$@


@@ -809,10 +770,10 @@ kernelrelease = $(KERNELVERSION)$(localver-full)
# version.h and scripts_basic is processed / created.
# version.h and scripts_basic is processed / created.


# Listed in dependency order
# Listed in dependency order
.PHONY: prepare archprepare prepare0 prepare1 prepare2 prepare3
PHONY += prepare archprepare prepare0 prepare1 prepare2 prepare3


# prepare-all is deprecated, use prepare as valid replacement
# prepare-all is deprecated, use prepare as valid replacement
.PHONY: prepare-all
PHONY += prepare-all


# prepare3 is used to check if we are building in a separate output directory,
# prepare3 is used to check if we are building in a separate output directory,
# and if so do:
# and if so do:
@@ -853,27 +814,6 @@ prepare prepare-all: prepare0


export CPPFLAGS_vmlinux.lds += -P -C -U$(ARCH)
export CPPFLAGS_vmlinux.lds += -P -C -U$(ARCH)


# Single targets
# ---------------------------------------------------------------------------

%.s: %.c scripts FORCE
	$(Q)$(MAKE) $(build)=$(@D) $@
%.i: %.c scripts FORCE
	$(Q)$(MAKE) $(build)=$(@D) $@
%.o: %.c scripts FORCE
	$(Q)$(MAKE) $(build)=$(@D) $@
%.ko: scripts FORCE
	$(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) $(build)=$(@D) $(@:.ko=.o)
	$(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modpost
%/:      scripts prepare FORCE
	$(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) $(build)=$(@D)
%.lst: %.c scripts FORCE
	$(Q)$(MAKE) $(build)=$(@D) $@
%.s: %.S scripts FORCE
	$(Q)$(MAKE) $(build)=$(@D) $@
%.o: %.S scripts FORCE
	$(Q)$(MAKE) $(build)=$(@D) $@

# 	FIXME: The asm symlink changes when $(ARCH) changes. That's
# 	FIXME: The asm symlink changes when $(ARCH) changes. That's
#	hard to detect, but I suppose "make mrproper" is a good idea
#	hard to detect, but I suppose "make mrproper" is a good idea
#	before switching between archs anyway.
#	before switching between archs anyway.
@@ -914,7 +854,7 @@ include/linux/version.h: $(srctree)/Makefile .config .kernelrelease FORCE


# ---------------------------------------------------------------------------
# ---------------------------------------------------------------------------


.PHONY: depend dep
PHONY += depend dep
depend dep:
depend dep:
	@echo '*** Warning: make $@ is unnecessary now.'
	@echo '*** Warning: make $@ is unnecessary now.'


@@ -929,21 +869,21 @@ all: modules


#	Build modules
#	Build modules


.PHONY: modules
PHONY += modules
modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux)
modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux)
	@echo '  Building modules, stage 2.';
	@echo '  Building modules, stage 2.';
	$(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modpost
	$(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modpost




# Target to prepare building external modules
# Target to prepare building external modules
.PHONY: modules_prepare
PHONY += modules_prepare
modules_prepare: prepare scripts
modules_prepare: prepare scripts


# Target to install modules
# Target to install modules
.PHONY: modules_install
PHONY += modules_install
modules_install: _modinst_ _modinst_post
modules_install: _modinst_ _modinst_post


.PHONY: _modinst_
PHONY += _modinst_
_modinst_:
_modinst_:
	@if [ -z "`$(DEPMOD) -V 2>/dev/null | grep module-init-tools`" ]; then \
	@if [ -z "`$(DEPMOD) -V 2>/dev/null | grep module-init-tools`" ]; then \
		echo "Warning: you may need to install module-init-tools"; \
		echo "Warning: you may need to install module-init-tools"; \
@@ -970,7 +910,7 @@ depmod_opts :=
else
else
depmod_opts	:= -b $(INSTALL_MOD_PATH) -r
depmod_opts	:= -b $(INSTALL_MOD_PATH) -r
endif
endif
.PHONY: _modinst_post
PHONY += _modinst_post
_modinst_post: _modinst_
_modinst_post: _modinst_
	if [ -r System.map -a -x $(DEPMOD) ]; then $(DEPMOD) -ae -F System.map $(depmod_opts) $(KERNELRELEASE); fi
	if [ -r System.map -a -x $(DEPMOD) ]; then $(DEPMOD) -ae -F System.map $(depmod_opts) $(KERNELRELEASE); fi


@@ -1013,7 +953,7 @@ clean: rm-dirs := $(CLEAN_DIRS)
clean: rm-files := $(CLEAN_FILES)
clean: rm-files := $(CLEAN_FILES)
clean-dirs      := $(addprefix _clean_,$(srctree) $(vmlinux-alldirs))
clean-dirs      := $(addprefix _clean_,$(srctree) $(vmlinux-alldirs))


.PHONY: $(clean-dirs) clean archclean
PHONY += $(clean-dirs) clean archclean
$(clean-dirs):
$(clean-dirs):
	$(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@)
	$(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@)


@@ -1031,7 +971,7 @@ mrproper: rm-dirs := $(wildcard $(MRPROPER_DIRS))
mrproper: rm-files := $(wildcard $(MRPROPER_FILES))
mrproper: rm-files := $(wildcard $(MRPROPER_FILES))
mrproper-dirs      := $(addprefix _mrproper_,Documentation/DocBook scripts)
mrproper-dirs      := $(addprefix _mrproper_,Documentation/DocBook scripts)


.PHONY: $(mrproper-dirs) mrproper archmrproper
PHONY += $(mrproper-dirs) mrproper archmrproper
$(mrproper-dirs):
$(mrproper-dirs):
	$(Q)$(MAKE) $(clean)=$(patsubst _mrproper_%,%,$@)
	$(Q)$(MAKE) $(clean)=$(patsubst _mrproper_%,%,$@)


@@ -1041,7 +981,7 @@ mrproper: clean archmrproper $(mrproper-dirs)


# distclean
# distclean
#
#
.PHONY: distclean
PHONY += distclean


distclean: mrproper
distclean: mrproper
	@find $(srctree) $(RCS_FIND_IGNORE) \
	@find $(srctree) $(RCS_FIND_IGNORE) \
@@ -1057,12 +997,10 @@ distclean: mrproper
# rpm target kept for backward compatibility
# rpm target kept for backward compatibility
package-dir	:= $(srctree)/scripts/package
package-dir	:= $(srctree)/scripts/package


.PHONY: %-pkg rpm

%pkg: FORCE
%pkg: FORCE
	$(Q)$(MAKE) -f $(package-dir)/Makefile $@
	$(Q)$(MAKE) $(build)=$(package-dir) $@
rpm: FORCE
rpm: FORCE
	$(Q)$(MAKE) -f $(package-dir)/Makefile $@
	$(Q)$(MAKE) $(build)=$(package-dir) $@




# Brief documentation of the typical targets used
# Brief documentation of the typical targets used
@@ -1094,13 +1032,11 @@ help:
	@echo  '  kernelversion	  - Output the version stored in Makefile'
	@echo  '  kernelversion	  - Output the version stored in Makefile'
	@echo  ''
	@echo  ''
	@echo  'Static analysers'
	@echo  'Static analysers'
	@echo  '  buildcheck      - List dangling references to vmlinux discarded sections'
	@echo  '                    and init sections from non-init sections'
	@echo  '  checkstack      - Generate a list of stack hogs'
	@echo  '  checkstack      - Generate a list of stack hogs'
	@echo  '  namespacecheck  - Name space analysis on compiled kernel'
	@echo  '  namespacecheck  - Name space analysis on compiled kernel'
	@echo  ''
	@echo  ''
	@echo  'Kernel packaging:'
	@echo  'Kernel packaging:'
	@$(MAKE) -f $(package-dir)/Makefile help
	@$(MAKE) $(build)=$(package-dir) help
	@echo  ''
	@echo  ''
	@echo  'Documentation targets:'
	@echo  'Documentation targets:'
	@$(MAKE) -f $(srctree)/Documentation/DocBook/Makefile dochelp
	@$(MAKE) -f $(srctree)/Documentation/DocBook/Makefile dochelp
@@ -1149,11 +1085,12 @@ else # KBUILD_EXTMOD


# We are always building modules
# We are always building modules
KBUILD_MODULES := 1
KBUILD_MODULES := 1
.PHONY: crmodverdir
PHONY += crmodverdir
crmodverdir:
crmodverdir:
	$(Q)rm -rf $(MODVERDIR)
	$(Q)mkdir -p $(MODVERDIR)
	$(Q)mkdir -p $(MODVERDIR)


.PHONY: $(objtree)/Module.symvers
PHONY += $(objtree)/Module.symvers
$(objtree)/Module.symvers:
$(objtree)/Module.symvers:
	@test -e $(objtree)/Module.symvers || ( \
	@test -e $(objtree)/Module.symvers || ( \
	echo; \
	echo; \
@@ -1162,7 +1099,7 @@ $(objtree)/Module.symvers:
	echo )
	echo )


module-dirs := $(addprefix _module_,$(KBUILD_EXTMOD))
module-dirs := $(addprefix _module_,$(KBUILD_EXTMOD))
.PHONY: $(module-dirs) modules
PHONY += $(module-dirs) modules
$(module-dirs): crmodverdir $(objtree)/Module.symvers
$(module-dirs): crmodverdir $(objtree)/Module.symvers
	$(Q)$(MAKE) $(build)=$(patsubst _module_%,%,$@)
	$(Q)$(MAKE) $(build)=$(patsubst _module_%,%,$@)


@@ -1170,13 +1107,32 @@ modules: $(module-dirs)
	@echo '  Building modules, stage 2.';
	@echo '  Building modules, stage 2.';
	$(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modpost
	$(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modpost


.PHONY: modules_install
PHONY += modules_install
modules_install:
modules_install: _emodinst_ _emodinst_post

install-dir := $(if $(INSTALL_MOD_DIR),$(INSTALL_MOD_DIR),extra)
PHONY += _emodinst_
_emodinst_:
	$(Q)rm -rf $(MODLIB)/$(install-dir)
	$(Q)mkdir -p $(MODLIB)/$(install-dir)
	$(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modinst
	$(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modinst


# Run depmod only is we have System.map and depmod is executable
quiet_cmd_depmod = DEPMOD  $(KERNELRELEASE)
      cmd_depmod = if [ -r System.map -a -x $(DEPMOD) ]; then \
                      $(DEPMOD) -ae -F System.map             \
                      $(if $(strip $(INSTALL_MOD_PATH)),      \
		      -b $(INSTALL_MOD_PATH) -r)              \
		      $(KERNELRELEASE);                       \
                   fi

PHONY += _emodinst_post
_emodinst_post: _emodinst_
	$(call cmd,depmod)

clean-dirs := $(addprefix _clean_,$(KBUILD_EXTMOD))
clean-dirs := $(addprefix _clean_,$(KBUILD_EXTMOD))


.PHONY: $(clean-dirs) clean
PHONY += $(clean-dirs) clean
$(clean-dirs):
$(clean-dirs):
	$(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@)
	$(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@)


@@ -1196,6 +1152,11 @@ help:
	@echo  '  modules_install - install the module'
	@echo  '  modules_install - install the module'
	@echo  '  clean           - remove generated files in module directory only'
	@echo  '  clean           - remove generated files in module directory only'
	@echo  ''
	@echo  ''

# Dummies...
PHONY += prepare scripts
prepare: ;
scripts: ;
endif # KBUILD_EXTMOD
endif # KBUILD_EXTMOD


# Generate tags for editors
# Generate tags for editors
@@ -1296,17 +1257,13 @@ versioncheck:
		-name '*.[hcS]' -type f -print | sort \
		-name '*.[hcS]' -type f -print | sort \
		| xargs $(PERL) -w scripts/checkversion.pl
		| xargs $(PERL) -w scripts/checkversion.pl


buildcheck:
	$(PERL) $(srctree)/scripts/reference_discarded.pl
	$(PERL) $(srctree)/scripts/reference_init.pl

namespacecheck:
namespacecheck:
	$(PERL) $(srctree)/scripts/namespace.pl
	$(PERL) $(srctree)/scripts/namespace.pl


endif #ifeq ($(config-targets),1)
endif #ifeq ($(config-targets),1)
endif #ifeq ($(mixed-targets),1)
endif #ifeq ($(mixed-targets),1)


.PHONY: checkstack
PHONY += checkstack
checkstack:
checkstack:
	$(OBJDUMP) -d vmlinux $$(find . -name '*.ko') | \
	$(OBJDUMP) -d vmlinux $$(find . -name '*.ko') | \
	$(PERL) $(src)/scripts/checkstack.pl $(ARCH)
	$(PERL) $(src)/scripts/checkstack.pl $(ARCH)
@@ -1317,6 +1274,44 @@ kernelrelease:
kernelversion:
kernelversion:
	@echo $(KERNELVERSION)
	@echo $(KERNELVERSION)


# Single targets
# ---------------------------------------------------------------------------
# The directory part is taken from first prerequisite, so this
# works even with external modules
%.s: %.c prepare scripts FORCE
	$(Q)$(MAKE) $(build)=$(dir $<) $(dir $<)$(notdir $@)
%.i: %.c prepare scripts FORCE
	$(Q)$(MAKE) $(build)=$(dir $<) $(dir $<)$(notdir $@)
%.o: %.c prepare scripts FORCE
	$(Q)$(MAKE) $(build)=$(dir $<) $(dir $<)$(notdir $@)
%.lst: %.c prepare scripts FORCE
	$(Q)$(MAKE) $(build)=$(dir $<) $(dir $<)$(notdir $@)
%.s: %.S prepare scripts FORCE
	$(Q)$(MAKE) $(build)=$(dir $<) $(dir $<)$(notdir $@)
%.o: %.S prepare scripts FORCE
	$(Q)$(MAKE) $(build)=$(dir $<) $(dir $<)$(notdir $@)

# For external modules we shall include any directory of the target,
# but usual case there is no directory part.
# make M=`pwd` module.o     => $(dir $@)=./
# make M=`pwd` foo/module.o => $(dir $@)=foo/
# make M=`pwd` /            => $(dir $@)=/
 
ifeq ($(KBUILD_EXTMOD),)
        target-dir = $(@D)
else
        zap-slash=$(filter-out .,$(patsubst %/,%,$(dir $@)))
        target-dir = $(KBUILD_EXTMOD)$(if $(zap-slash),/$(zap-slash))
endif

/ %/:      scripts prepare FORCE
	$(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
	$(build)=$(target-dir)
%.ko: scripts FORCE
	$(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1)   \
	$(build)=$(target-dir) $(@:.ko=.o)
	$(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modpost

# FIXME Should go into a make.lib or something 
# FIXME Should go into a make.lib or something 
# ===========================================================================
# ===========================================================================


@@ -1351,4 +1346,10 @@ clean := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.clean obj


endif	# skip-makefile
endif	# skip-makefile


PHONY += FORCE
FORCE:
FORCE:


# Declare the contents of the .PHONY variable as phony.  We keep that
# information in a variable se we can use it in if_changed and friends.
.PHONY: $(PHONY)
Loading