Auto-generate a version number for the program with git-describe.
[cumulus.git] / Makefile
index 392c3da..e947b47 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 PACKAGES=sqlite3 uuid
 DEBUG=-g #-pg
 CXXFLAGS=-O -Wall -D_FILE_OFFSET_BITS=64 $(DEBUG) \
-        `pkg-config --cflags $(PACKAGES)`
+        `pkg-config --cflags $(PACKAGES)` -DLBS_VERSION=`cat version`
 LDFLAGS=$(DEBUG) -ltar `pkg-config --libs $(PACKAGES)`
 
 SRCS=format.cc localdb.cc ref.cc scandir.cc sha1.cc statcache.cc store.cc
@@ -10,6 +10,10 @@ OBJS=$(SRCS:.cc=.o)
 lbs : $(OBJS)
        $(CXX) $(LDFLAGS) -o $@ $^
 
+version :
+       (git-describe || echo "Unknown") >version
+$(OBJS) : version
+
 dep:
        touch Makefile.dep
        makedepend -fMakefile.dep $(SRCS)