summaryrefslogtreecommitdiff
path: root/project
diff options
context:
space:
mode:
Diffstat (limited to 'project')
-rw-r--r--project/common.mk3
-rw-r--r--project/extras.mk2
-rw-r--r--project/revision.h19
-rw-r--r--project/tagver.mk15
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