Added automatic determination of the SVN revision number if a build
[sgt/puzzles] / Recipe
diff --git a/Recipe b/Recipe
index 4c508c1..c79f9a9 100644 (file)
--- a/Recipe
+++ b/Recipe
@@ -102,8 +102,10 @@ FORCE:
 !begin gtk
 version.o: FORCE;
 FORCE:
-       if test -z "$(VER)" && md5sum -c manifest; then \
+       if test -z "$(VER)" && test -f manifest && md5sum -c manifest; then \
                $(CC) $(COMPAT) $(XFLAGS) $(CFLAGS) `cat version.def` -c version.c; \
+       elif test -z "$(VER)" && svnversion . >&/dev/null; then \
+               $(CC) $(COMPAT) $(XFLAGS) $(CFLAGS) "-DREVISION=`svnversion .`" -c version.c; \
        else \
                $(CC) $(COMPAT) $(XFLAGS) $(CFLAGS) $(VER) -c version.c; \
        fi
@@ -117,6 +119,8 @@ version.o: FORCE;
 FORCE:
        if test -z "$(VER)" && test -f manifest && (md5 -r `awk '{print $$2}' manifest` | diff -w manifest -); then \
                $(CC) $(COMPAT) $(XFLAGS) $(CFLAGS) `cat version.def` -c version.c; \
+       elif test -z "$(VER)" && svnversion . >&/dev/null; then \
+               $(CC) $(COMPAT) $(XFLAGS) $(CFLAGS) "-DREVISION=`svnversion .`" -c version.c; \
        else \
                $(CC) $(COMPAT) $(XFLAGS) $(CFLAGS) $(VER) -c version.c; \
        fi