Commit f4d62359 authored by Andreas Freise's avatar Andreas Freise

adding new version string generation, using hard coded values when git not...

adding new version string generation, using hard coded values when git not available and repkaceing first hyphen with dot
parent 9b50c067
......@@ -7,6 +7,11 @@
#
SHELL = bash
# Hard coded version string in case it cannot be derived using git, this needs to be
# updated manually upon every release!
VERSION = 2.2
SHA = 2.2-33-g9b50c06
.PHONY: clean tags cover_report test_clean api_clean
ifeq "$(ARCH)" "linux"
......@@ -207,10 +212,22 @@ PREREQS += $(OBJECTS)
# determine short SHA of git commit
#GIT_SHA_CMD = $(GIT) rev-parse --verify HEAD --short
GIT_SHA_CMD = $(GIT) describe --long | awk '{ sub("-",".",$0)}1'
GIT_SHA = $(shell $(GIT_SHA_CMD))
GIT_VER_CMD = $(GIT) describe --long | awk '{ sub("-",".",$0)}1' | cut -d- -f1
GIT_VERSION = $(shell $(GIT_VER_CMD))
#GIT_SHA_CMD = $(GIT) describe --long | awk '{ sub("-",".",$0)}1'
GIT_SHA_CMD = $(GIT) describe --long 2>/dev/null
GIT_SHA = $(shell $(GIT_SHA_CMD))
#GIT_VER_CMD = $(GIT) describe --long | awk '{ sub("-",".",$0)}1' | cut -d- -f1
GIT_VER_CMD = $(GIT) describe --abbrev=0 2>/dev/null
GIT_VERSION = $(shell $(GIT_VER_CMD))
ifeq ($(strip $(GIT_VERSION)),)
GIT_VERSION=$(VERSION)
endif
ifeq ($(strip $(GIT_SHA)),)
GIT_SHA=$(SHA)
endif
# Rewriting the SHA to replace the first - with a . for A.B.C like version string
VERSION_LIST = $(word $2, $(subst -, ,$(GIT_SHA)))
GIT_SHA_REWRITE=$(call VERSION_LIST,$*,1).$(call VERSION_LIST,$*,2)-$(call VERSION_LIST,$*,3)
# the default target
default: kat
......@@ -219,7 +236,7 @@ FAST_CFLAGS=$(BASE_CFLAGS)
# compile objects from c code
%.o: %.c
$(CC) ${GSL_CFLAGS} $(BASE_CFLAGS) -c $(INCLUDES) $<
# make all
all: kat win test versionnumber
......@@ -331,7 +348,7 @@ versionnumber: config $(PREREQS)
# generate the config file
config:
# output the value of GIT_SHA to kat_config.h
@echo "#define GIT_REVISION \"$(GIT_SHA)\"" > $(KAT_CONFIG_H)
@echo "#define GIT_REVISION \"$(GIT_SHA_REWRITE)\"" > $(KAT_CONFIG_H)
@echo "#define VERSION \"$(GIT_VERSION)\"" >> $(KAT_CONFIG_H)
@echo \#define MYTIME \"`date +%d.%m.%Y`\" >> $(KAT_CONFIG_H)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment