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

set VILLASnode version via Makefile instead of config.h

This commit is contained in:
Steffen Vogel 2017-03-27 12:30:44 +02:00
parent 80d3ae13d5
commit 68aa917f78
5 changed files with 16 additions and 17 deletions

View file

@ -26,6 +26,9 @@ BUILDDIR ?= build
# Default debug level for executables
V ?= 2
# Version of VILLASnode
VERSION = 0.7
# Common flags
LDLIBS =
CFLAGS += -std=c11 -Iinclude -Iinclude/villas -I. -MMD -mcx16
@ -69,17 +72,17 @@ SRCDIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
# Add git revision and build variant defines
ifdef CI
CFLAGS += -D_GIT_REV='"${CI_BUILD_REF:0:7}"'
CFLAGS += -D_VARIANT='"-ci-$(VARIANT)"'
GIT_REV = ${CI_BUILD_REF:0:7}
VARIANT = ci-$(VARIANT)
else
GIT = $(shell type -p git)
GIT_REV = $(shell git describe --tags --dirty)
ifneq ($(GIT),)
CFLAGS += -D_GIT_REV='"$(GIT_REV)"'
ifneq ($(shell type -p git),)
# GIT_REV = $(shell git describe --tags)
GIT_REV = $(shell REV=$$(git rev-parse HEAD); echo $${REV:0:7})
endif
CFLAGS += -D_VARIANT='"-$(VARIANT)"'
endif
CFLAGS += -D_VERSION='$(VERSION)' -D_VARIANT='"$(VARIANT)"' -D_GIT_REV='"$(GIT_REV)"'
# pkg-config dependencies
PKGS = libconfig

View file

@ -10,12 +10,8 @@
#pragma once
#ifndef _GIT_REV
#define _GIT_REV "nogit"
#endif
/** The version number of VILLASnode */
#define VERSION "v0.7-" _GIT_REV _VARIANT
#define VERSION_STR "v" XSTR(_VERSION) "-" _GIT_REV "-" _VARIANT
/** Default number of values in a sample */
#define DEFAULT_VALUES 64
@ -38,7 +34,7 @@
#define SYSFS_PATH "/sys"
#define PROCFS_PATH "/proc"
#define USER_AGENT "VILLASnode " VERSION
#define USER_AGENT "VILLASnode " VERSION_STR
/* Required kernel version */
#define KERNEL_VERSION_MAJ 3

View file

@ -72,7 +72,7 @@ int opal_init(int argc, char *argv[], config_setting_t *cfg)
info("Started as OPAL Asynchronous process");
info("This is VILLASnode %s (built on %s, %s)",
VERSION, __DATE__, __TIME__);
VERSION_STR, __DATE__, __TIME__);
opal_print_global();

View file

@ -21,7 +21,7 @@
void print_copyright()
{
printf("VILLASnode %s (built on %s %s)\n",
BLU(VERSION), MAG(__DATE__), MAG(__TIME__));
BLU(VERSION_STR), MAG(__DATE__), MAG(__TIME__));
printf(" copyright 2014-2016, Institute for Automation of Complex Power Systems, EONERC\n");
printf(" Steffen Vogel <StVogel@eonerc.rwth-aachen.de>\n");
}

View file

@ -84,8 +84,8 @@ int main(int argc, char *argv[])
#endif
super_node_init(&sn);
info("This is VILLASnode %s (built on %s, %s)", BLD(YEL(VERSION)),
info("This is VILLASnode %s (built on %s, %s)", BLD(YEL(VERSION_STR)),
BLD(MAG(__DATE__)), BLD(MAG(__TIME__)));
/* Checks system requirements*/