Commit 9168efd2 authored by Kai Germaschewski's avatar Kai Germaschewski

kbuild: clean up generation of modversions.h

There's no good reason why we would generate
include/linux/modversions.h from the top-level Makefile when
CONFIG_MODVERSION=y and from Rules.make otherwise.

Nor is there a good reason to call the target to do so
"update-modverfile" - "include/linux/modversions.h" makes
much more sense.
parent 57824bbb
......@@ -261,6 +261,9 @@ scripts/mkdep scripts/split-include : FORCE
# Generate dependencies
# ---------------------------------------------------------------------------
# In the same pass, generate module versions, that's why it's
# all mixed up here.
.PHONY: depend dep $(patsubst %,_sfdep_%,$(SUBDIRS))
depend dep: .hdepend
......@@ -276,16 +279,17 @@ depend dep: .hdepend
$(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))
ifdef CONFIG_MODVERSIONS
@$(MAKE) update-modverfile
endif
@$(MAKE) include/linux/modversions.h
@$(MAKE) archdep
$(patsubst %,_sfdep_%,$(SUBDIRS)): FORCE
@$(MAKE) -C $(patsubst _sfdep_%, %, $@) fastdep
# update modversions.h, but only if it would change
update-modverfile:
ifdef CONFIG_MODVERSIONS
# Update modversions.h, but only if it would change.
include/linux/modversions.h: FORCE
@(echo "#ifndef _LINUX_MODVERSIONS_H";\
echo "#define _LINUX_MODVERSIONS_H"; \
echo "#include <linux/modsetver.h>"; \
......@@ -294,15 +298,22 @@ update-modverfile:
if [ -f $$f ]; then echo "#include <linux/modules/$${f}>"; fi; \
done; \
echo "#endif"; \
) > $(TOPDIR)/include/linux/modversions.h.tmp
@if [ -r $(TOPDIR)/include/linux/modversions.h ] && cmp -s $(TOPDIR)/include/linux/modversions.h $(TOPDIR)/include/linux/modversions.h.tmp; then \
echo $(TOPDIR)/include/linux/modversions.h was not updated; \
rm -f $(TOPDIR)/include/linux/modversions.h.tmp; \
) > $@.tmp
@if [ -r $@ ] && cmp -s $@ $@.tmp; then \
echo $@ was not updated; \
rm -f $@.tmp; \
else \
echo $(TOPDIR)/include/linux/modversions.h was updated; \
mv -f $(TOPDIR)/include/linux/modversions.h.tmp $(TOPDIR)/include/linux/modversions.h; \
echo $@ was updated; \
mv -f $@.tmp $@; \
fi
else # CONFIG_MODVERSIONS
include/linux/modversions.h:
@echo "#include <linux/modsetver.h>" > $@
endif # CONFIG_MODVERSIONS
# ---------------------------------------------------------------------------
# Modules
......
......@@ -330,11 +330,6 @@ endif # export-objs
$(active-objs): $(TOPDIR)/include/linux/modversions.h
else
$(TOPDIR)/include/linux/modversions.h:
@echo "#include <linux/modsetver.h>" > $@
endif # CONFIG_MODVERSIONS
ifneq "$(strip $(export-objs))" ""
......@@ -400,4 +395,3 @@ if_changed = $(if $(strip $? \
$(filter-out $($(1)),$(cmd_$(@F)))\
$(filter-out $(cmd_$(@F)),$($(1)))),\
@echo '$($(1))' && $($(1)) && echo 'cmd_$@ := $($(1))' > $(@D)/.$(@F).cmd)
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