Commit 45bd64fa authored by Kai Germaschewski's avatar Kai Germaschewski

kbuild: Get rid of -DMODVERSIONS, further cleanup

-DMODVERSIONS isn't used anymore, so it can go. Also, after cleaning
up include/linux/module.h, it's obvious that we don't need
include/linux/modversions.h at all if CONFIG_MODVERSIONS not set,
no need to generate it.

Rules.make explicitly lists files which depend on modversions.h,
since make dep cannot know about the
"-include include/linux/modversions.h" which gets added to
the command line. Now that we understand when it is needed, we can
even get that list right ;-)

Oh well, nice theory. .hdepend will touch module.h when modversions.h
changes, so we still get unnecessary recompiles. We really need to
switch to the new way of dependency generation, it gets all that
right without even thinking about these special cases.

We don't track dependencies for .ver files. In fact, we relied on that
checksum would only change if the corresponding exporting C source
changes. That's not true, of course, all of the included headers have
say as well. So we better force the hash to be checked
unconditionally every time "make dep" is run.
parent c6fd296c
...@@ -279,14 +279,14 @@ depend dep: .hdepend ...@@ -279,14 +279,14 @@ depend dep: .hdepend
$(if $(filter dep depend,$(MAKECMDGOALS)),FORCE) $(if $(filter dep depend,$(MAKECMDGOALS)),FORCE)
scripts/mkdep -- `find $(FINDHPATH) -name SCCS -prune -o -follow -name \*.h ! -name modversions.h -print` > $@ scripts/mkdep -- `find $(FINDHPATH) -name SCCS -prune -o -follow -name \*.h ! -name modversions.h -print` > $@
@$(MAKE) $(patsubst %,_sfdep_%,$(SUBDIRS)) @$(MAKE) $(patsubst %,_sfdep_%,$(SUBDIRS))
ifdef CONFIG_MODVERSIONS
@$(MAKE) include/linux/modversions.h @$(MAKE) include/linux/modversions.h
endif
@$(MAKE) archdep @$(MAKE) archdep
$(patsubst %,_sfdep_%,$(SUBDIRS)): FORCE $(patsubst %,_sfdep_%,$(SUBDIRS)): FORCE
@$(MAKE) -C $(patsubst _sfdep_%, %, $@) fastdep @$(MAKE) -C $(patsubst _sfdep_%, %, $@) fastdep
ifdef CONFIG_MODVERSIONS
# Update modversions.h, but only if it would change. # Update modversions.h, but only if it would change.
include/linux/modversions.h: FORCE include/linux/modversions.h: FORCE
...@@ -307,13 +307,6 @@ include/linux/modversions.h: FORCE ...@@ -307,13 +307,6 @@ include/linux/modversions.h: FORCE
mv -f $@.tmp $@; \ mv -f $@.tmp $@; \
fi fi
else # CONFIG_MODVERSIONS
include/linux/modversions.h:
@echo "#include <linux/modsetver.h>" > $@
endif # CONFIG_MODVERSIONS
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Modules # Modules
...@@ -322,7 +315,7 @@ ifdef CONFIG_MODULES ...@@ -322,7 +315,7 @@ ifdef CONFIG_MODULES
# Build modules # Build modules
ifdef CONFIG_MODVERSIONS ifdef CONFIG_MODVERSIONS
MODFLAGS += -DMODVERSIONS -include $(HPATH)/linux/modversions.h MODFLAGS += -include $(HPATH)/linux/modversions.h
endif endif
.PHONY: modules .PHONY: modules
......
...@@ -291,9 +291,6 @@ script: ...@@ -291,9 +291,6 @@ script:
# #
ifdef CONFIG_MODULES ifdef CONFIG_MODULES
multi-objs := $(foreach m, $(obj-y) $(obj-m), $($(basename $(m))-objs))
active-objs := $(sort $(multi-objs) $(obj-y) $(obj-m))
ifdef CONFIG_MODVERSIONS ifdef CONFIG_MODVERSIONS
ifneq "$(strip $(export-objs))" "" ifneq "$(strip $(export-objs))" ""
...@@ -311,32 +308,36 @@ else ...@@ -311,32 +308,36 @@ else
genksyms_smp_prefix := genksyms_smp_prefix :=
endif endif
$(MODINCL)/$(MODPREFIX)%.ver: %.c # We don't track dependencies for .ver files, so we FORCE to check
@if [ ! -r $(MODINCL)/$(MODPREFIX)$*.stamp -o $(MODINCL)/$(MODPREFIX)$*.stamp -ot $< ]; then \ # them always (i.e. always at "make dep" time).
echo '$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -E -D__GENKSYMS__ $<'; \
echo '| $(GENKSYMS) $(genksyms_smp_prefix) -k $(VERSION).$(PATCHLEVEL).$(SUBLEVEL) > $@.tmp'; \ cmd_create_ver = $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -E -D__GENKSYMS__ $< | \
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -E -D__GENKSYMS__ $< \ $(GENKSYMS) $(genksyms_smp_prefix) -k $(VERSION).$(PATCHLEVEL).$(SUBLEVEL) > $@.tmp
| $(GENKSYMS) $(genksyms_smp_prefix) -k $(VERSION).$(PATCHLEVEL).$(SUBLEVEL) > $@.tmp; \
if [ -r $@ ] && cmp -s $@ $@.tmp; then echo $@ is unchanged; rm -f $@.tmp; \
else echo mv $@.tmp $@; mv -f $@.tmp $@; fi; \
fi; touch $(MODINCL)/$(MODPREFIX)$*.stamp
$(addprefix $(MODINCL)/$(MODPREFIX),$(export-objs:.o=.ver)): $(TOPDIR)/include/linux/autoconf.h $(MODINCL)/$(MODPREFIX)%.ver: %.c FORCE
@echo $(cmd_create_ver)
@$(cmd_create_ver)
@if [ -r $@ ] && cmp -s $@ $@.tmp; then \
echo $@ is unchanged; rm -f $@.tmp; \
else \
echo mv $@.tmp $@; mv -f $@.tmp $@; \
fi
# updates .ver files but not modversions.h # updates .ver files but not modversions.h
fastdep: $(addprefix $(MODINCL)/$(MODPREFIX),$(export-objs:.o=.ver)) fastdep: $(addprefix $(MODINCL)/$(MODPREFIX),$(export-objs:.o=.ver))
endif # export-objs endif # export-objs
$(active-objs): $(TOPDIR)/include/linux/modversions.h # make dep cannot correctly figure out the dependency on the generated
# modversions.h, so we list them here:
endif # CONFIG_MODVERSIONS # o files which export symbols and are compiled into the kernel include
# it (to generate a correct symbol table)
ifneq "$(strip $(export-objs))" "" # o all modules get compiled with -include modversions.h
$(export-objs): $(TOPDIR)/include/linux/modversions.h $(filter $(export-objs),$(real-objs-y)): $(TOPDIR)/include/linux/modversions.h
$(real-objs-m): $(TOPDIR)/include/linux/modversions.h
endif endif # CONFIG_MODVERSIONS
endif # CONFIG_MODULES endif # CONFIG_MODULES
......
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