display git version in ident string if available

This commit is contained in:
Steffen Jaeckel 2017-09-13 15:21:59 +02:00
parent 3dc016ffca
commit 4eac223b54
3 changed files with 10 additions and 4 deletions

View File

@ -14,9 +14,6 @@ UNINSTALL_CMD = $(LT) --mode=uninstall rm
include makefile_include.mk include makefile_include.mk
VERSION := $(shell [ -e .git ] && { git describe --tags --abbrev=0 | sed -e 's/^v//' ; } || echo $(VERSION))
#START_INS #START_INS
OBJECTS=src/addsub/fp_add.o src/addsub/fp_add_d.o src/addsub/fp_addmod.o src/addsub/fp_cmp.o \ OBJECTS=src/addsub/fp_add.o src/addsub/fp_add_d.o src/addsub/fp_addmod.o src/addsub/fp_cmp.o \
src/addsub/fp_cmp_d.o src/addsub/fp_cmp_mag.o src/addsub/fp_sub.o src/addsub/fp_sub_d.o \ src/addsub/fp_cmp_d.o src/addsub/fp_cmp_mag.o src/addsub/fp_sub.o src/addsub/fp_sub_d.o \

View File

@ -16,6 +16,11 @@ VERSION=0.13.1-next
VERSION_LIB=1:0:0 VERSION_LIB=1:0:0
VERSION_PC=0.13.1 VERSION_PC=0.13.1
GIT_VERSION := $(shell [ -e .git ] && { printf git- ; git describe --tags --always --dirty ; } || echo $(VERSION))
ifneq ($(GIT_VERSION),)
CFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\"
endif
# Compiler and Linker Names # Compiler and Linker Names
ifndef CROSS_COMPILE ifndef CROSS_COMPILE
CROSS_COMPILE:= CROSS_COMPILE:=

View File

@ -9,13 +9,17 @@
*/ */
#include <tfm_private.h> #include <tfm_private.h>
#ifndef GIT_VERSION
#define GIT_VERSION TFM_VERSION_S
#endif
const char *fp_ident(void) const char *fp_ident(void)
{ {
static char buf[1024]; static char buf[1024];
memset(buf, 0, sizeof(buf)); memset(buf, 0, sizeof(buf));
snprintf(buf, sizeof(buf)-1, snprintf(buf, sizeof(buf)-1,
"TomsFastMath " TFM_VERSION_S "\n" "TomsFastMath " GIT_VERSION "\n"
#if defined(TFM_IDENT_BUILD_DATE) #if defined(TFM_IDENT_BUILD_DATE)
"Built on " __DATE__ " at " __TIME__ "\n" "Built on " __DATE__ " at " __TIME__ "\n"
#endif #endif