From: Kenn H. <ke...@us...> - 2003-01-25 00:33:35
|
Update of /cvsroot/linux-vax/kernel-2.5 In directory sc8-pr-cvs1:/tmp/cvs-serv15380 Modified Files: Makefile Rules.make Log Message: Merge with 2.5.22 Index: Makefile =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/Makefile,v retrieving revision 1.27 retrieving revision 1.28 diff -u -r1.27 -r1.28 --- Makefile 24 Jan 2003 00:46:48 -0000 1.27 +++ Makefile 25 Jan 2003 00:33:31 -0000 1.28 @@ -1,6 +1,6 @@ VERSION = 2 PATCHLEVEL = 5 -SUBLEVEL = 21 +SUBLEVEL = 22 EXTRAVERSION = # We are using a recursive build, so we need to do a little thinking @@ -122,7 +122,9 @@ noconfig_targets := xconfig menuconfig config oldconfig randconfig \ defconfig allyesconfig allnoconfig allmodconfig \ - clean mrproper distclean + clean mrproper distclean \ + tags TAGS sgmldocs psdocs pdfdocs htmldocs \ + checkconfig checkhelp checkincludes ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),) @@ -222,10 +224,10 @@ define rule_link_vmlinux set -e - echo Generating build number + echo ' Generating build number' . scripts/mkversion > .tmpversion mv -f .tmpversion .version - $(MAKE) -C init + +$(MAKE) -C init $(call cmd,cmd_link_vmlinux) $(cmd_link_vmlinux) echo 'cmd_$@ := $(cmd_link_vmlinux)' > $(@D)/.$(@F).cmd @@ -243,14 +245,14 @@ # Handle descending into subdirectories listed in $(SUBDIRS) .PHONY: $(SUBDIRS) -$(SUBDIRS): .hdepend prepare include/config/MARKER +$(SUBDIRS): .hdepend prepare @$(MAKE) -C $@ # Things we need done before we descend to build or make # module versions are listed in "prepare" .PHONY: prepare -prepare: include/linux/version.h include/asm +prepare: include/linux/version.h include/asm include/config/MARKER # Single targets # --------------------------------------------------------------------------- @@ -273,13 +275,13 @@ # before switching between archs anyway. include/asm: - @echo 'Making asm->asm-$(ARCH) symlink' + @echo ' Making asm->asm-$(ARCH) symlink' @ln -s asm-$(ARCH) $@ # Split autoconf.h into include/linux/config/* include/config/MARKER: scripts/split-include include/linux/autoconf.h - @echo 'Splitting include/linux/autoconf.h -> include/config' + @echo ' SPLIT include/linux/autoconf.h -> include/config/*' @scripts/split-include include/linux/autoconf.h include/config @touch $@ @@ -306,7 +308,7 @@ echo '"$(KERNELRELEASE)" exceeds $(uts_len) characters' >&2; \ exit 1; \ fi; - @echo -n 'Generating $@' + @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))'; \ @@ -349,11 +351,11 @@ include/linux/modversions.h: scripts/fixdep prepare FORCE @rm -rf .tmp_export-objs @$(MAKE) $(patsubst %,_sfdep_%,$(SUBDIRS)) - @echo -n 'Generating $@' + @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 \ + for f in `cd .tmp_export-objs; find modules -name \*.ver -print | sort`; do \ echo "#include <linux/$${f}>"; \ done; \ echo "#endif"; \ @@ -431,44 +433,9 @@ endif # CONFIG_MODULES -# Scripts to check various things for consistency -# --------------------------------------------------------------------------- - -checkconfig: - find * -name '*.[hcS]' -type f -print | sort | xargs $(PERL) -w scripts/checkconfig.pl - -checkhelp: - find * -name [cC]onfig.in -print | sort | xargs $(PERL) -w scripts/checkhelp.pl - -checkincludes: - find * -name '*.[hcS]' -type f -print | sort | xargs $(PERL) -w scripts/checkincludes.pl - -# Generate tags for editors -# --------------------------------------------------------------------------- - -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 arch/${ARCH} -name '*.[chS]' ; } | grep -v SCCS | etags - - -# Exuberant ctags works better with -I -tags: FORCE - CTAGSF=`ctags --version | grep -i exuberant >/dev/null && echo "-I __initdata,__exitdata,EXPORT_SYMBOL,EXPORT_SYMBOL_NOVERS"`; \ - ctags $$CTAGSF `find include/asm-$(ARCH) -name '*.h'` && \ - find include -type d \( -name "asm-*" -o -name config \) -prune -o -name '*.h' -print | xargs ctags $$CTAGSF -a && \ - find $(SUBDIRS) init -name '*.[ch]' | xargs ctags $$CTAGSF -a - -# Assorted miscellaneous targets +# RPM target # --------------------------------------------------------------------------- -# Documentation targets - -sgmldocs psdocs pdfdocs htmldocs: - @$(MAKE) -C Documentation/DocBook $@ - - -# RPM target -# # If you do a make spec before packing the tarball you can rpm -ta it spec: @@ -574,9 +541,8 @@ # files removed with 'make clean' CLEAN_FILES += \ - kernel/ksyms.lst include/linux/compile.h \ + include/linux/compile.h \ vmlinux System.map \ - .tmp* \ drivers/char/consolemap_deftbl.c drivers/video/promcon_tbl.c \ drivers/char/conmakehash \ drivers/char/drm/*-mod.c \ @@ -616,9 +582,11 @@ .hdepend scripts/split-include scripts/docproc \ scripts/fixdep $(TOPDIR)/include/linux/modversions.h \ tags TAGS kernel.spec \ + .tmpversion # directories removed with 'make mrproper' MRPROPER_DIRS += \ + .tmp_export-objs \ include/config \ $(TOPDIR)/include/linux/modules @@ -631,7 +599,7 @@ @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 -rf $(CLEAN_FILES) + @rm -f $(CLEAN_FILES) @$(MAKE) -C Documentation/DocBook clean mrproper: clean archmrproper @@ -649,7 +617,41 @@ -o -name '.*.rej' -o -name '.SUMS' -o -size 0 \) -type f \ -print | xargs rm -f +# Generate tags for editors +# --------------------------------------------------------------------------- + +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 arch/${ARCH} -name '*.[chS]' ; } | grep -v SCCS | etags - + +# Exuberant ctags works better with -I +tags: FORCE + CTAGSF=`ctags --version | grep -i exuberant >/dev/null && echo "-I __initdata,__exitdata,EXPORT_SYMBOL,EXPORT_SYMBOL_NOVERS"`; \ + ctags $$CTAGSF `find include/asm-$(ARCH) -name '*.h'` && \ + find include -type d \( -name "asm-*" -o -name config \) -prune -o -name '*.h' -print | xargs ctags $$CTAGSF -a && \ + find $(SUBDIRS) init -name '*.[ch]' | xargs ctags $$CTAGSF -a + +# Documentation targets +# --------------------------------------------------------------------------- + +sgmldocs psdocs pdfdocs htmldocs: + @$(MAKE) -C Documentation/DocBook $@ + + endif # ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),) + +# Scripts to check various things for consistency +# --------------------------------------------------------------------------- + +checkconfig: + find * -name '*.[hcS]' -type f -print | sort | xargs $(PERL) -w scripts/checkconfig.pl + +checkhelp: + find * -name [cC]onfig.in -print | sort | xargs $(PERL) -w scripts/checkhelp.pl + +checkincludes: + find * -name '*.[hcS]' -type f -print | sort | xargs $(PERL) -w scripts/checkincludes.pl # FIXME Should go into a make.lib or something # =========================================================================== Index: Rules.make =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/Rules.make,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- Rules.make 23 Jan 2003 22:59:14 -0000 1.13 +++ Rules.make 25 Jan 2003 00:33:31 -0000 1.14 @@ -48,12 +48,9 @@ obj-y := $(patsubst %/, %/built-in.o, $(obj-y)) obj-m := $(filter-out %/, $(obj-m)) -# If a dir is selected in $(subdir-y) and also mentioned in $(mod-subdirs), -# add it to $(subdir-m) +# Subdirectories we need to descend into -both-m := $(filter $(mod-subdirs), $(subdir-y)) 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()) @@ -85,8 +82,116 @@ 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. +# Only build module versions for files which are selected to be built +export-objs := $(filter $(export-objs),$(real-objs-y) $(real-objs-m)) + +# The temporary file to save gcc -MD generated dependencies must not +# contain a comma +depfile = $(subst $(comma),_,$(@D)/.$(@F).d) + +# We're called for one of three purposes: +# o fastdep: build module version files (.ver) for $(export-objs) in +# the current directory +# o modules_install: install the modules in the current directory +# o build: When no target is given, first_rule is the default and +# will build the built-in and modular objects in this dir +# (or a subset thereof, depending on $(KBUILD_MODULES),$(KBUILD_BUILTIN) +# When targets are given directly (like foo.o), we just build these +# targets (That happens when someone does make some/dir/foo.[ois]) + +ifeq ($(MAKECMDGOALS),fastdep) + +# =========================================================================== +# Module versions +# =========================================================================== + +ifeq ($(strip $(export-objs)),) + +# If we don't export any symbols in this dir, just descend +# --------------------------------------------------------------------------- + +fastdep: sub_dirs + @echo -n + +else + +# This sets version suffixes on exported symbols +# --------------------------------------------------------------------------- + +MODVERDIR := $(TOPDIR)/include/linux/modules/$(RELDIR) + +# +# Added the SMP separator to stop module accidents between uniprocessor +# and SMP Intel boxes - AC - from bits by Michael Chastain +# + +ifdef CONFIG_SMP + genksyms_smp_prefix := -p smp_ +else + genksyms_smp_prefix := +endif + +$(MODVERDIR)/$(real-objs-y:.o=.ver): modkern_cflags := $(CFLAGS_KERNEL) +$(MODVERDIR)/$(real-objs-m:.o=.ver): modkern_cflags := $(CFLAGS_MODULE) +$(MODVERDIR)/$(export-objs:.o=.ver): export_flags := -D__GENKSYMS__ + +c_flags = -Wp,-MD,$(depfile) $(CFLAGS) $(NOSTDINC_FLAGS) \ + $(modkern_cflags) $(EXTRA_CFLAGS) $(CFLAGS_$(*F).o) \ + -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) \ + $(export_flags) + +# Our objects only depend on modversions.h, not on the individual .ver +# files (fix-dep filters them), so touch modversions.h if any of the .ver +# files changes + +quiet_cmd_cc_ver_c = MKVER include/linux/modules/$(RELDIR)/$*.ver +define cmd_cc_ver_c + mkdir -p $(dir $@); \ + $(CPP) $(c_flags) $< | $(GENKSYMS) $(genksyms_smp_prefix) \ + -k $(VERSION).$(PATCHLEVEL).$(SUBLEVEL) > $@.tmp; \ + if [ ! -r $@ ] || cmp -s $@ $@.tmp; then \ + touch $(TOPDIR)/include/linux/modversions.h; \ + fi; \ + mv -f $@.tmp $@ +endef + +$(MODVERDIR)/%.ver: %.c FORCE + @$(call if_changed_dep,cc_ver_c) + +targets := $(addprefix $(MODVERDIR)/,$(export-objs:.o=.ver)) + +fastdep: $(targets) sub_dirs + @mkdir -p $(TOPDIR)/.tmp_export-objs/modules/$(RELDIR) + @touch $(addprefix $(TOPDIR)/.tmp_export-objs/modules/$(RELDIR)/,$(export-objs:.o=.ver)) + +endif # export-objs + +else # ! fastdep +ifeq ($(MAKECMDGOALS),modules_install) + +# ========================================================================== +# Installing modules +# ========================================================================== + +.PHONY: modules_install + +modules_install: sub_dirs +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 + +else # ! modules_install + # ========================================================================== +# Building +# ========================================================================== + +# 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 @@ -106,15 +211,9 @@ # Compile C sources (.c) # --------------------------------------------------------------------------- -# If we don't know if built-in or modular, assume built-in. -# Only happens in Makefiles which override the default first_rule: +# Default is built-in, unless we know otherwise 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-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) @@ -124,60 +223,59 @@ $(export-objs:.o=.s) : export_flags := $(EXPORT_FLAGS) $(export-objs:.o=.lst): 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 = -Wp,-MD,$(depfile) $(CFLAGS) $(NOSTDINC_FLAGS) \ + $(modkern_cflags) $(EXTRA_CFLAGS) $(CFLAGS_$(*F).o) \ + -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) \ + $(export_flags) quiet_cmd_cc_s_c = CC $(RELDIR)/$@ cmd_cc_s_c = $(CC) $(c_flags) -S -o $@ $< %.s: %.c FORCE - $(call cmd,cmd_cc_s_c) + $(call if_changed_dep,cc_s_c) quiet_cmd_cc_i_c = CPP $(RELDIR)/$@ cmd_cc_i_c = $(CPP) $(c_flags) -o $@ $< %.i: %.c FORCE - $(call cmd,cmd_cc_i_c) + $(call if_changed_dep,cc_i_c) quiet_cmd_cc_o_c = CC $(RELDIR)/$@ -cmd_cc_o_c = $(CC) -Wp,-MD,.$(subst /,_,$@).d $(c_flags) $(listing_o_c) -c -o $@ $< +cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $< $(listing_o_c) %.o: %.c FORCE $(call if_changed_dep,cc_o_c) -quiet_cmd_cc_lst_c = Generating $(RELDIR)/$@ +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) + $(call if_changed_dep,cc_lst_c) # Compile assembler sources (.S) # --------------------------------------------------------------------------- -# FIXME (s.a.) modkern_aflags := $(AFLAGS_KERNEL) -$(real-objs-y) : modkern_aflags := $(AFLAGS_KERNEL) -$(real-objs-y:.o=.s): modkern_aflags := $(AFLAGS_KERNEL) - $(real-objs-m) : modkern_aflags := $(AFLAGS_MODULE) $(real-objs-m:.o=.s): modkern_aflags := $(AFLAGS_MODULE) -a_flags = $(AFLAGS) $(NOSTDINC_FLAGS) $(modkern_aflags) $(EXTRA_AFLAGS) $(AFLAGS_$(*F).o) +a_flags = -Wp,-MD,$(depfile) $(AFLAGS) $(NOSTDINC_FLAGS) \ + $(modkern_aflags) $(EXTRA_AFLAGS) $(AFLAGS_$(*F).o) quiet_cmd_as_s_S = CPP $(RELDIR)/$@ cmd_as_s_S = $(CPP) $(a_flags) -o $@ $< %.s: %.S FORCE - $(call cmd,cmd_as_s_S) + $(call if_changed_dep,as_s_S) quiet_cmd_as_o_S = AS $(RELDIR)/$@ -cmd_as_o_S = $(CC) -Wp,-MD,.$(subst /,_,$@).d $(a_flags) -c -o $@ $< +cmd_as_o_S = $(CC) $(a_flags) -c -o $@ $< %.o: %.S FORCE $(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" +targets += $(real-objs-y) $(real-objs-m) $(EXTRA_TARGETS) $(MAKECMDGOALS) # Build the compiled-in targets # --------------------------------------------------------------------------- @@ -196,7 +294,9 @@ rm -f $@; $(AR) rcs $@) $(O_TARGET): $(obj-y) FORCE - $(call if_changed,cmd_link_o_target) + $(call if_changed,link_o_target) + +targets += $(O_TARGET) endif # O_TARGET # @@ -207,7 +307,9 @@ cmd_link_l_target = rm -f $@; $(AR) $(EXTRA_ARFLAGS) rcs $@ $(obj-y) $(L_TARGET): $(obj-y) FORCE - $(call if_changed,cmd_link_l_target) + $(call if_changed,link_l_target) + +targets += $(L_TARGET) endif # @@ -222,10 +324,12 @@ # but that's not so easy, so we rather make all composite objects depend # on the set of all their parts $(multi-used-y) : %.o: $(multi-objs-y) FORCE - $(call if_changed,cmd_link_multi) + $(call if_changed,link_multi) $(multi-used-m) : %.o: $(multi-objs-m) FORCE - $(call if_changed,cmd_link_multi) + $(call if_changed,link_multi) + +targets += $(multi-used-y) $(multi-used-m) # Compile programs on the host # =========================================================================== @@ -236,7 +340,8 @@ quiet_cmd_host_cc__c = HOSTCC $(RELDIR)/$@ cmd_host_cc__c = $(HOSTCC) -Wp,-MD,.$(subst /,_,$@).d \ - $(HOSTCFLAGS) $(HOST_EXTRACFLAGS) -o $@ $< + $(HOSTCFLAGS) $(HOST_EXTRACFLAGS) \ + $(HOST_LOADLIBES) -o $@ $< $(host-progs-single): %: %.c FORCE $(call if_changed_dep,host_cc__c) @@ -253,51 +358,26 @@ $(HOST_LOADLIBES) $(host-progs-multi): %: $(host-progs-multi-objs) FORCE - $(call if_changed,cmd_host_cc__o) - - -# Descending when making module versions -# --------------------------------------------------------------------------- - -fastdep-list := $(addprefix _sfdep_,$(subdir-ymn)) + $(call if_changed,host_cc__o) -.PHONY: fastdep $(fastdep-list) +targets += $(host-progs-single) $(host-progs-multi-objs) $(host-progs-multi) -fastdep: $(fastdep-list) +endif # ! modules_install +endif # ! fastdep -$(fastdep-list): - @$(MAKE) -C $(patsubst _sfdep_%,%,$@) fastdep - -# Descending when building -# --------------------------------------------------------------------------- - -subdir-list := $(addprefix _subdir_,$(subdir-ym)) - -.PHONY: sub_dirs $(subdir-list) - -sub_dirs: $(subdir-list) - -$(subdir-list): - @$(MAKE) -C $(patsubst _subdir_%,%,$@) +# =========================================================================== +# Generic stuff +# =========================================================================== -# Descending and installing modules +# Descending # --------------------------------------------------------------------------- -modinst-list := $(addprefix _modinst_,$(subdir-ym)) +.PHONY: sub_dirs $(subdir-ym) -.PHONY: modules_install _modinst_ $(modinst-list) +sub_dirs: $(subdir-ym) -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 - -$(modinst-list): - @$(MAKE) -C $(patsubst _modinst_%,%,$@) modules_install +$(subdir-ym): + @$(MAKE) -C $@ $(MAKECMDGOALS) # Add FORCE to the prequisites of a target to force it to be always rebuilt. # --------------------------------------------------------------------------- @@ -307,62 +387,11 @@ FORCE: # -# This is useful for testing -# FIXME: really? -script: - $(SCRIPT) - -# # This sets version suffixes on exported symbols # Separate the object into "normal" objects and "exporting" objects # Exporting objects are: all objects that define symbol tables # -ifdef CONFIG_MODVERSIONS -ifneq "$(strip $(export-objs))" "" - -MODVERDIR := $(TOPDIR)/include/linux/modules/$(RELDIR) - -# -# Added the SMP separator to stop module accidents between uniprocessor -# and SMP Intel boxes - AC - from bits by Michael Chastain -# - -ifdef CONFIG_SMP - genksyms_smp_prefix := -p smp_ -else - genksyms_smp_prefix := -endif - -# 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 - -$(MODVERDIR)/%.ver: %.c FORCE - @mkdir -p $(dir $@) - @$(call cmd,cmd_create_ver) - @if [ -r $@ ] && cmp -s $@ $@.tmp; then \ - rm -f $@.tmp; \ - else \ - touch $(TOPDIR)/include/linux/modversions.h; \ - mv -f $@.tmp $@; \ - fi - -# updates .ver files but not modversions.h -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 - - -endif # export-objs - -endif # CONFIG_MODVERSIONS - # --------------------------------------------------------------------------- # Check if command line has changed @@ -394,9 +423,14 @@ # which is saved in .<target>.o, to the current command line using # the two filter-out commands) -# read all saved command lines and dependencies +# Read all saved command lines and dependencies for the $(targets) we +# may be building above, using $(if_changed{,_dep}). As an +# optimization, we don't need to read them if the target does not +# exist, we will rebuild anyway in that case. + +targets := $(wildcard $(sort $(targets))) +cmd_files := $(wildcard $(foreach f,$(targets),$(dir $(f)).$(notdir $(f)).cmd)) -cmd_files := $(wildcard .*.cmd) ifneq ($(cmd_files),) include $(cmd_files) endif @@ -404,9 +438,12 @@ # function to only execute the passed command if necessary if_changed = $(if $(strip $? \ - $(filter-out $($(1)),$(cmd_$(@F)))\ - $(filter-out $(cmd_$(@F)),$($(1)))),\ - @$(if $($(quiet)$(1)),echo ' $($(quiet)$(1))' &&) $($(1)) && echo 'cmd_$@ := $($(1))' > $(@D)/.$(@F).cmd) + $(filter-out $(cmd_$(1)),$(cmd_$@))\ + $(filter-out $(cmd_$@),$(cmd_$(1)))),\ + @set -e; \ + $(if $($(quiet)cmd_$(1)),echo ' $($(quiet)cmd_$(1))';) \ + $(cmd_$(1)); \ + echo 'cmd_$@ := $(cmd_$(1))' > $(@D)/.$(@F).cmd) # execute the command and also postprocess generated .d dependencies @@ -418,9 +455,9 @@ @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 ) + $(TOPDIR)/scripts/fixdep $(depfile) $@ $(TOPDIR) '$(cmd_$(1))' > $(@D)/.$(@F).tmp; \ + rm -f $(depfile); \ + mv -f $(@D)/.$(@F).tmp $(@D)/.$(@F).cmd) # If quiet is set, only print short version of command |