Commit 0ced6457 authored by Kai Germaschewski's avatar Kai Germaschewski

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.
parent d84e208a
...@@ -127,22 +127,32 @@ else ...@@ -127,22 +127,32 @@ else
genksyms_smp_prefix := genksyms_smp_prefix :=
endif endif
# We don't track dependencies for .ver files, so we FORCE to check $(MODVERDIR)/$(real-objs-y:.o=.ver): modkern_cflags := $(CFLAGS_KERNEL)
# them always (i.e. always at "make dep" time). $(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 c_flags = -Wp,-MD,$(@D)/.$(@F).d $(CFLAGS) $(NOSTDINC_FLAGS) \
cmd_create_ver = $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -E -D__GENKSYMS__ $< | \ $(modkern_cflags) $(EXTRA_CFLAGS) $(CFLAGS_$(*F).o) \
$(GENKSYMS) $(genksyms_smp_prefix) -k $(VERSION).$(PATCHLEVEL).$(SUBLEVEL) > $@.tmp -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) \
$(export_flags)
$(MODVERDIR)/%.ver: %.c FORCE # Our objects only depend on modversions.h, not on the individual .ver
@mkdir -p $(dir $@) # files (fix-dep filters them), so touch modversions.h if any of the .ver
@$(call cmd,cmd_create_ver) # files changes
@if [ -r $@ ] && cmp -s $@ $@.tmp; then \
rm -f $@.tmp; \ quiet_cmd_cc_ver_c = MKVER include/linux/modules/$(RELDIR)/$*.ver
else \ 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; \ 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)) targets := $(addprefix $(MODVERDIR)/,$(export-objs:.o=.ver))
...@@ -194,8 +204,7 @@ first_rule: $(if $(KBUILD_BUILTIN),$(O_TARGET) $(L_TARGET) $(EXTRA_TARGETS)) \ ...@@ -194,8 +204,7 @@ first_rule: $(if $(KBUILD_BUILTIN),$(O_TARGET) $(L_TARGET) $(EXTRA_TARGETS)) \
# Compile C sources (.c) # Compile C sources (.c)
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# If we don't know if built-in or modular, assume built-in. # Default is built-in, unless we know otherwise
# Only happens in Makefiles which override the default first_rule:
modkern_cflags := $(CFLAGS_KERNEL) modkern_cflags := $(CFLAGS_KERNEL)
$(real-objs-m) : modkern_cflags := $(CFLAGS_MODULE) $(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 ...@@ -239,7 +248,6 @@ cmd_cc_lst_c = $(CC) $(c_flags) -g -c -o $*.o $< && $(TOPDIR)/scripts/makels
# Compile assembler sources (.S) # Compile assembler sources (.S)
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# FIXME (s.a.)
modkern_aflags := $(AFLAGS_KERNEL) modkern_aflags := $(AFLAGS_KERNEL)
$(real-objs-m) : modkern_aflags := $(AFLAGS_MODULE) $(real-objs-m) : modkern_aflags := $(AFLAGS_MODULE)
......
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