# generate a first char upper case project name
PROJECT_UCFIRST = $(shell echo '${PROJECT}' | sed 's/\([a-z]\)\([a-zA-Z0-9]*\)/\u\1\2/')
-CPPFLAGS = -DVERSION=\"${VERSION}\" -D_BSD_SOURCE -D_XOPEN_SOURCE=500
+# try to get a better version string from git
+GIT_VERSION = $(shell git describe --tags | tr -d '\n')
+FULL_VERSION = $(shell if [ "$(GIT_VERSION)" ]; then echo "$(GIT_VERSION)"; else echo "$(VERSION)"; fi)
+
+CPPFLAGS = -DVERSION=\"${VERSION}\" -DFULL_VERSION=\"${FULL_VERSION}\"
CPPFLAGS += -DPROJECT=\"${PROJECT}\" -DPROJECT_UCFIRST=\"${PROJECT_UCFIRST}\"
+CPPFLAGS += -D_BSD_SOURCE -D_XOPEN_SOURCE=500
ifeq ($(USEGTK3), 1)
CPPFLAGS += -DHAS_GTK3
endif
}
if (ver) {
- fprintf(stdout, "%s/%s (build %s %s)\n", PROJECT, VERSION, __DATE__, __TIME__);
+ fprintf(stdout, "%s/%s\n", PROJECT, FULL_VERSION);
return EXIT_SUCCESS;
}
if (dump) {