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