summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgustavo panizzo <gfa@zumbi.com.ar>2018-03-11 22:34:43 +0800
committergustavo panizzo <gfa@zumbi.com.ar>2018-03-11 22:34:43 +0800
commit9169cb7fbcc8da368eb49623db824c8e80f0ca1d (patch)
tree218e7324a8d043c440db233be3eab97b818299bc
parent1aa7584d2fd635fb418626107a54a851e30f2a1a (diff)
debian-ways
Gbp-Pq: Name debian-ways
-rw-r--r--Makefile9
1 files changed, 8 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 7074cbf..8adee05 100644
--- a/Makefile
+++ b/Makefile
@@ -15,7 +15,14 @@ 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)\"
+
+# Gets the full version of the source package including debian version
+DEB_VERSION := $(shell dpkg-parsechangelog | egrep '^Version:' | cut -f 2 -d ' ')
+DEB_NOEPOCH_VERSION := $(shell echo $(DEB_VERSION) | cut -d: -f2-)
+# # Gets only the upstream version of the package
+DEB_UPSTREAM_VERSION := $(shell echo $(DEB_NOEPOCH_VERSION) | sed 's/-[^-]*$$//')
+
+CFLAGS += -DPROGRAM_VERSION=\"$(DEB_UPSTREAM_VERSION)\"
ifeq ($(UNAME_S),Linux)
LDFLAGS += -Wl,-z,relro -lusb-1.0