From 8ae0a293e82a5be7712f3dcc0214b74d9e595423 Mon Sep 17 00:00:00 2001 From: Dominic Radermacher Date: Thu, 26 Apr 2018 12:27:31 +0200 Subject: use GIT_VERSION as VERSION instead of a predefined value --- Makefile | 6 ++++-- include/lan951x-led-ctl.h | 2 -- 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) -- cgit v1.2.3