Improve version.h generation
authorMåns Rullgård <mans@mansr.com>
Wed, 10 Mar 2010 02:56:56 +0000 (02:56 +0000)
committerMåns Rullgård <mans@mansr.com>
Wed, 10 Mar 2010 02:56:56 +0000 (02:56 +0000)
Force version.sh to run whenever the version might have changed,
regardless of what is being built.  This is done by attaching the
dependencies to a dummy file (.version) which is included from the
makefile.  As make will always attempt to rebuild any included files
before considering other rules, this ensures that the real version.h
is (re-)created before it is required by any source file.

Originally committed as revision 22420 to svn://svn.ffmpeg.org/ffmpeg/trunk

Makefile
common.mak

index 70d23af0dd364ff35f52946b1da8a20c0594db6a..2c046ea8fb2c602a65e640a935c39979f23dc35c 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -85,7 +85,18 @@ tools/%.o: tools/%.c
 
 ffplay.o ffplay.d: CFLAGS += $(SDL_CFLAGS)
 
-cmdutils.o cmdutils.d: version.h
+VERSION_SH  = $(SRC_PATH_BARE)/version.sh
+SVN_ENTRIES = $(SRC_PATH_BARE)/.svn/entries
+
+.version: $(wildcard $(SVN_ENTRIES)) $(VERSION_SH) config.mak
+.version: M=@
+
+version.h .version:
+       $(M)$(VERSION_SH) $(SRC_PATH) $@ $(EXTRA_VERSION)
+       $(Q)touch .version
+
+# force version.sh to run whenever version might have changed
+-include .version
 
 alltools: $(TOOLS)
 
index 36788e5cfefa4fff680e90fea7b373d12a7792cc..e868a2849cd68d08691537165ee875473bcc5da7 100644 (file)
@@ -54,14 +54,6 @@ CFLAGS   += $(ECFLAGS)
 
 %.c %.h: MSG = GEN
 
-SVN_ENTRIES = $(SRC_PATH_BARE)/.svn/entries
-ifeq ($(wildcard $(SVN_ENTRIES)),$(SVN_ENTRIES))
-$(BUILD_ROOT_REL)/version.h: $(SVN_ENTRIES)
-endif
-
-$(BUILD_ROOT_REL)/version.h: $(SRC_PATH_BARE)/version.sh config.mak
-       $(M)$< $(SRC_PATH) $@ $(EXTRA_VERSION)
-
 install: install-libs install-headers
 install-libs: install-libs-yes