diff --git a/server/Makefile b/server/Makefile index ced31845f..7bcd5b9f9 100644 --- a/server/Makefile +++ b/server/Makefile @@ -13,24 +13,24 @@ test: node.o msg.o utils.o VPATH = src -CC = gcc -RM = rm -f -DOXY = doxygen - -# Debug level (if not set via 'make V=?') +# Default debug level V ?= 2 # Some details about the compiled version -GIT_TAG = $(shell git describe --tags --abbrev=0) -GIT_REV = $(shell git rev-parse --short HEAD) # Compiler and linker flags LDFLAGS = -pthread -lrt -lm -lconfig -CFLAGS = -g -std=c99 -Iinclude/ -MMD -Wall +CFLAGS = -std=c99 -Iinclude/ -MMD -Wall CFLAGS += -D_XOPEN_SOURCE=500 -D_GNU_SOURCE -DV=$(V) -CFLAGS += -D__GIT_REV__='"$(GIT_REV)"' -D__GIT_TAG__='"$(GIT_TAG)"' +CFLAGS += -D__GIT_REV__='"-$(shell git rev-parse --short HEAD)"' + +# Conditional flags +ifdef DEBUG + CFLAGS += -g +else + CFLAGS += -O3 +endif -.PHONY: all clean doc .PHONY: all clean clean: diff --git a/server/include/config.h b/server/include/config.h index 3b2b6c93d..e1f4f90a8 100644 --- a/server/include/config.h +++ b/server/include/config.h @@ -12,7 +12,7 @@ #define _CONFIG_H_ /** The version number of the s2ss server */ -#define VERSION __GIT_TAG__ "-" __GIT_REV__ +#define VERSION "v0.4" __GIT_REV__ /** Maximum number of double values in a struct msg */ #define MAX_VALUES 16 diff --git a/server/src/random.c b/server/src/random.c index 0f882d03d..fb3672a99 100644 --- a/server/src/random.c +++ b/server/src/random.c @@ -35,7 +35,7 @@ int main(int argc, char *argv[]) printf("Usage: %s VALUES RATE\n", argv[0]); printf(" VALUES is the number of values a message contains\n"); printf(" RATE how many messages per second\n\n"); - printf("s2ss Simulator2Simulator Server v%s\n", VERSION); + printf("Simulator2Simulator Server %s (built on %s %s)\n", BLU(VERSION), MAG(__DATE__), MAG(__TIME__)); printf("Copyright 2014, Institute for Automation of Complex Power Systems, EONERC\n"); exit(EXIT_FAILURE); } diff --git a/server/src/receive.c b/server/src/receive.c index 7001f5444..700a30850 100644 --- a/server/src/receive.c +++ b/server/src/receive.c @@ -34,7 +34,7 @@ int main(int argc, char *argv[]) if (argc != 2) { printf("Usage: %s LOCAL\n", argv[0]); printf(" LOCAL is a IP:PORT combination of the local host\n\n"); - printf("s2ss Simulator2Simulator Server v%s\n", VERSION); + printf("Simulator2Simulator Server %s (built on %s %s)\n", BLU(VERSION), MAG(__DATE__), MAG(__TIME__)); printf("Copyright 2014, Institute for Automation of Complex Power Systems, EONERC\n"); exit(EXIT_FAILURE); } diff --git a/server/src/send.c b/server/src/send.c index 110e4bc29..1c909bc56 100644 --- a/server/src/send.c +++ b/server/src/send.c @@ -36,7 +36,7 @@ int main(int argc, char *argv[]) printf(" REMOTE is a IP:PORT combination of the remote host\n"); printf(" LOCAL is an optional IP:PORT combination of the local host\n"); printf(" VALUES is the number of values to be read from stdin\n\n"); - printf("s2ss Simulator2Simulator Server v%s\n", VERSION); + printf("Simulator2Simulator Server %s (built on %s %s)\n", BLU(VERSION), MAG(__DATE__), MAG(__TIME__)); printf("Copyright 2014, Institute for Automation of Complex Power Systems, EONERC\n"); exit(EXIT_FAILURE); } diff --git a/server/src/test.c b/server/src/test.c index b73764e22..4cd1ac3dd 100644 --- a/server/src/test.c +++ b/server/src/test.c @@ -33,7 +33,7 @@ int main(int argc, char *argv[]) printf(" TEST has to be 'latency' for now\n"); printf(" LOCAL is a IP:PORT combination of the local host\n"); printf(" REMOTE is a IP:PORT combination of the remote host\n\n"); - printf("s2ss Simulator2Simulator Server v%s\n", VERSION); + printf("Simulator2Simulator Server %s (built on %s %s)\n", BLU(VERSION), MAG(__DATE__), MAG(__TIME__)); printf("Copyright 2014, Institute for Automation of Complex Power Systems, EONERC\n"); exit(EXIT_FAILURE); }