summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominic Radermacher <blip@mockmoon-cybernetics.ch>2018-04-26 12:27:31 +0200
committerDominic Radermacher <blip@mockmoon-cybernetics.ch>2018-04-26 12:27:31 +0200
commit8ae0a293e82a5be7712f3dcc0214b74d9e595423 (patch)
tree4ae333f07146d2627eb48a154be9903e7fe5c519
parent33fb66987a6b2a904ee70fafd0a4ef44d0665573 (diff)
use GIT_VERSION as VERSION instead of a predefined value
-rw-r--r--Makefile6
-rw-r--r--include/lan951x-led-ctl.h2
2 files changed, 4 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index 8880aca..ee01dbd 100644
--- a/Makefile
+++ b/Makefile
@@ -4,8 +4,11 @@ RM = /bin/rm -f
CC = gcc
STRIP = strip
+GIT_VERSION := $(shell git --no-pager describe --tags --dirty |sed 's/\([^-]*-g\)/r\1/;s/-/./g')
+
CFLAGS = -g -Os -std=c11 -I./include -Wall -Wstrict-prototypes -Wconversion
CFLAGS += -Wmissing-prototypes -Wshadow -Wextra -Wunused
+CFLAGS += -DVERSION=\"$(GIT_VERSION)\"
LDFLAGS = -lusb-1.0
PROGS = lan951x-led-ctl
@@ -26,9 +29,8 @@ pack:
@$(ECHO) "Cleaning up ..." ; \
$(RM) src/*.o $(PROGS)
@$(ECHO) "Creating package ..." ; \
- VERSION=`cat include/lan951x-led-ctl.h |grep VERSION |cut -d "\"" -f 2` ; \
cd .. ; \
- tar c -J -f lan951x-led-ctl-$$VERSION.tar.xz lan951x-led-ctl
+ tar c -J -f lan951x-led-ctl-$$GIT_VERSION.tar.xz lan951x-led-ctl
# Generic instructions
src/%.o: src/%.c
diff --git a/include/lan951x-led-ctl.h b/include/lan951x-led-ctl.h
index 5b46aa2..1ec50cc 100644
--- a/include/lan951x-led-ctl.h
+++ b/include/lan951x-led-ctl.h
@@ -17,8 +17,6 @@
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#define VERSION "1.0"
-
#define USB_CTRL_TIMEOUT (5000)
#define LAN951X_VENDOR_ID (0x0424)
#define LAN951X_PRODUCT_ID (0xec00)