From 2e9fdf8841de40f008697ba8bf711fa3f3f2c0e8 Mon Sep 17 00:00:00 2001 From: Andreas Zwinkau Date: Wed, 26 Oct 2011 15:51:51 +0200 Subject: [PATCH] Compile git revision into libfirm --- .gitignore | 1 + Makefile | 8 ++++++++ ir/common/firm.c | 4 +--- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index c486cc980..702836dd2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ Makefile.in +firm_revision.h /aclocal.m4 /autom4te.cache/ /config.guess diff --git a/Makefile b/Makefile index cd845835a..a3cdbdda6 100644 --- a/Makefile +++ b/Makefile @@ -37,6 +37,14 @@ CFLAGS += -Wall -W -Wextra -Wstrict-prototypes -Wmissing-prototypes -Wwrite-s LINKFLAGS += $(LINKFLAGS_$(variant)) VPATH = $(srcdir) +REVISION ?= $(shell git describe --abbrev=40 --always --dirty --match '') + +# Update revision.h if necessary +UNUSED := $(shell \ + REV="\#define libfirm_VERSION_REVISION \"$(REVISION)\""; \ + echo "$$REV" | cmp -s - firm_revision.h 2> /dev/null || echo "$$REV" > firm_revision.h \ +) + .PHONY: all all: firm diff --git a/ir/common/firm.c b/ir/common/firm.c index 162ac0cec..7794fe681 100644 --- a/ir/common/firm.c +++ b/ir/common/firm.c @@ -25,9 +25,7 @@ */ #include "config.h" -#ifdef HAVE_FIRM_REVISION_H -# include "firm_revision.h" -#endif +#include "firm_revision.h" #include #include -- 2.20.1