diff --git a/hs20/server/Makefile b/hs20/server/Makefile index 248ed5ccc..9b7372796 100644 --- a/hs20/server/Makefile +++ b/hs20/server/Makefile @@ -21,6 +21,16 @@ LIBS += -lsqlite3 # Using glibc < 2.17 requires -lrt for clock_gettime() LIBS += -lrt +ifndef CONFIG_NO_GITVER +# Add VERSION_STR postfix for builds from a git repository +ifeq ($(wildcard ../../.git),../../.git) +GITVER := $(shell git describe --dirty=+) +ifneq ($(GITVER),) +CFLAGS += -DGIT_VERSION_STR_POSTFIX=\"-$(GITVER)\" +endif +endif +endif + OBJS=spp_server.o OBJS += hs20_spp_server.o OBJS += ../../src/utils/xml-utils.o diff --git a/hs20/server/hs20_spp_server.c b/hs20/server/hs20_spp_server.c index f8e477bec..6c74f541d 100644 --- a/hs20/server/hs20_spp_server.c +++ b/hs20/server/hs20_spp_server.c @@ -11,6 +11,7 @@ #include #include "common.h" +#include "common/version.h" #include "xml-utils.h" #include "spp_server.h" @@ -158,7 +159,7 @@ int main(int argc, char *argv[]) os_memset(&ctx, 0, sizeof(ctx)); for (;;) { - int c = getopt(argc, argv, "f:r:"); + int c = getopt(argc, argv, "f:r:v"); if (c < 0) break; switch (c) { @@ -174,6 +175,9 @@ int main(int argc, char *argv[]) case 'r': ctx.root_dir = optarg; break; + case 'v': + printf("hs20_spp_server v" VERSION_STR "\n"); + return 0; default: usage(); return -1;