diff options
author | Thomas Wood <thomas.wood@intel.com> | 2014-07-22 14:53:18 +0100 |
---|---|---|
committer | Thomas Wood <thomas.wood@intel.com> | 2014-07-23 16:43:05 +0100 |
commit | 743dc7997aa9f5210055896940d87c88983dcda6 (patch) | |
tree | 493416bfc91a0f8f69e7275a5a93848e0f2dec4a /lib/Makefile.sources | |
parent | 784344ef8896e47af13fbb4377b020f33ce4c93c (diff) |
build: improve version.h generation
Move version.h generation into lib/Makefile.sources so that it can be
shared between the Autotools and Android build systems. Also make sure the
"updating version.h" message is only displayed when version.h actually
changes and remove unnecessary includes of version.h.
This also includes changes from Tvrtko Ursulin to prevent a build from
within the git repository failing when git is not available.
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Diffstat (limited to 'lib/Makefile.sources')
-rw-r--r-- | lib/Makefile.sources | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/Makefile.sources b/lib/Makefile.sources index 8c6c4dc0..2d971c5a 100644 --- a/lib/Makefile.sources +++ b/lib/Makefile.sources @@ -47,3 +47,28 @@ libintel_tools_la_SOURCES = \ igt_core.h \ $(NULL) +.PHONY: version.h.tmp +version.h.tmp: + @touch $@ + @if test -d $(top_srcdir)/.git; then \ + if which git > /dev/null 2>&1; then git log -n 1 --oneline | \ + sed 's/^\([^ ]*\) .*/#define IGT_GIT_SHA1 "g\1"/' \ + >> $@ ; \ + else \ + echo '#define IGT_GIT_SHA1 "NO-GIT"' >> $@ ; \ + fi \ + else \ + echo '#define IGT_GIT_SHA1 "NOT-GIT"' >> $@ ; \ + fi + +version.h: version.h.tmp + @if ! cmp -s version.h.tmp version.h; then \ + echo "updating version.h"; \ + mv version.h.tmp version.h ;\ + else \ + rm version.h.tmp ;\ + fi + +BUILT_SOURCES = version.h +CLEANFILES = version.h version.h.tmp + |