|
From: Kenn H. <ke...@us...> - 2003-01-23 22:59:18
|
Update of /cvsroot/linux-vax/kernel-2.5
In directory sc8-pr-cvs1:/tmp/cvs-serv15350
Modified Files:
Makefile Rules.make
Log Message:
Merge with 2.5.21
Index: Makefile
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.5/Makefile,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- Makefile 14 Jan 2003 23:55:17 -0000 1.24
+++ Makefile 23 Jan 2003 22:59:14 -0000 1.25
@@ -1,6 +1,6 @@
VERSION = 2
PATCHLEVEL = 5
-SUBLEVEL = 20
+SUBLEVEL = 21
EXTRAVERSION =
# We are using a recursive build, so we need to do a little thinking
@@ -37,6 +37,56 @@
CROSS_COMPILE = /usr/local/bin/vax-dec-linux-
+# That's our default target when none is given on the command line
+
+all: vmlinux
+
+# Print entire command lines instead of short version
+# For now, leave the default
+
+ifndef KBUILD_VERBOSE
+ KBUILD_VERBOSE = 1
+endif
+
+# Decide whether to build built-in, modular, or both
+
+KBUILD_MODULES := 1
+KBUILD_BUILTIN := 1
+
+export KBUILD_MODULES KBUILD_BUILTIN
+
+# Beautify output
+# ---------------------------------------------------------------------------
+#
+# Normally, we echo the whole command before executing it. By making
+# that echo $($(quiet)$(cmd)), we now have the possibility to set
+# $(quiet) to choose other forms of output instead, e.g.
+#
+# quiet_cmd_cc_o_c = Compiling $(RELDIR)/$@
+# cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $<
+#
+# If $(quiet) is empty, the whole command will be printed.
+# If it is set to "quiet_", only the short version will be printed.
+# If it is set to "silent_", nothing wil be printed at all, since
+# the variable $(silent_cmd_cc_o_c) doesn't exist.
+
+# If the user wants quiet mode, echo short versions of the commands
+# only and suppress the 'Entering/Leaving directory' messages
+
+ifneq ($(KBUILD_VERBOSE),1)
+ quiet=quiet_
+ MAKEFLAGS += --no-print-directory
+endif
+
+# If the user is running make -s (silent mode), suppress echoing of
+# commands
+
+ifneq ($(findstring s,$(MAKEFLAGS)),)
+ quiet=silent_
+endif
+
+export quiet
+
#
# Include the make variables (CC, etc...)
#
@@ -56,33 +106,46 @@
PERL = perl
MODFLAGS = -DMODULE
CFLAGS_MODULE = $(MODFLAGS)
-AFLAGS_MODULE =
+AFLAGS_MODULE = $(MODFLAGS)
CFLAGS_KERNEL =
AFLAGS_KERNEL =
EXPORT_FLAGS =
+NOSTDINC_FLAGS = -nostdinc -iwithprefix include
export VERSION PATCHLEVEL SUBLEVEL EXTRAVERSION KERNELRELEASE ARCH \
CONFIG_SHELL TOPDIR HPATH HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC \
CPP AR NM STRIP OBJCOPY OBJDUMP MAKE MAKEFILES GENKSYMS PERL
-export CPPFLAGS EXPORT_FLAGS
+export CPPFLAGS EXPORT_FLAGS NOSTDINC_FLAGS
export CFLAGS CFLAGS_KERNEL CFLAGS_MODULE
export AFLAGS AFLAGS_KERNEL AFLAGS_MODULE
-all: do-it-all
+noconfig_targets := xconfig menuconfig config oldconfig randconfig \
+ defconfig allyesconfig allnoconfig allmodconfig \
+ clean mrproper distclean
-#
-# Make "config" the default target if there is no configuration file or
-# "depend" the target if there is no top-level dependency information.
-#
+ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
-ifeq (.config,$(wildcard .config))
-include .config
-do-it-all: vmlinux
-else
-CONFIGURATION = config
-do-it-all: config
-endif
+# Here goes the main Makefile
+# ===========================================================================
+#
+# If the user gave a *config target, it'll be handled in another
+# section below, since in this case we cannot include .config
+# Same goes for other targets like clean/mrproper etc, which
+# don't need .config, either
+
+# In this section, we need .config
+
+-include .config
+
+# If .config doesn't exist - tough luck
+
+.config:
+ @echo '***'
+ @echo '*** You have not yet configured your kernel!'
+ @echo '*** Please run "make xconfig/menuconfig/config/oldconfig"'
+ @echo '***'
+ @exit 1
#
# INSTALL_PATH specifies where to place the updated kernel and system map
@@ -114,18 +177,14 @@
EXPORT_FLAGS := -DEXPORT_SYMTAB
endif
-INIT =init/init.o
-CORE_FILES =kernel/kernel.o mm/mm.o fs/fs.o ipc/ipc.o
-NETWORKS =net/network.o
-
-LIBS =$(TOPDIR)/lib/lib.a
-SUBDIRS =init kernel lib drivers mm fs net ipc sound
-
-DRIVERS-y = drivers/built-in.o
-DRIVERS-$(CONFIG_SOUND) += sound/sound.o
-
-DRIVERS := $(DRIVERS-y)
-
+# Link components for vmlinux
+# ---------------------------------------------------------------------------
+SUBDIRS := init kernel mm fs ipc lib drivers sound net
+INIT := init/init.o
+CORE_FILES := kernel/kernel.o mm/mm.o fs/fs.o ipc/ipc.o
+LIBS := lib/lib.a
+DRIVERS := drivers/built-in.o sound/sound.o
+NETWORKS := net/network.o
include arch/$(ARCH)/Makefile
@@ -149,6 +208,7 @@
vmlinux-objs := $(HEAD) $(INIT) $(CORE_FILES) $(LIBS) $(DRIVERS) $(NETWORKS)
+quiet_cmd_link_vmlinux = LD $@
cmd_link_vmlinux = $(LD) $(LINKFLAGS) $(HEAD) $(INIT) \
--start-group \
$(CORE_FILES) \
@@ -166,13 +226,13 @@
. scripts/mkversion > .tmpversion
mv -f .tmpversion .version
$(MAKE) -C init
- echo $(cmd_link_vmlinux)
+ $(call cmd,cmd_link_vmlinux)
$(cmd_link_vmlinux)
echo 'cmd_$@ := $(cmd_link_vmlinux)' > $(@D)/.$(@F).cmd
$(NM) vmlinux | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | sort > System.map
endef
-vmlinux: $(CONFIGURATION) $(vmlinux-objs) FORCE
+vmlinux: $(vmlinux-objs) FORCE
$(call if_changed_rule,link_vmlinux)
# The actual objects are generated when descending,
@@ -183,15 +243,14 @@
# Handle descending into subdirectories listed in $(SUBDIRS)
.PHONY: $(SUBDIRS)
-$(SUBDIRS): prepare
+$(SUBDIRS): .hdepend prepare include/config/MARKER
@$(MAKE) -C $@
-# Things we need done before we even start the actual build.
-# The dependency on .hdepend will in turn take care of
-# include/asm, include/linux/version etc.
+# Things we need done before we descend to build or make
+# module versions are listed in "prepare"
.PHONY: prepare
-prepare: .hdepend include/config/MARKER
+prepare: include/linux/version.h include/asm
# Single targets
# ---------------------------------------------------------------------------
@@ -202,6 +261,8 @@
@$(MAKE) -C $(@D) $(@F)
%.o: %.c FORCE
@$(MAKE) -C $(@D) $(@F)
+%.lst: %.c FORCE
+ @$(MAKE) -C $(@D) $(@F)
%.s: %.S FORCE
@$(MAKE) -C $(@D) $(@F)
%.o: %.S FORCE
@@ -214,14 +275,23 @@
include/asm:
@echo 'Making asm->asm-$(ARCH) symlink'
@ln -s asm-$(ARCH) $@
- @echo 'Making directory include/linux/modules'
- @mkdir include/linux/modules
# Split autoconf.h into include/linux/config/*
include/config/MARKER: scripts/split-include include/linux/autoconf.h
- scripts/split-include include/linux/autoconf.h include/config
- @ touch include/config/MARKER
+ @echo 'Splitting include/linux/autoconf.h -> include/config'
+ @scripts/split-include include/linux/autoconf.h include/config
+ @touch $@
+
+# if .config is newer than include/linux/autoconf.h, someone tinkered
+# 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
# Generate some files
# ---------------------------------------------------------------------------
@@ -229,64 +299,77 @@
# version.h changes when $(KERNELRELEASE) etc change, as defined in
# this Makefile
+uts_len := 64
+
include/linux/version.h: Makefile
- @echo Generating $@
- @. scripts/mkversion_h $@ $(KERNELRELEASE) $(VERSION) $(PATCHLEVEL) $(SUBLEVEL)
+ @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)
# Helpers built in scripts/
# ---------------------------------------------------------------------------
-scripts/mkdep scripts/split-include : FORCE
+scripts/fixdep scripts/split-include : scripts ;
+
+.PHONY: scripts
+scripts:
@$(MAKE) -C scripts
-# Generate dependencies
+# Generate module versions
# ---------------------------------------------------------------------------
-# In the same pass, generate module versions, that's why it's
-# all mixed up here.
+# The targets are still named depend / dep for traditional
+# reasons, but the only thing we do here is generating
+# the module version checksums.
+# FIXME: For now, we are also calling "archdep" from here,
+# which should be replaced by a more sensible solution.
.PHONY: depend dep $(patsubst %,_sfdep_%,$(SUBDIRS))
depend dep: .hdepend
-# .hdepend is missing prerequisites - in fact dependencies need
-# to be redone basically each time anything changed - since
-# that's too expensive, we traditionally rely on the user to
-# run "make dep" manually whenever necessary. In this case,
-# we make "FORCE" a prequisite, to force redoing the
-# dependencies. Yeah, that's ugly, and it'll go away soon.
-
-.hdepend: scripts/mkdep include/linux/version.h include/asm \
- $(if $(filter dep depend,$(MAKECMDGOALS)),FORCE)
- scripts/mkdep -- `find $(FINDHPATH) -name SCCS -prune -o -follow -name \*.h ! -name modversions.h -print` > $@
- @$(MAKE) $(patsubst %,_sfdep_%,$(SUBDIRS))
+# .hdepend is our (misnomed) marker for whether we've run
+# generated module versions and made archdep
+
+.hdepend: $(if $(filter dep depend,$(MAKECMDGOALS)),FORCE)
+ @$(MAKE) archdep include/linux/modversions.h
+ @touch $@
+
ifdef CONFIG_MODVERSIONS
- @$(MAKE) include/linux/modversions.h
-endif
- @$(MAKE) archdep
+
+# Update modversions.h, but only if it would change.
+
+include/linux/modversions.h: scripts/fixdep prepare 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 <linux/modsetver.h>"; \
+ for f in `cd .tmp_export-objs; find modules -name \*.ver -print`; do \
+ echo "#include <linux/$${f}>"; \
+ done; \
+ echo "#endif"; \
+ ) > $@.tmp; \
+ $(update-if-changed)
$(patsubst %,_sfdep_%,$(SUBDIRS)): FORCE
@$(MAKE) -C $(patsubst _sfdep_%, %, $@) fastdep
-# Update modversions.h, but only if it would change.
+else # !CONFIG_MODVERSIONS
-include/linux/modversions.h: FORCE
- @(echo "#ifndef _LINUX_MODVERSIONS_H";\
- echo "#define _LINUX_MODVERSIONS_H"; \
- echo "#include <linux/modsetver.h>"; \
- cd $(TOPDIR)/include/linux/modules; \
- for f in *.ver; do \
- if [ -f $$f ]; then echo "#include <linux/modules/$${f}>"; fi; \
- done; \
- echo "#endif"; \
- ) > $@.tmp
- @if [ -r $@ ] && cmp -s $@ $@.tmp; then \
- echo $@ was not updated; \
- rm -f $@.tmp; \
- else \
- echo $@ was updated; \
- mv -f $@.tmp $@; \
- fi
+.PHONY: include/linux/modversions.h
+
+include/linux/modversions.h:
+
+endif # CONFIG_MODVERSIONS
# ---------------------------------------------------------------------------
# Modules
@@ -300,11 +383,8 @@
endif
.PHONY: modules
-modules: $(patsubst %, _mod_%, $(SUBDIRS))
-
-.PHONY: $(patsubst %, _mod_%, $(SUBDIRS))
-$(patsubst %, _mod_%, $(SUBDIRS)) : include/linux/version.h include/config/MARKER
- @$(MAKE) -C $(patsubst _mod_%, %, $@) modules
+modules:
+ @$(MAKE) KBUILD_BUILTIN= $(SUBDIRS)
# Install modules
@@ -369,7 +449,7 @@
TAGS: FORCE
{ find include/asm-${ARCH} -name '*.h' -print ; \
find include -type d \( -name "asm-*" -o -name config \) -prune -o -name '*.h' -print ; \
- find $(SUBDIRS) init -name '*.[ch]' ; } | grep -v SCCS | etags -
+ find $(SUBDIRS) init arch/${ARCH} -name '*.[chS]' ; } | grep -v SCCS | etags -
# Exuberant ctags works better with -I
tags: FORCE
@@ -412,28 +492,82 @@
rpm -ta $(TOPDIR)/../$(KERNELPATH).tar.gz ; \
rm $(TOPDIR)/../$(KERNELPATH).tar.gz
+else # ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
+
# Targets which don't need .config
# ===========================================================================
+#
+# These targets basically have their own Makefile - not quite, but at
+# least its own exclusive section in the same Makefile. The reason for
+# this is the following:
+# To know the configuration, the main Makefile has to include
+# .config. That's a obviously a problem when .config doesn't exist
+# yet, but that could be kludged around with only including it if it
+# exists.
+# However, the larger problem is: If you run make *config, make will
+# include the old .config, then execute your *config. It will then
+# notice that a piece it included (.config) did change and restart from
+# scratch. Which will cause execution of *config again. You get the
+# picture.
+# If we don't explicitly let the Makefile know that .config is changed
+# by *config (the old way), it won't reread .config after *config,
+# thus working with possibly stale values - we don't that either.
+#
+# So we divide things: This part here is for making *config targets,
+# and other targets which should work when no .config exists yet.
+# The main part above takes care of the rest after a .config exists.
# Kernel configuration
# ---------------------------------------------------------------------------
-.PHONY: oldconfig xconfig menuconfig config
-
-oldconfig:
- $(CONFIG_SHELL) scripts/Configure -d arch/$(ARCH)/config.in
+.PHONY: oldconfig xconfig menuconfig config \
+ make_with_config
xconfig:
@$(MAKE) -C scripts kconfig.tk
wish -f scripts/kconfig.tk
menuconfig:
- @$(MAKE) -C scripts/lxdialog all
+ @$(MAKE) -C scripts lxdialog
$(CONFIG_SHELL) scripts/Menuconfig arch/$(ARCH)/config.in
config:
$(CONFIG_SHELL) scripts/Configure arch/$(ARCH)/config.in
+oldconfig:
+ $(CONFIG_SHELL) scripts/Configure -d arch/$(ARCH)/config.in
+
+randconfig:
+ $(CONFIG_SHELL) scripts/Configure -r arch/$(ARCH)/config.in
+
+allyesconfig:
+ $(CONFIG_SHELL) scripts/Configure -y arch/$(ARCH)/config.in
+
+allnoconfig:
+ $(CONFIG_SHELL) scripts/Configure -n arch/$(ARCH)/config.in
+
+allmodconfig:
+ $(CONFIG_SHELL) scripts/Configure -m arch/$(ARCH)/config.in
+
+defconfig:
+ yes '' | $(CONFIG_SHELL) scripts/Configure -d arch/$(ARCH)/config.in
+
+# How we generate .config depends on which *config the
+# user chose when calling make
+
+.config: $(filter oldconfig xconfig menuconfig config,$(MAKECMDGOALS)) ;
+
+# If the user gave commands from both the need / need not
+# .config sections, we need to call make again after
+# .config is generated, now to take care of the remaining
+# targets we know nothing about in this section
+
+remaining_targets := $(filter-out $(noconfig_targets),$(MAKECMDGOALS))
+
+$(remaining_targets) : make_with_config
+
+make_with_config: .config
+ @$(MAKE) $(remaining_targets)
# Cleaning up
# ---------------------------------------------------------------------------
@@ -461,10 +595,6 @@
net/khttpd/times.h \
submenu*
-# directories removed with 'make clean'
-CLEAN_DIRS += \
- modules
-
# files removed with 'make mrproper'
MRPROPER_FILES += \
include/linux/autoconf.h include/linux/version.h \
@@ -483,34 +613,43 @@
scripts/lxdialog/*.o scripts/lxdialog/lxdialog \
.menuconfig.log \
include/asm \
- .hdepend scripts/mkdep scripts/split-include scripts/docproc \
- $(TOPDIR)/include/linux/modversions.h \
- kernel.spec
+ .hdepend scripts/split-include scripts/docproc \
+ scripts/fixdep $(TOPDIR)/include/linux/modversions.h \
+ tags TAGS kernel.spec \
# directories removed with 'make mrproper'
MRPROPER_DIRS += \
include/config \
$(TOPDIR)/include/linux/modules
+# That's our way to know about arch specific cleanup.
+
+include arch/$(ARCH)/Makefile
clean: archclean
- find . \( -name '*.[oas]' -o -name core -o -name '.*.cmd' \) -type f -print \
+ @echo 'Cleaning up'
+ @find . \( -name \*.[oas] -o -name core -o -name .\*.cmd -o \
+ -name .\*.tmp -o -name .\*.d \) -type f -print \
| grep -v lxdialog/ | xargs rm -f
- rm -f $(CLEAN_FILES)
- rm -rf $(CLEAN_DIRS)
+ @rm -rf $(CLEAN_FILES)
@$(MAKE) -C Documentation/DocBook clean
mrproper: clean archmrproper
- find . \( -size 0 -o -name .depend \) -type f -print | xargs rm -f
- rm -f $(MRPROPER_FILES)
- rm -rf $(MRPROPER_DIRS)
+ @echo 'Making mrproper'
+ @find . \( -size 0 -o -name .depend \) -type f -print | xargs rm -f
+ @rm -f $(MRPROPER_FILES)
+ @rm -rf $(MRPROPER_DIRS)
@$(MAKE) -C Documentation/DocBook mrproper
distclean: mrproper
- rm -f core `find . \( -not -type d \) -and \
- \( -name '*.orig' -o -name '*.rej' -o -name '*~' \
+ @echo 'Making distclean'
+ @find . \( -not -type d \) -and \
+ \( -name '*.orig' -o -name '*.rej' -o -name '*~' \
-o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
- -o -name '.*.rej' -o -name '.SUMS' -o -size 0 \) -type f -print` TAGS tags
+ -o -name '.*.rej' -o -name '.SUMS' -o -size 0 \) -type f \
+ -print | xargs rm -f
+
+endif # ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
# FIXME Should go into a make.lib or something
# ===========================================================================
@@ -530,5 +669,20 @@
$(filter-out $(cmd_$(1)),$(cmd_$(@F)))\
$(filter-out $(cmd_$(@F)),$(cmd_$(1)))),\
@$(rule_$(1)))
+
+# If quiet is set, only print short version of rule
+
+cmd = @$(if $($(quiet)$(1)),echo ' $($(quiet)$(1))' &&) $($(1))
+
+define update-if-changed
+ if [ -r $@ ] && cmp -s $@ $@.tmp; then \
+ echo ' (unchanged)'; \
+ rm -f $@.tmp; \
+ else \
+ echo ' (updated)'; \
+ mv -f $@.tmp $@; \
+ fi
+endef
+
FORCE:
Index: Rules.make
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.5/Rules.make,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- Rules.make 14 Jan 2003 23:55:17 -0000 1.12
+++ Rules.make 23 Jan 2003 22:59:14 -0000 1.13
@@ -52,9 +52,8 @@
# add it to $(subdir-m)
both-m := $(filter $(mod-subdirs), $(subdir-y))
-SUB_DIRS := $(subdir-y) $(if $(BUILD_MODULES),$(subdir-m))
-MOD_SUB_DIRS := $(sort $(subdir-m) $(both-m))
-ALL_SUB_DIRS := $(sort $(subdir-y) $(subdir-m) $(subdir-n) $(subdir-))
+subdir-ym := $(sort $(subdir-y) $(subdir-m))
+subdir-ymn := $(sort $(subdir-ym) $(subdir-n) $(subdir-))
# export.o is never a composite object, since $(export-objs) has a
# fixed meaning (== objects which EXPORT_SYMBOL())
@@ -86,15 +85,20 @@
real-objs-y := $(foreach m, $(filter-out $(subdir-obj-y), $(obj-y)), $(if $($(m:.o=-objs)),$($(m:.o=-objs)),$(m))) $(EXTRA_TARGETS)
real-objs-m := $(foreach m, $(obj-m), $(if $($(m:.o=-objs)),$($(m:.o=-objs)),$(m)))
-# ==========================================================================
-#
# Get things started.
-#
-first_rule: vmlinux $(if $(BUILD_MODULES),$(obj-m))
+# ==========================================================================
-#
-# Common rules
-#
+ifndef O_TARGET
+ifndef L_TARGET
+O_TARGET := built-in.o
+endif
+endif
+
+# The echo suppresses the "Nothing to be done for first_rule"
+first_rule: $(if $(KBUILD_BUILTIN),$(O_TARGET) $(L_TARGET) $(EXTRA_TARGETS)) \
+ $(if $(KBUILD_MODULES),$(obj-m)) \
+ sub_dirs
+ @echo -n
# define listing_o_c to get compiler listings from .c -> .o compilations
listing_o_c = -Wa,-adnhls=$(subst $(comma),_,$(subst -,_,$(*F))).lst -g
@@ -102,38 +106,49 @@
# Compile C sources (.c)
# ---------------------------------------------------------------------------
-# FIXME: if we don't know if built-in or modular, assume built-in.
+# If we don't know if built-in or modular, assume built-in.
# Only happens in Makefiles which override the default first_rule:
modkern_cflags := $(CFLAGS_KERNEL)
-$(real-objs-y) : modkern_cflags := $(CFLAGS_KERNEL)
-$(real-objs-y:.o=.i): modkern_cflags := $(CFLAGS_KERNEL)
-$(real-objs-y:.o=.s): modkern_cflags := $(CFLAGS_KERNEL)
-
-$(real-objs-m) : modkern_cflags := $(CFLAGS_MODULE)
-$(real-objs-m:.o=.i): modkern_cflags := $(CFLAGS_MODULE)
-$(real-objs-m:.o=.s): modkern_cflags := $(CFLAGS_MODULE)
+$(real-objs-y) : modkern_cflags := $(CFLAGS_KERNEL)
+$(real-objs-y:.o=.i) : modkern_cflags := $(CFLAGS_KERNEL)
+$(real-objs-y:.o=.s) : modkern_cflags := $(CFLAGS_KERNEL)
+$(real-objs-y:.o=.lst): modkern_cflags := $(CFLAGS_KERNEL)
+
+$(real-objs-m) : modkern_cflags := $(CFLAGS_MODULE)
+$(real-objs-m:.o=.i) : modkern_cflags := $(CFLAGS_MODULE)
+$(real-objs-m:.o=.lst): modkern_cflags := $(CFLAGS_MODULE)
+
+$(export-objs) : export_flags := $(EXPORT_FLAGS)
+$(export-objs:.o=.i) : export_flags := $(EXPORT_FLAGS)
+$(export-objs:.o=.s) : export_flags := $(EXPORT_FLAGS)
+$(export-objs:.o=.lst): export_flags := $(EXPORT_FLAGS)
-$(export-objs) : export_flags := $(EXPORT_FLAGS)
-$(export-objs:.o=.i): export_flags := $(EXPORT_FLAGS)
-$(export-objs:.o=.s): export_flags := $(EXPORT_FLAGS)
+c_flags = $(CFLAGS) $(NOSTDINC_FLAGS) $(modkern_cflags) $(EXTRA_CFLAGS) $(CFLAGS_$(*F).o) -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) $(export_flags)
-c_flags = $(CFLAGS) $(modkern_cflags) $(EXTRA_CFLAGS) $(CFLAGS_$(*F).o) -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) $(export_flags)
-
-cmd_cc_s_c = $(CC) $(c_flags) -S -o $@ $<
+quiet_cmd_cc_s_c = CC $(RELDIR)/$@
+cmd_cc_s_c = $(CC) $(c_flags) -S -o $@ $<
%.s: %.c FORCE
- $(call if_changed,cmd_cc_s_c)
+ $(call cmd,cmd_cc_s_c)
-cmd_cc_i_c = $(CPP) $(c_flags) -o $@ $<
+quiet_cmd_cc_i_c = CPP $(RELDIR)/$@
+cmd_cc_i_c = $(CPP) $(c_flags) -o $@ $<
%.i: %.c FORCE
- $(call if_changed,cmd_cc_i_c)
+ $(call cmd,cmd_cc_i_c)
-cmd_cc_o_c = $(CC) $(c_flags) $(listing_o_c) -c -o $@ $<
+quiet_cmd_cc_o_c = CC $(RELDIR)/$@
+cmd_cc_o_c = $(CC) -Wp,-MD,.$(subst /,_,$@).d $(c_flags) $(listing_o_c) -c -o $@ $<
%.o: %.c FORCE
- $(call if_changed,cmd_cc_o_c)
+ $(call if_changed_dep,cc_o_c)
+
+quiet_cmd_cc_lst_c = Generating $(RELDIR)/$@
+cmd_cc_lst_c = $(CC) $(c_flags) -g -c -o $*.o $< && $(TOPDIR)/scripts/makelst $*.o $(TOPDIR)/System.map $(OBJDUMP) > $@
+
+%.lst: %.c FORCE
+ $(call cmd,cmd_cc_lst_c)
# Compile assembler sources (.S)
# ---------------------------------------------------------------------------
@@ -147,39 +162,26 @@
$(real-objs-m) : modkern_aflags := $(AFLAGS_MODULE)
$(real-objs-m:.o=.s): modkern_aflags := $(AFLAGS_MODULE)
-a_flags = $(AFLAGS) $(modkern_aflags) $(EXTRA_AFLAGS) $(AFLAGS_$(*F).o)
+a_flags = $(AFLAGS) $(NOSTDINC_FLAGS) $(modkern_aflags) $(EXTRA_AFLAGS) $(AFLAGS_$(*F).o)
-cmd_as_s_S = $(CPP) $(a_flags) -o $@ $<
+quiet_cmd_as_s_S = CPP $(RELDIR)/$@
+cmd_as_s_S = $(CPP) $(a_flags) -o $@ $<
%.s: %.S FORCE
- $(call if_changed,cmd_as_s_S)
+ $(call cmd,cmd_as_s_S)
-cmd_as_o_S = $(CC) $(a_flags) -c -o $@ $<
+quiet_cmd_as_o_S = AS $(RELDIR)/$@
+cmd_as_o_S = $(CC) -Wp,-MD,.$(subst /,_,$@).d $(a_flags) -c -o $@ $<
%.o: %.S FORCE
- $(call if_changed,cmd_as_o_S)
-
-# FIXME
-
-%.lst: %.c
- $(CC) $(c_flags) -g -c -o $*.o $<
- $(TOPDIR)/scripts/makelst $* $(TOPDIR) $(OBJDUMP)
-
+ $(call if_changed_dep,as_o_S)
# If a Makefile does define neither O_TARGET nor L_TARGET,
# use a standard O_TARGET named "built-in.o"
-ifndef O_TARGET
-ifndef L_TARGET
-O_TARGET := built-in.o
-endif
-endif
-
# Build the compiled-in targets
# ---------------------------------------------------------------------------
-vmlinux: $(O_TARGET) $(L_TARGET) $(EXTRA_TARGETS) sub_dirs
-
# To build objects in subdirs, we need to descend into the directories
$(sort $(subdir-obj-y)): sub_dirs ;
@@ -187,6 +189,7 @@
# Rule to compile a set of .o files into one .o file
#
ifdef O_TARGET
+quiet_cmd_link_o_target = LD $(RELDIR)/$@
# If the list of objects to link is empty, just create an empty O_TARGET
cmd_link_o_target = $(if $(strip $(obj-y)),\
$(LD) $(EXTRA_LDFLAGS) -r -o $@ $(filter $(obj-y), $^),\
@@ -200,6 +203,7 @@
# Rule to compile a set of .o files into one .a file
#
ifdef L_TARGET
+quiet_cmd_link_l_target = AR $(RELDIR)/$@
cmd_link_l_target = rm -f $@; $(AR) $(EXTRA_ARFLAGS) rcs $@ $(obj-y)
$(L_TARGET): $(obj-y) FORCE
@@ -210,7 +214,7 @@
# Rule to link composite objects
#
-
+quiet_cmd_link_multi = LD $(RELDIR)/$@
cmd_link_multi = $(LD) $(EXTRA_LDFLAGS) -r -o $@ $(filter $($(basename $@)-objs),$^)
# We would rather have a list of rules like
@@ -223,62 +227,83 @@
$(multi-used-m) : %.o: $(multi-objs-m) FORCE
$(call if_changed,cmd_link_multi)
-#
-# This make dependencies quickly
-#
-fastdep: FORCE
- $(TOPDIR)/scripts/mkdep $(CFLAGS) $(EXTRA_CFLAGS) -- $(wildcard *.[chS]) > .depend
-ifdef ALL_SUB_DIRS
- $(MAKE) $(patsubst %,_sfdep_%,$(ALL_SUB_DIRS)) _FASTDEP_ALL_SUB_DIRS="$(ALL_SUB_DIRS)"
-endif
+# Compile programs on the host
+# ===========================================================================
+
+host-progs-single := $(foreach m,$(host-progs),$(if $($(m)-objs),,$(m)))
+host-progs-multi := $(foreach m,$(host-progs),$(if $($(m)-objs),$(m)))
+host-progs-multi-objs := $(foreach m,$(host-progs-multi),$($(m)-objs))
+
+quiet_cmd_host_cc__c = HOSTCC $(RELDIR)/$@
+cmd_host_cc__c = $(HOSTCC) -Wp,-MD,.$(subst /,_,$@).d \
+ $(HOSTCFLAGS) $(HOST_EXTRACFLAGS) -o $@ $<
+
+$(host-progs-single): %: %.c FORCE
+ $(call if_changed_dep,host_cc__c)
+
+quiet_cmd_host_cc_o_c = HOSTCC $(RELDIR)/$@
+cmd_host_cc_o_c = $(HOSTCC) -Wp,-MD,.$(subst /,_,$@).d \
+ $(HOSTCFLAGS) $(HOST_EXTRACFLAGS) -c -o $@ $<
+
+$(host-progs-multi-objs): %.o: %.c FORCE
+ $(call if_changed_dep,host_cc_o_c)
+
+quiet_cmd_host_cc__o = HOSTLD $(RELDIR)/$@
+cmd_host_cc__o = $(HOSTCC) $(HOSTLDFLAGS) -o $@ $($@-objs) \
+ $(HOST_LOADLIBES)
+
+$(host-progs-multi): %: $(host-progs-multi-objs) FORCE
+ $(call if_changed,cmd_host_cc__o)
+
-ifdef _FASTDEP_ALL_SUB_DIRS
-$(patsubst %,_sfdep_%,$(_FASTDEP_ALL_SUB_DIRS)):
+# Descending when making module versions
+# ---------------------------------------------------------------------------
+
+fastdep-list := $(addprefix _sfdep_,$(subdir-ymn))
+
+.PHONY: fastdep $(fastdep-list)
+
+fastdep: $(fastdep-list)
+
+$(fastdep-list):
@$(MAKE) -C $(patsubst _sfdep_%,%,$@) fastdep
-endif
+# Descending when building
+# ---------------------------------------------------------------------------
-#
-# A rule to make subdirectories
-#
-subdir-list = $(sort $(patsubst %,_subdir_%,$(SUB_DIRS)))
-sub_dirs: FORCE $(subdir-list)
+subdir-list := $(addprefix _subdir_,$(subdir-ym))
+
+.PHONY: sub_dirs $(subdir-list)
-ifdef SUB_DIRS
-$(subdir-list) : FORCE
+sub_dirs: $(subdir-list)
+
+$(subdir-list):
@$(MAKE) -C $(patsubst _subdir_%,%,$@)
-endif
-#
-# A rule to make modules
-#
-ifneq "$(strip $(MOD_SUB_DIRS))" ""
-.PHONY: $(patsubst %,_modsubdir_%,$(MOD_SUB_DIRS))
-$(patsubst %,_modsubdir_%,$(MOD_SUB_DIRS)) : FORCE
- @$(MAKE) -C $(patsubst _modsubdir_%,%,$@) modules
+# Descending and installing modules
+# ---------------------------------------------------------------------------
-.PHONY: $(patsubst %,_modinst_%,$(MOD_SUB_DIRS))
-$(patsubst %,_modinst_%,$(MOD_SUB_DIRS)) : FORCE
- @$(MAKE) -C $(patsubst _modinst_%,%,$@) modules_install
-endif
+modinst-list := $(addprefix _modinst_,$(subdir-ym))
-.PHONY: modules
-modules: $(obj-m) FORCE $(patsubst %,_modsubdir_%,$(MOD_SUB_DIRS))
+.PHONY: modules_install _modinst_ $(modinst-list)
-.PHONY: _modinst__
-_modinst__: FORCE
-ifneq "$(strip $(obj-m))" ""
- mkdir -p $(MODLIB)/kernel/$(RELDIR)
- cp $(obj-m) $(MODLIB)/kernel/$(RELDIR)
+modules_install: $(modinst-list)
+ifneq ($(obj-m),)
+ @echo Installing modules in $(MODLIB)/kernel/$(RELDIR)
+ @mkdir -p $(MODLIB)/kernel/$(RELDIR)
+ @cp $(obj-m) $(MODLIB)/kernel/$(RELDIR)
+else
+ @echo -n
endif
-.PHONY: modules_install
-modules_install: _modinst__ $(patsubst %,_modinst_%,$(MOD_SUB_DIRS))
-
+$(modinst-list):
+ @$(MAKE) -C $(patsubst _modinst_%,%,$@) modules_install
# Add FORCE to the prequisites of a target to force it to be always rebuilt.
# ---------------------------------------------------------------------------
+
.PHONY: FORCE
+
FORCE:
#
@@ -292,13 +317,11 @@
# Separate the object into "normal" objects and "exporting" objects
# Exporting objects are: all objects that define symbol tables
#
-ifdef CONFIG_MODULES
ifdef CONFIG_MODVERSIONS
ifneq "$(strip $(export-objs))" ""
-MODINCL := $(TOPDIR)/include/linux/modules
-MODPREFIX := $(subst /,-,$(RELDIR))__
+MODVERDIR := $(TOPDIR)/include/linux/modules/$(RELDIR)
#
# Added the SMP separator to stop module accidents between uniprocessor
@@ -314,47 +337,32 @@
# We don't track dependencies for .ver files, so we FORCE to check
# them always (i.e. always at "make dep" time).
+quiet_cmd_create_ver = Creating include/linux/modules/$(RELDIR)/$*.ver
cmd_create_ver = $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -E -D__GENKSYMS__ $< | \
$(GENKSYMS) $(genksyms_smp_prefix) -k $(VERSION).$(PATCHLEVEL).$(SUBLEVEL) > $@.tmp
-$(MODINCL)/$(MODPREFIX)%.ver: %.c FORCE
- @echo $(cmd_create_ver)
- @$(cmd_create_ver)
+$(MODVERDIR)/%.ver: %.c FORCE
+ @mkdir -p $(dir $@)
+ @$(call cmd,cmd_create_ver)
@if [ -r $@ ] && cmp -s $@ $@.tmp; then \
- echo $@ is unchanged; rm -f $@.tmp; \
+ rm -f $@.tmp; \
else \
- echo mv $@.tmp $@; mv -f $@.tmp $@; \
+ touch $(TOPDIR)/include/linux/modversions.h; \
+ mv -f $@.tmp $@; \
fi
# updates .ver files but not modversions.h
-fastdep: $(addprefix $(MODINCL)/$(MODPREFIX),$(export-objs:.o=.ver))
-
-endif # export-objs
+fastdep: $(addprefix $(MODVERDIR)/,$(export-objs:.o=.ver))
+ifneq ($(export-objs),)
+ @mkdir -p $(TOPDIR)/.tmp_export-objs/modules/$(RELDIR)
+ @touch $(addprefix $(TOPDIR)/.tmp_export-objs/modules/$(RELDIR)/,$(export-objs:.o=.ver))
+endif
-# make dep cannot correctly figure out the dependency on the generated
-# modversions.h, so we list them here:
-# o files which export symbols and are compiled into the kernel include
-# it (to generate a correct symbol table)
-# o all modules get compiled with -include modversions.h
-$(filter $(export-objs),$(real-objs-y)): $(TOPDIR)/include/linux/modversions.h
-$(real-objs-m): $(TOPDIR)/include/linux/modversions.h
+endif # export-objs
endif # CONFIG_MODVERSIONS
-endif # CONFIG_MODULES
-
-#
-# include dependency files if they exist
-#
-ifneq ($(wildcard .depend),)
-include .depend
-endif
-
-ifneq ($(wildcard $(TOPDIR)/.hdepend),)
-include $(TOPDIR)/.hdepend
-endif
-
# ---------------------------------------------------------------------------
# Check if command line has changed
@@ -386,7 +394,7 @@
# which is saved in .<target>.o, to the current command line using
# the two filter-out commands)
-# read all saved command lines
+# read all saved command lines and dependencies
cmd_files := $(wildcard .*.cmd)
ifneq ($(cmd_files),)
@@ -398,4 +406,22 @@
if_changed = $(if $(strip $? \
$(filter-out $($(1)),$(cmd_$(@F)))\
$(filter-out $(cmd_$(@F)),$($(1)))),\
- @echo '$($(1))' && $($(1)) && echo 'cmd_$@ := $($(1))' > $(@D)/.$(@F).cmd)
+ @$(if $($(quiet)$(1)),echo ' $($(quiet)$(1))' &&) $($(1)) && echo 'cmd_$@ := $($(1))' > $(@D)/.$(@F).cmd)
+
+
+# execute the command and also postprocess generated .d dependencies
+# file
+
+if_changed_dep = $(if $(strip $? \
+ $(filter-out $(cmd_$(1)),$(cmd_$@))\
+ $(filter-out $(cmd_$@),$(cmd_$(1)))),\
+ @set -e; \
+ $(if $($(quiet)cmd_$(1)),echo ' $($(quiet)cmd_$(1))';) \
+ $(cmd_$(1)); \
+ $(TOPDIR)/scripts/fixdep $(subst /,_,$@) $(TOPDIR) '$(cmd_$(1))' > .$(subst /,_,$@).tmp; \
+ rm -f .$(subst /,_,$@).d; \
+ mv -f .$(subst /,_,$@).tmp .$(subst /,_,$@).cmd )
+
+# If quiet is set, only print short version of command
+
+cmd = @$(if $($(quiet)$(1)),echo ' $($(quiet)$(1))' &&) $($(1))
|