From 38fffa8e27c40d8658b9d80fbfaba50e8d11907b Mon Sep 17 00:00:00 2001 From: Zygo Blaxell Date: Wed, 18 Jan 2017 22:17:02 -0500 Subject: [PATCH] lib: add a version string Signed-off-by: Zygo Blaxell --- include/crucible/version.h | 8 ++++++++ lib/.gitignore | 1 + lib/Makefile | 5 +++++ 3 files changed, 14 insertions(+) create mode 100644 include/crucible/version.h create mode 100644 lib/.gitignore diff --git a/include/crucible/version.h b/include/crucible/version.h new file mode 100644 index 0000000..111ff0b --- /dev/null +++ b/include/crucible/version.h @@ -0,0 +1,8 @@ +#ifndef CRUCIBLE_VERSION_H +#define CRUCIBLE_VERSION_H + +namespace crucible { + extern const char *VERSION; +} + +#endif CRUCIBLE_VERSION_H diff --git a/lib/.gitignore b/lib/.gitignore new file mode 100644 index 0000000..0bde7ac --- /dev/null +++ b/lib/.gitignore @@ -0,0 +1 @@ +.version.* diff --git a/lib/Makefile b/lib/Makefile index b54492d..b9e0578 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -13,6 +13,7 @@ OBJS = \ string.o \ time.o \ uuid.o \ + .version.o \ include ../makeflags @@ -21,6 +22,10 @@ depends.mk: *.c *.cc for x in *.cc; do $(CXX) $(CXXFLAGS) -M "$$x"; done >> depends.mk.new mv -fv depends.mk.new depends.mk +.version.cc: Makefile ../makeflags *.c *.cc ../include/crucible/*.h + echo "namespace crucible { const char *VERSION = \"$(shell git describe --always --dirty || echo UNKNOWN)\"; }" > .version.new.cc + mv -f .version.new.cc .version.cc + -include depends.mk %.o: %.c