From 352a46c4e9f480860c281570ae886794cd35a552 Mon Sep 17 00:00:00 2001 From: midipix Date: Sat, 7 May 2016 10:11:54 -0400 Subject: build system: git version: integrated cparser_version.h, CPARSER_GIT_VERSION. --- project/extras.mk | 3 +++ project/revision.h | 18 ++++++++++++++++++ project/tagver.mk | 15 +++++++++++++++ 3 files changed, 36 insertions(+) create mode 100644 project/revision.h diff --git a/project/extras.mk b/project/extras.mk index c0415f8..e878dc0 100644 --- a/project/extras.mk +++ b/project/extras.mk @@ -6,6 +6,9 @@ CFLAGS_PATH += -I$(PROJECT_DIR)/include/cparser/firm CFLAGS_PATH += -I$(PROJECT_DIR)/include/cparser/parser CFLAGS_PATH += -I$(PROJECT_DIR)/include/cparser/wrappergen +src/driver/actions.o: version.tag +src/driver/actions.lo: version.tag + install-headers-custom: mkdir -p $(DESTDIR)$(INCLUDEDIR)/$(PACKAGE) mkdir -p $(DESTDIR)$(INCLUDEDIR)/$(PACKAGE)/adt diff --git a/project/revision.h b/project/revision.h new file mode 100644 index 0000000..f03f656 --- /dev/null +++ b/project/revision.h @@ -0,0 +1,18 @@ +#include "cparser_version.h" + +#ifndef CPARSER_THREAD +#define CPARSER_THREAD +#endif + +static CPARSER_THREAD char cparser_revision_buffer[64] = {0}; + +static inline char * cparser_revision() +{ + if (strcmp(CPARSER_GIT_VERSION,"unknown")) + sprintf(cparser_revision_buffer,"%s-dirty", + CPARSER_GIT_VERSION); + + return cparser_revision_buffer; +} + +#define cparser_REVISION cparser_revision() diff --git a/project/tagver.mk b/project/tagver.mk index 3af5070..2be8a23 100644 --- a/project/tagver.mk +++ b/project/tagver.mk @@ -3,3 +3,18 @@ VER_NAMESPACE = CPARSER VER_MAJOR = 0 VER_MINOR = 0 VER_PATCH = 0 + + +revision.tag: $(PROJECT_DIR)/project/revision.h + mkdir -p build + cp $(PROJECT_DIR)/project/revision.h build + touch revision.tag + +version.tag: revision.tag + + +clean-revision: + rm -f build/revision.h + rm -f revision.tag + +clean: clean-revision -- cgit v1.2.3