diff options
author | midipix <writeonce@midipix.org> | 2016-11-03 18:32:07 -0400 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2016-11-03 18:32:07 -0400 |
commit | 7fc87c1bda10f251aa3ded4e63853ba8f0113a10 (patch) | |
tree | 8112f399e376c5bb5f3c9152de07901108827827 | |
parent | 5d34190f68299f7928a96c41457dec8898929711 (diff) | |
download | bfirm-7fc87c1bda10f251aa3ded4e63853ba8f0113a10.tar.bz2 bfirm-7fc87c1bda10f251aa3ded4e63853ba8f0113a10.tar.xz |
build system: git version: integrated firm_version.h, FIRM_GIT_VERSION.
-rw-r--r-- | project/common.mk | 3 | ||||
-rw-r--r-- | project/extras.mk | 2 | ||||
-rw-r--r-- | project/revision.h | 19 | ||||
-rw-r--r-- | project/tagver.mk | 15 |
4 files changed, 39 insertions, 0 deletions
diff --git a/project/common.mk b/project/common.mk index 2be2961..bb68f90 100644 --- a/project/common.mk +++ b/project/common.mk @@ -55,3 +55,6 @@ IR_SRCS = $(subst $(SOURCE_DIR)/ir/,ir/,$(ir_sort_files)) GEN_SRCS = $(subst build/gen/ir/,ir/,$(gen_src_files)) COMMON_SRCS = $(BE_SRCS) $(IR_SRCS) $(GEN_SRCS) + +ir/common/firm.o: version.tag +ir/common/firm.lo: version.tag diff --git a/project/extras.mk b/project/extras.mk index 233fafa..6004f95 100644 --- a/project/extras.mk +++ b/project/extras.mk @@ -2,6 +2,8 @@ include $(PROJECT_DIR)/project/codegen.mk LIBFIRM = libfirm +CFLAGS_CONFIG += -DHAVE_FIRM_REVISION_H + CFLAGS_DEBUG += -DDEBUG_libfirm CFLAGS_COMMON += -I$(SOURCE_DIR)/include/libfirm diff --git a/project/revision.h b/project/revision.h new file mode 100644 index 0000000..c465819 --- /dev/null +++ b/project/revision.h @@ -0,0 +1,19 @@ +#include <string.h> +#include "firm_version.h" + +#ifndef FIRM_THREAD +#define FIRM_THREAD +#endif + +static FIRM_THREAD char firm_revision_buffer[64] = {0}; + +static inline char * firm_revision() +{ + if (strcmp(FIRM_GIT_VERSION,"unknown")) + sprintf(firm_revision_buffer,"%s-dirty", + FIRM_GIT_VERSION); + + return firm_revision_buffer; +} + +#define libfirm_VERSION_REVISION firm_revision() diff --git a/project/tagver.mk b/project/tagver.mk index e35e636..6936353 100644 --- a/project/tagver.mk +++ b/project/tagver.mk @@ -3,3 +3,18 @@ VER_NAMESPACE = BFRM 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/firm_revision.h + touch revision.tag + +version.tag: revision.tag + + +clean-revision: + rm -f build/revision.h + rm -f revision.tag + +clean: clean-revision |