From 74812da92adaa7e5949067e33b2867e7c1b3bd49 Mon Sep 17 00:00:00 2001 From: Lorenzo Figini Date: Tue, 1 Feb 2022 16:22:33 +0100 Subject: [PATCH] Use git revision instead of svn in version string --- Makefile | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index d31cf5b..f3e3893 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,17 @@ LDFLAGS= -static-libgfortran -static-libgcc LIBS= /usr/local/lib/libquadmath.a # FFLAGS=-Wall -g -finit-real=nan -ffpe-trap=invalid -fcheck=all -fbounds-check -DIRECTIVES = -DREVISION="'$(shell svnversion src)'" +## +## Git information (used in the version string) +## + +# Short hash of the latest commit +GIT_REV ?= $(shell git rev-parse --short HEAD) + +# Whether the worktree and the latest commit differs +GIT_DIRTY ?= $(shell test -n "$$(git status --porcelain)" && echo "-dirty") + +DIRECTIVES = -DREVISION=\"$(GIT_REV)$(GIT_DIRTY)\" -DPREFIX=\"$(PREFIX)\" all: $(EXE)