diff src/Makefile @ 173:03ab3ade9fe5

modify display version.
author Naoya OYAMA <naoya.oyama@gmail.com>
date Mon, 29 Oct 2012 23:34:49 +0900
parents 061ef2cd98f0
children 27e5f99f8991
line wrap: on
line diff
--- a/src/Makefile	Mon Oct 29 22:25:59 2012 +0900
+++ b/src/Makefile	Mon Oct 29 23:34:49 2012 +0900
@@ -100,11 +100,19 @@
 	$(CC) $(OBJS3) $(LDFLAGS) $(EXTRALIBS) -o $@
 
 clean:
-	-$(RM) -f *.o $(PROG) $(PROG2) $(PROG3) $(PROG4)
+	-$(RM) -f *.o $(PROG) $(PROG2) $(PROG3) $(PROG4) version.h
 	-$(RM) -f .depend
 
 distclean:
 
+version.h:
+	revh=`hg parents --template 'const char *version = "r{rev}:{node|short} ({date|shortdate})";\n' 2>/dev/null`; \
+	if [ -n "$$revh" ] ; then \
+		echo "$$revh" > $@; \
+	else \
+		echo "const char *version = \"$(RELEASE_VERSION)\";" > $@; \
+	fi
+
 install: $(PROG) $(PROG2) $(PROG3) $(PROG4)
 	$(INSTALL) -d $(bindir)
 	$(INSTALL) $(PROG) $(bindir)
@@ -118,7 +126,7 @@
 	$(STRIP) $(INSTALLSTRIP) $(bindir)/$(PROG3)
 	$(STRIP) $(INSTALLSTRIP) $(bindir)/$(PROG4)
 
-depend:
+depend: version.h
 	$(CC) -I.. -MM $(CFLAGS) $(SRCS) 1>.depend
 
 .PHONY: clean distclean install depend