summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVadim Mikhailov <mvp@users.noreply.github.com>2017-09-19 20:09:49 -0700
committerVadim Mikhailov <mvp@users.noreply.github.com>2017-09-19 20:17:29 -0700
commit63122bacb531f01c4c3589b36417580fa09428bd (patch)
tree697d7ec79b5e2b1e3a98fe21cf851289cb0a3af4
parent047bb1e392efd3e0ea5d5caf351e20761e12cd44 (diff)
Use program version from git tag
This should fix issue #51.
-rw-r--r--Makefile2
-rw-r--r--uhubctl.c3
2 files changed, 3 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index ce19e70..7074cbf 100644
--- a/Makefile
+++ b/Makefile
@@ -14,6 +14,8 @@ RM := rm -rf
CC ?= gcc
CFLAGS ?= -g -O0
CFLAGS += -Wall -Wextra -std=c99 -pedantic
+GIT_VERSION := $(shell git describe --abbrev=4 --dirty --always --tags)
+CFLAGS += -DPROGRAM_VERSION=\"$(GIT_VERSION)\"
ifeq ($(UNAME_S),Linux)
LDFLAGS += -Wl,-z,relro -lusb-1.0
diff --git a/uhubctl.c b/uhubctl.c
index 9bc23a5..412d4d0 100644
--- a/uhubctl.c
+++ b/uhubctl.c
@@ -9,7 +9,6 @@
*
*/
-#define PROGRAM_VERSION "1.8"
#define _XOPEN_SOURCE 500
#include <stdio.h>
@@ -181,7 +180,7 @@ static const struct option long_options[] = {
int print_usage()
{
printf(
- "uhubctl v%s: utility to control USB port power for smart hubs.\n"
+ "uhubctl %s: utility to control USB port power for smart hubs.\n"
"Usage: uhubctl [options]\n"
"Without options, show status for all smart hubs.\n"
"\n"