diff options
author | Luke Bratch <luke@bratch.co.uk> | 2024-03-30 13:32:19 +0000 |
---|---|---|
committer | Luke Bratch <luke@bratch.co.uk> | 2024-03-30 13:32:19 +0000 |
commit | ef5ef17bab5581bc001da0e2a9ab77620a19ffb0 (patch) | |
tree | 88d2ca2ed43774391f618f49c78fd978e40e08cd | |
parent | 8450fa9418e3d0003a6990a5384437bde4ea76c0 (diff) |
Pass VERSION at compile time based on "git describe". Add fallback VERSION file for if Git isn't installed.
-rw-r--r-- | INSTALL | 1 | ||||
-rw-r--r-- | Makefile | 3 | ||||
-rw-r--r-- | VERSION | 1 | ||||
-rw-r--r-- | functions.h | 2 |
4 files changed, 5 insertions, 2 deletions
@@ -9,6 +9,7 @@ To compile: - a C compiler - glibc - OpenSSL +- Git (optional - used to define VERSION if installed) To run: @@ -1,4 +1,5 @@ CC=gcc +GIT_VERSION := "$(shell git describe --abbrev=4 --dirty --always --tags || cat VERSION)" BINARY=blabouncer ifeq ($(PREFIX),) @@ -6,7 +7,7 @@ ifeq ($(PREFIX),) endif blabouncer: blabouncer.c functions.c sockets.c config.c replay.c logging.c message.c config.h functions.h logging.h message.h replay.h sockets.h structures.h - $(CC) -D_DEFAULT_SOURCE -D_BSD_SOURCE -std=gnu99 -Wall -Wextra -lssl -lcrypto -o $(BINARY) blabouncer.c functions.c sockets.c config.c replay.c logging.c message.c + $(CC) -D_DEFAULT_SOURCE -D_BSD_SOURCE -DVERSION=\"$(GIT_VERSION)\" -std=gnu99 -Wall -Wextra -lssl -lcrypto -o $(BINARY) blabouncer.c functions.c sockets.c config.c replay.c logging.c message.c .PHONY: clean clean: @@ -0,0 +1 @@ +v0.2-git diff --git a/functions.h b/functions.h index 30ae4e4..6ec2c28 100644 --- a/functions.h +++ b/functions.h @@ -55,7 +55,7 @@ #define MAXTOKENS 100 // For strsep string splitting -#define VERSION "0.2-git" // Blabouncer version +//#define VERSION "" // VERSION is now passed via -DVERSION by the Makefile // Write debug string to file. // Debug level is provided by level, set to one of DEBUG_CRIT, DEBUG_SOME or DEBUG_FULL. |