From 7fc87c1bda10f251aa3ded4e63853ba8f0113a10 Mon Sep 17 00:00:00 2001 From: midipix Date: Thu, 3 Nov 2016 18:32:07 -0400 Subject: build system: git version: integrated firm_version.h, FIRM_GIT_VERSION. --- project/common.mk | 3 +++ project/extras.mk | 2 ++ project/revision.h | 19 +++++++++++++++++++ project/tagver.mk | 15 +++++++++++++++ 4 files changed, 39 insertions(+) create mode 100644 project/revision.h 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 +#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 -- cgit v1.2.3