summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@home.transmeta.com>2003-06-03 17:46:46 -0700
committerLinus Torvalds <torvalds@home.transmeta.com>2003-06-03 17:46:46 -0700
commitfbf47415732b00ff5578d55c6be779a109a01e1f (patch)
treea8fa08882f8013bda50912b5fdba91d2b67bf136
parentcbec8fba238f1c6f8fbc389dd5a2ef57e856fed3 (diff)
parentb830d7973c0de3c9b4381b740aeed53cb9875070 (diff)
Merge bk://linux-sam.bkbits.net/kbuild
into home.transmeta.com:/home/torvalds/v2.5/linux
-rw-r--r--Makefile61
-rw-r--r--scripts/Makefile.build106
2 files changed, 87 insertions, 80 deletions
diff --git a/Makefile b/Makefile
index 026b2aadf0ed..5932e5ffe0c8 100644
--- a/Makefile
+++ b/Makefile
@@ -36,13 +36,36 @@ KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
-e s/arm.*/arm/ -e s/sa110/arm/ \
-e s/s390x/s390/ )
-ARCH := $(SUBARCH)
# Remove hyphens since they have special meaning in RPM filenames
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)
+# SHELL used by kbuild
CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
else if [ -x /bin/bash ]; then echo /bin/bash; \
else echo sh; fi ; fi)
@@ -53,7 +76,6 @@ HOSTCXX = g++
HOSTCFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
HOSTCXXFLAGS = -O2
-CROSS_COMPILE =
# That's our default target when none is given on the command line
# Note that 'modules' will be added as a prerequisite as well,
@@ -783,25 +805,27 @@ rpm: clean spec
help:
@echo 'Cleaning targets:'
- @echo ' clean - remove most generated files but keep the config'
- @echo ' mrproper - remove all generated files + config + various backup files'
+ @echo ' clean - remove most generated files but keep the config'
+ @echo ' mrproper - remove all generated files + config + various backup files'
@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 ' 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 QT based front-end'
+ @echo ' gconfig - Update current config utilising a GTK based front-end'
+ @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 '* 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 ' all - Build all targets marked with [*]'
+ @echo '* vmlinux - Build the bare kernel'
+ @echo '* modules - Build all modules'
+ @echo ' modules_install - Install 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
@@ -810,6 +834,9 @@ help:
@$(if $(archhelp),$(archhelp),\
echo ' No architecture specific help defined for $(ARCH)')
@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 'For further info browse Documentation/kbuild/*'
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 0bd9a0bd1016..bcdcc4bdf492 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -71,55 +71,7 @@ ifneq ($(KBUILD_CHECKSRC),0)
quiet_cmd_checksrc = CHECK $<
cmd_checksrc = $(CHECK) $(c_flags) $< ;
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)
# ---------------------------------------------------------------------------
@@ -164,35 +116,63 @@ cmd_cc_i_c = $(CPP) $(c_flags) -o $@ $<
%.i: %.c FORCE
$(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) $@
-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
- $(if $($(quiet)cmd_checksrc),echo ' $($(quiet)cmd_checksrc)';) \
- $(cmd_checksrc) \
- $(if $($(quiet)cmd_cc_o_c),echo ' $($(quiet)cmd_cc_o_c)';) \
- $(cmd_cc_o_c); \
- scripts/fixdep $(depfile) $@ '$(cmd_cc_o_c)' > $(@D)/.$(@F).tmp; \
- rm -f $(depfile); \
+ $(if $($(quiet)cmd_checksrc),echo ' $($(quiet)cmd_checksrc)';) \
+ $(cmd_checksrc) \
+ $(if $($(quiet)cmd_cc_o_c),echo ' $($(quiet)cmd_cc_o_c)';) \
+ $(cmd_cc_o_c); \
+ $(cmd_modversions) \
+ scripts/fixdep $(depfile) $@ '$(cmd_cc_o_c)' > $(@D)/.$(@F).tmp; \
+ rm -f $(depfile); \
mv -f $(@D)/.$(@F).tmp $(@D)/.$(@F).cmd
endef
# Built-in and composite module parts
%.o: %.c FORCE
-ifdef CONFIG_MODVERSIONS
- $(call if_changed_rule,vcc_o_c)
-else
$(call if_changed_rule,cc_o_c)
-endif
# Single-part modules are special since we need to mark them in $(MODVERDIR)
$(single-used-m): %.o: %.c FORCE
-ifdef CONFIG_MODVERSIONS
- $(call if_changed_rule,vcc_o_c)
-else
$(call if_changed_rule,cc_o_c)
-endif
$(touch-module)
quiet_cmd_cc_lst_c = MKLST $@