ref: 0f1737e035ed1d1923ad1da0c19037aa5f261017
parent: 195df08bb9a0780ec3f567545ce384aded7b21c4
parent: 078d96bef7e899d1d494376e545ab61e76ffb9a7
author: sijchen <sijchen@cisco.com>
date: Mon Feb 2 04:23:05 EST 2015
Merge pull request #1778 from mstorsjo/fix-version-generation Don't overwrite the git-tracked version.h
--- a/Makefile
+++ b/Makefile
@@ -61,7 +61,7 @@
include $(SRC_PATH)build/platform-$(OS).mk
-CFLAGS +=
+CFLAGS += -DGENERATED_VERSION_HEADER
LDFLAGS +=
ifeq (Yes, $(GCOV))
--- a/codec/common/generate_version.sh
+++ b/codec/common/generate_version.sh
@@ -14,13 +14,13 @@
GIT_VERSION='"'$GIT_VERSION'"'
rm -f config.git-hash
-cat codec/common/inc/version.h.template | sed "s/\$FULL_VERSION/$GIT_VERSION/g" > codec/common/inc/version.h.new
-if cmp codec/common/inc/version.h.new codec/common/inc/version.h > /dev/null 2>&1; then
+cat codec/common/inc/version_gen.h.template | sed "s/\$FULL_VERSION/$GIT_VERSION/g" > codec/common/inc/version_gen.h.new
+if cmp codec/common/inc/version_gen.h.new codec/common/inc/version_gen.h > /dev/null 2>&1; then
# Identical to old version, don't touch it (to avoid unnecessary rebuilds)
- rm codec/common/inc/version.h.new
- echo "Keeping existing codec/common/inc/version.h"
+ rm codec/common/inc/version_gen.h.new
+ echo "Keeping existing codec/common/inc/version_gen.h"
exit 0
fi
-mv codec/common/inc/version.h.new codec/common/inc/version.h
+mv codec/common/inc/version_gen.h.new codec/common/inc/version_gen.h
-echo "Generated codec/common/inc/version.h"
+echo "Generated codec/common/inc/version_gen.h"
--- /dev/null
+++ b/codec/common/inc/.gitignore
@@ -1,0 +1,1 @@
+version_gen.h
--- a/codec/common/inc/version.h
+++ b/codec/common/inc/version.h
@@ -1,6 +1,10 @@
#ifndef VERSION_H
#define VERSION_H
+#ifdef GENERATED_VERSION_HEADER
+#include "version_gen.h"
+#else
#define VERSION_NUMBER "openh264 default: 1.4"
+#endif
#endif // VERSION_H
--- a/codec/common/inc/version.h.template
+++ /dev/null
@@ -1,6 +1,0 @@
-#ifndef VERSION_H
-#define VERSION_H
-
-#define VERSION_NUMBER $FULL_VERSION
-
-#endif // VERSION_H
--- /dev/null
+++ b/codec/common/inc/version_gen.h.template
@@ -1,0 +1,6 @@
+#ifndef VERSION_GEN_H
+#define VERSION_GEN_H
+
+#define VERSION_NUMBER $FULL_VERSION
+
+#endif // VERSION_GEN_H