summaryrefslogtreecommitdiff
path: root/Rules.make
diff options
context:
space:
mode:
authorKai Germaschewski <kai@tp1.ruhr-uni-bochum.de>2002-06-09 06:36:13 -0500
committerKai Germaschewski <kai@tp1.ruhr-uni-bochum.de>2002-06-09 06:36:13 -0500
commit0ced6457dcf1da0e260999cb6a67b1dad1804200 (patch)
tree73240b583df2847eacc6c9103f56c37c22de58a5 /Rules.make
parentd84e208ad2877ac7616f32dfed47eeb2952d3416 (diff)
kbuild: Track dependencies for .ver files
Tracking dependencies for .ver files isn't really different from the dependency tracking for the other .[ois] targets we do, so just use the normal $(call if_changed_dep) framework. That makes speeds up re-running "make dep" a lot.
Diffstat (limited to 'Rules.make')
-rw-r--r--Rules.make40
1 files changed, 24 insertions, 16 deletions
diff --git a/Rules.make b/Rules.make
index a2fcf6668de2..193d03294d60 100644
--- a/Rules.make
+++ b/Rules.make
@@ -127,22 +127,32 @@ 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).
+$(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__
-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
+c_flags = -Wp,-MD,$(@D)/.$(@F).d $(CFLAGS) $(NOSTDINC_FLAGS) \
+ $(modkern_cflags) $(EXTRA_CFLAGS) $(CFLAGS_$(*F).o) \
+ -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) \
+ $(export_flags)
-$(MODVERDIR)/%.ver: %.c FORCE
- @mkdir -p $(dir $@)
- @$(call cmd,cmd_create_ver)
- @if [ -r $@ ] && cmp -s $@ $@.tmp; then \
- rm -f $@.tmp; \
- else \
+# 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; \
- mv -f $@.tmp $@; \
- fi
+ fi; \
+ mv -f $@.tmp $@
+endef
+
+$(MODVERDIR)/%.ver: %.c FORCE
+ @$(call if_changed_dep,cc_ver_c)
targets := $(addprefix $(MODVERDIR)/,$(export-objs:.o=.ver))
@@ -194,8 +204,7 @@ first_rule: $(if $(KBUILD_BUILTIN),$(O_TARGET) $(L_TARGET) $(EXTRA_TARGETS)) \
# 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-m) : modkern_cflags := $(CFLAGS_MODULE)
@@ -239,7 +248,6 @@ cmd_cc_lst_c = $(CC) $(c_flags) -g -c -o $*.o $< && $(TOPDIR)/scripts/makels
# Compile assembler sources (.S)
# ---------------------------------------------------------------------------
-# FIXME (s.a.)
modkern_aflags := $(AFLAGS_KERNEL)
$(real-objs-m) : modkern_aflags := $(AFLAGS_MODULE)