diff mbox

[i-g-t] build: Don't use automake's conditional in a Makefile.sources

Message ID 1435845897-14001-1-git-send-email-damien.lespiau@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Lespiau, Damien July 2, 2015, 2:04 p.m. UTC
I just remembered that those Makefile.sources files where also
included by the Android build system, so we can't use automake's
conditionals in there.

So, we want to use GNU make's one. Unfortunately, after all those years,
GNU automake still doesn't do antying useful with GNU make's ifeq:

  lib/Makefile.sources:66: error: else without if

automake will helpefully signal that the 'else' corresponding to the
'ifeq' doesn't have a corresponding 'if'. Well, yeah, thanks.

Fortunately, we can work around this by cunningly inserting a space
before 'ifeq', 'else' and 'endif' and fool automake's regex-based
checks.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
---
 configure.ac         | 2 +-
 lib/Makefile.sources | 7 ++++---
 2 files changed, 5 insertions(+), 4 deletions(-)
diff mbox

Patch

diff --git a/configure.ac b/configure.ac
index a69a381..77b595b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -217,7 +217,7 @@  AC_ARG_ENABLE(git-hash,
 	      AS_HELP_STRING([--disable-git-hash],
 			     [Do not use git hash in version]),
 	      [git_hash=$enableval], [git_hash=yes])
-AM_CONDITIONAL(SKIP_GIT_HASH, [test "x$git_hash" = xno])
+AC_SUBST(GIT_HASH, [$git_hash])
 
 # -----------------------------------------------------------------------------
 
diff --git a/lib/Makefile.sources b/lib/Makefile.sources
index a19ffd9..7f88b65 100644
--- a/lib/Makefile.sources
+++ b/lib/Makefile.sources
@@ -60,10 +60,11 @@  libintel_tools_la_SOURCES = 	\
 
 .PHONY: version.h.tmp
 
-if SKIP_GIT_HASH
+# leaving a space here to work around automake's conditionals
+ ifeq ($(GIT_HASH),no)
 $(IGT_LIB_PATH)/version.h.tmp:
 	@echo '#define IGT_GIT_SHA1 "git"' >> $@
-else
+ else
 $(IGT_LIB_PATH)/version.h.tmp:
 	@touch $@
 	@if test -d $(GPU_TOOLS_PATH)/.git; then \
@@ -77,7 +78,7 @@  $(IGT_LIB_PATH)/version.h.tmp:
 	else \
 		echo '#define IGT_GIT_SHA1 "NOT-GIT"' ; \
 	fi >> $@
-endif # SKIP_GIT_HASH
+ endif # GIT_HASH
 
 
 $(IGT_LIB_PATH)/version.h: $(IGT_LIB_PATH)/version.h.tmp