1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

fixed version string macro when git is not installed

This commit is contained in:
Steffen Vogel 2015-03-21 12:28:17 +01:00
parent d25ad21d86
commit 39f1dff626
3 changed files with 15 additions and 4 deletions

View file

@ -12,9 +12,11 @@ V ?= 2
LDLIBS = -pthread -lrt -lm -lconfig
CFLAGS = -std=c99 -Iinclude/ -MMD -Wall
CFLAGS += -D_XOPEN_SOURCE=500 -D_GNU_SOURCE -DV=$(V)
CFLAGS += -D__GIT_REV__='"-$(shell git rev-parse --short HEAD)"'
# Conditional flags
# Add git commit hash
ifneq (,$(shell which git))
CFLAGS += -D_GIT_REV='"$(shell git rev-parse --short HEAD)"'
endif
ifdef DEBUG
CFLAGS += -O0 -g
else

View file

@ -11,9 +11,12 @@
#ifndef _CONFIG_H_
#define _CONFIG_H_
/** The version number of the s2ss server */
#ifndef _GIT_REV
#define _GIT_REV "nogit"
#endif
#define VERSION "v0.4" __GIT_REV__
/** The version number of the s2ss server */
#define VERSION "v0.4-" _GIT_REV
/** Maximum number of double values in a struct msg */
#define MAX_VALUES 64

View file

@ -55,8 +55,14 @@
#define LEFT(n) ""
#endif
/* CPP stringification */
#define XSTR(x) STR(x)
#define STR(x) #x
/** Calculate the number of elements in an array. */
#define ARRAY_LEN(a) ( sizeof (a) / sizeof (a)[0] )
/** Swap two values by using a local third one. */
#define SWAP(a, b) do { \
__typeof__(a) tmp = a; \
a = b; \