Commit fbf47415 authored by Linus Torvalds's avatar Linus Torvalds

Merge bk://linux-sam.bkbits.net/kbuild

into home.transmeta.com:/home/torvalds/v2.5/linux
parents cbec8fba b830d797
...@@ -36,13 +36,36 @@ KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) ...@@ -36,13 +36,36 @@ KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
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/s390x/s390/ )
ARCH := $(SUBARCH)
# Remove hyphens since they have special meaning in RPM filenames # Remove hyphens since they have special meaning in RPM filenames
KERNELPATH=kernel-$(subst -,,$(KERNELRELEASE)) KERNELPATH=kernel-$(subst -,,$(KERNELRELEASE))
# Cross compiling and selecting different set of gcc/bin-utils
# ---------------------------------------------------------------------------
#
# When performing cross compilation for other architectures ARCH shall be set
# to the target architecture. (See arch/* for the possibilities).
# ARCH can be set during invocation of make:
# make ARCH=ia64
# Another way is to have ARCH set in the environment.
# The default ARCH is the host where make is executed.
# CROSS_COMPILE specify the prefix used for all executables used
# during compilation. Only gcc and related bin-utils executables
# are prefixed with $(CROSS_COMPILE).
# CROSS_COMPILE can be set on the command line
# make CROSS_COMPILE=ia64-linux-
# Alternatively CROSS_COMPILE can be set in the environment.
# Default value for CROSS_COMPILE is not to prefix executables
# Note: Some architectures assign CROSS_COMPILE in their arch/*/Makefile
ARCH ?= $(SUBARCH)
CROSS_COMPILE ?=
# Architecture as present in compile.h
UTS_MACHINE := $(ARCH) UTS_MACHINE := $(ARCH)
# SHELL used by kbuild
CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \ CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
else if [ -x /bin/bash ]; then echo /bin/bash; \ else if [ -x /bin/bash ]; then echo /bin/bash; \
else echo sh; fi ; fi) else echo sh; fi ; fi)
...@@ -53,7 +76,6 @@ HOSTCXX = g++ ...@@ -53,7 +76,6 @@ HOSTCXX = g++
HOSTCFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer HOSTCFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
HOSTCXXFLAGS = -O2 HOSTCXXFLAGS = -O2
CROSS_COMPILE =
# 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
# Note that 'modules' will be added as a prerequisite as well, # Note that 'modules' will be added as a prerequisite as well,
...@@ -783,25 +805,27 @@ rpm: clean spec ...@@ -783,25 +805,27 @@ rpm: clean spec
help: help:
@echo 'Cleaning targets:' @echo 'Cleaning targets:'
@echo ' clean - remove most generated files but keep the config' @echo ' clean - remove most generated files but keep the config'
@echo ' mrproper - remove all generated files + config + various backup files' @echo ' mrproper - remove all generated files + config + various backup files'
@echo '' @echo ''
@echo 'Configuration targets:' @echo 'Configuration targets:'
@echo ' oldconfig - Update current config utilising a line-oriented program' @echo ' oldconfig - Update current config utilising a line-oriented program'
@echo ' menuconfig - Update current config utilising a menu based program' @echo ' menuconfig - Update current config utilising a menu based program'
@echo ' xconfig - Update current config utilising a X-based program' @echo ' xconfig - Update current config utilising a QT based front-end'
@echo ' defconfig - New config with default answer to all options' @echo ' gconfig - Update current config utilising a GTK based front-end'
@echo ' allmodconfig - New config selecting modules when possible' @echo ' defconfig - New config with default answer to all options'
@echo ' allyesconfig - New config where all options are accepted with yes' @echo ' allmodconfig - New config selecting modules when possible'
@echo ' allnoconfig - New minimal config' @echo ' allyesconfig - New config where all options are accepted with yes'
@echo ' allnoconfig - New minimal config'
@echo '' @echo ''
@echo 'Other generic targets:' @echo 'Other generic targets:'
@echo ' all - Build all targets marked with [*]' @echo ' all - Build all targets marked with [*]'
@echo '* vmlinux - Build the bare kernel' @echo '* vmlinux - Build the bare kernel'
@echo '* modules - Build all modules' @echo '* modules - Build all modules'
@echo ' dir/file.[ois]- Build specified target only' @echo ' modules_install - Install all modules'
@echo ' rpm - Build a kernel as an RPM package' @echo ' dir/file.[ois] - Build specified target only'
@echo ' tags/TAGS - Generate tags file for editors' @echo ' rpm - Build a kernel as an RPM package'
@echo ' tags/TAGS - Generate tags file for editors'
@echo '' @echo ''
@echo 'Documentation targets:' @echo 'Documentation targets:'
@$(MAKE) --no-print-directory -f Documentation/DocBook/Makefile dochelp @$(MAKE) --no-print-directory -f Documentation/DocBook/Makefile dochelp
...@@ -810,6 +834,9 @@ help: ...@@ -810,6 +834,9 @@ help:
@$(if $(archhelp),$(archhelp),\ @$(if $(archhelp),$(archhelp),\
echo ' No architecture specific help defined for $(ARCH)') echo ' No architecture specific help defined for $(ARCH)')
@echo '' @echo ''
@echo ' make V=0|1 [targets] 0 => quiet build (default), 1 => verbose build'
@echo ' make C=1 [targets] Check all c source with checker tool'
@echo ''
@echo 'Execute "make" or "make all" to build all targets marked with [*] ' @echo 'Execute "make" or "make all" to build all targets marked with [*] '
@echo 'For further info browse Documentation/kbuild/*' @echo 'For further info browse Documentation/kbuild/*'
......
...@@ -71,55 +71,7 @@ ifneq ($(KBUILD_CHECKSRC),0) ...@@ -71,55 +71,7 @@ ifneq ($(KBUILD_CHECKSRC),0)
quiet_cmd_checksrc = CHECK $< quiet_cmd_checksrc = CHECK $<
cmd_checksrc = $(CHECK) $(c_flags) $< ; cmd_checksrc = $(CHECK) $(c_flags) $< ;
endif endif
# Module versioning
# ---------------------------------------------------------------------------
ifdef CONFIG_MODVERSIONS
# $(call if_changed_rule,vcc_o_c) does essentially the same as the
# normal $(call if_changed_dep,cc_o_c), i.e. compile an object file
# from a C file, keeping track of the command line and dependencies.
#
# However, actually it does:
# o compile a .tmp_<file>.o from <file>.c
# o if .tmp_<file>.o doesn't contain a __ksymtab version, i.e. does
# not export symbols, we just rename .tmp_<file>.o to <file>.o and
# are done.
# o otherwise, we calculate symbol versions using the good old
# genksyms on the preprocessed source and postprocess them in a way
# that they are usable as a linker script
# o generate <file>.o from .tmp_<file>.o using the linker to
# replace the unresolved symbols __crc_exported_symbol with
# the actual value of the checksum generated by genksyms
quiet_cmd_vcc_o_c = CC $(quiet_modtag) $@
cmd_vcc_o_c = $(CC) $(c_flags) -c -o $(@D)/.tmp_$(@F) $<
define rule_vcc_o_c
$(if $($(quiet)cmd_checksrc),echo ' $($(quiet)cmd_checksrc)';) \
$(cmd_checksrc) \
$(if $($(quiet)cmd_vcc_o_c),echo ' $($(quiet)cmd_vcc_o_c)';) \
$(cmd_vcc_o_c); \
\
if ! $(OBJDUMP) -h $(@D)/.tmp_$(@F) | grep -q __ksymtab; then \
mv $(@D)/.tmp_$(@F) $@; \
else \
$(CPP) -D__GENKSYMS__ $(c_flags) $< \
| $(GENKSYMS) \
> $(@D)/.tmp_$(@F:.o=.ver); \
\
$(LD) $(LDFLAGS) -r -o $@ $(@D)/.tmp_$(@F) \
-T $(@D)/.tmp_$(@F:.o=.ver); \
rm -f $(@D)/.tmp_$(@F) $(@D)/.tmp_$(@F:.o=.ver); \
fi;
\
scripts/fixdep $(depfile) $@ '$(cmd_vcc_o_c)' > $(@D)/.$(@F).tmp; \
rm -f $(depfile); \
mv -f $(@D)/.$(@F).tmp $(@D)/.$(@F).cmd
endef
endif
# Compile C sources (.c) # Compile C sources (.c)
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
...@@ -164,35 +116,63 @@ cmd_cc_i_c = $(CPP) $(c_flags) -o $@ $< ...@@ -164,35 +116,63 @@ cmd_cc_i_c = $(CPP) $(c_flags) -o $@ $<
%.i: %.c FORCE %.i: %.c FORCE
$(call if_changed_dep,cc_i_c) $(call if_changed_dep,cc_i_c)
# C (.c) files
# The C file is compiled and updated dependency information is generated.
# (See cmd_cc_o_c + relevant part of rule_cc_o_c)
quiet_cmd_cc_o_c = CC $(quiet_modtag) $@ quiet_cmd_cc_o_c = CC $(quiet_modtag) $@
cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $<
ifndef CONFIG_MODVERSIONS
cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $<
else
# When module versioning is enabled the following steps are executed:
# o compile a .tmp_<file>.o from <file>.c
# o if .tmp_<file>.o doesn't contain a __ksymtab version, i.e. does
# not export symbols, we just rename .tmp_<file>.o to <file>.o and
# are done.
# o otherwise, we calculate symbol versions using the good old
# genksyms on the preprocessed source and postprocess them in a way
# that they are usable as a linker script
# o generate <file>.o from .tmp_<file>.o using the linker to
# replace the unresolved symbols __crc_exported_symbol with
# the actual value of the checksum generated by genksyms
cmd_cc_o_c = $(CC) $(c_flags) -c -o $(@D)/.tmp_$(@F) $<
cmd_modversions = \
if ! $(OBJDUMP) -h $(@D)/.tmp_$(@F) | grep -q __ksymtab; then \
mv $(@D)/.tmp_$(@F) $@; \
else \
$(CPP) -D__GENKSYMS__ $(c_flags) $< \
| $(GENKSYMS) \
> $(@D)/.tmp_$(@F:.o=.ver); \
\
$(LD) $(LDFLAGS) -r -o $@ $(@D)/.tmp_$(@F) \
-T $(@D)/.tmp_$(@F:.o=.ver); \
rm -f $(@D)/.tmp_$(@F) $(@D)/.tmp_$(@F:.o=.ver); \
fi;
endif
define rule_cc_o_c define rule_cc_o_c
$(if $($(quiet)cmd_checksrc),echo ' $($(quiet)cmd_checksrc)';) \ $(if $($(quiet)cmd_checksrc),echo ' $($(quiet)cmd_checksrc)';) \
$(cmd_checksrc) \ $(cmd_checksrc) \
$(if $($(quiet)cmd_cc_o_c),echo ' $($(quiet)cmd_cc_o_c)';) \ $(if $($(quiet)cmd_cc_o_c),echo ' $($(quiet)cmd_cc_o_c)';) \
$(cmd_cc_o_c); \ $(cmd_cc_o_c); \
scripts/fixdep $(depfile) $@ '$(cmd_cc_o_c)' > $(@D)/.$(@F).tmp; \ $(cmd_modversions) \
rm -f $(depfile); \ scripts/fixdep $(depfile) $@ '$(cmd_cc_o_c)' > $(@D)/.$(@F).tmp; \
rm -f $(depfile); \
mv -f $(@D)/.$(@F).tmp $(@D)/.$(@F).cmd mv -f $(@D)/.$(@F).tmp $(@D)/.$(@F).cmd
endef endef
# Built-in and composite module parts # Built-in and composite module parts
%.o: %.c FORCE %.o: %.c FORCE
ifdef CONFIG_MODVERSIONS
$(call if_changed_rule,vcc_o_c)
else
$(call if_changed_rule,cc_o_c) $(call if_changed_rule,cc_o_c)
endif
# Single-part modules are special since we need to mark them in $(MODVERDIR) # Single-part modules are special since we need to mark them in $(MODVERDIR)
$(single-used-m): %.o: %.c FORCE $(single-used-m): %.o: %.c FORCE
ifdef CONFIG_MODVERSIONS
$(call if_changed_rule,vcc_o_c)
else
$(call if_changed_rule,cc_o_c) $(call if_changed_rule,cc_o_c)
endif
$(touch-module) $(touch-module)
quiet_cmd_cc_lst_c = MKLST $@ quiet_cmd_cc_lst_c = MKLST $@
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment