Avoid use of $(wildcard) in version.c dependencies
authorDavid Woodhouse <David.Woodhouse@intel.com>
Mon, 7 Nov 2011 11:58:43 +0000 (11:58 +0000)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Mon, 7 Nov 2011 11:59:26 +0000 (11:59 +0000)
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Makefile.am
configure.ac

index 733dafc..f41740f 100644 (file)
@@ -32,8 +32,7 @@ EXTRA_DIST = version.sh openconnect.html openconnect.8 COPYING.LGPL
 DISTCLEANFILES = $(pkgconfig_DATA)
 
 version.c: $(library_srcs) $(openconnect_SOURCES) Makefile.am configure.ac \
-          openconnect.h openconnect-internal.h version.sh \
-          $(wildcard .git/index .git/refs/tags)
+          openconnect.h openconnect-internal.h version.sh @GITVERSIONDEPS@
        @$(srcdir)/version.sh
 
 tmp-dist: uncommitted-check
index ae04095..104cf0b 100644 (file)
@@ -168,5 +168,17 @@ RAWLINGUAS=`sed -e "/^#/d" -e "s/#.*//" "${srcdir}/po/LINGUAS"`
 LINGUAS=`echo $RAWLINGUAS`
 AC_SUBST(LINGUAS)
 
+# We want version.c to depend on the files that would affect the
+# output of version.sh. But we cannot assume that they'll exist,
+# and we cannot use $(wildcard) in a non-GNU makefile. So we just
+# depend on the files which happen to exist at configure time.
+GITVERSIONDEPS=
+for a in .git/index .git/packed-refs .git/refs/tags .git/HEAD; do
+    if test -r $a ; then
+       GITVERSIONDEPS="$GITVERSIONDEPS $a"
+    fi
+done
+AC_SUBST(GITVERSIONDEPS)
+
 AC_OUTPUT(Makefile openconnect.pc po/Makefile www/Makefile \
          www/styles/Makefile www/inc/Makefile www/images/Makefile)