diff --git a/src/Makefile b/src/Makefile
index 5523dd24a8e6b6bdd9e87d4a7cb0723f30796ec5..101fa59df66a3b3ddb2d03fb8772092db7d091c2 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -2,6 +2,7 @@
include ./findcudalib.mk
INCLUDE = $(CUDA_PATH)/include
+
ifeq ($(dbg),1)
NV_FLAGS += -g -G
EX_FLAGS = -g -O0 -m$(OS_SIZE)
@@ -9,6 +10,20 @@ else
EX_FLAGS = -O3 -m$(OS_SIZE)
endif
+## Determine the version; TODO add tags for versions
+ifndef (VERSION)
+ifeq ($(shell git status >& /dev/null && echo true),true)
+ VERSION:=git rev. $(shell git rev-parse HEAD | sed 's/\(.\{8\}\).*/\1/')
+ifneq ($(shell git status --porcelain),)
+ VERSION:=$(VERSION) (modified)
+endif
+else
+ VERSION:=unknown (not compiled in a git repository)
+endif
+endif
+CC_FLAGS += -DVERSION="\"$(VERSION)\""
+
+
CC_FLAGS += -I$(CUDA_PATH)/include
CC_FLAGS += -Wall -Wno-write-strings -std=c++0x -pedantic # TODO: test on Mac OSX and other architectures
NV_FLAGS += -lineinfo
diff --git a/src/arbd.cpp b/src/arbd.cpp
index 98c93e2be75e40ec5ac9cb78cf25b1d453988a1d..d277fc829e6b4bc7d3c59ab0cbaa33e05ea717e1 100644
--- a/src/arbd.cpp
+++ b/src/arbd.cpp
@@ -31,7 +31,12 @@ int main(int argc, char* argv[]) {
return 0;
} else if (argc == 2 && (strcmp(argv[1], "--version") == 0)) {
// --version
- printf("%s Nov 2016 (alpha)\n", argv[0]);
+ // printf("%s Nov 2016 (alpha)\n", argv[0]);
+#ifdef VERSION
+ printf("%s %s\n", argv[0], VERSION);
+#else
+ printf("%s Nov 2016 (alpha)\n", argv[0]);
+#endif
return 0;
} else if (argc == 2 && (strcmp(argv[1], "--info") == 0)) {
// --info
@@ -46,8 +51,7 @@ int main(int argc, char* argv[]) {
// printf("Everything's great when you're...BrownTown\n");
printf(" –––––––––––––––––––––––––––––––––––––––––––––\n");
printf(" | Atomic Resolution Brownian Dynamics |\n");
- printf(" –––––––––––––––––––––––––––––––––––––––––––––\n\n");
-
+ printf(" –––––––––––––––––––––––––––––––––––––––––––––\n");
GPUManager::init();
size_t n_gpus = max(GPUManager::gpus.size(), 1lu);