summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile8
1 files changed, 7 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index e71f9aa..fb64fc1 100644
--- a/Makefile
+++ b/Makefile
@@ -15,11 +15,17 @@ PKG_CONFIG ?= pkg-config
CC ?= gcc
CFLAGS ?= -g -O0
CFLAGS += -Wall -Wextra -std=c99 -pedantic
+# 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_VERSION)\"
GIT_VERSION := $(shell git describe --match "v[0-9]*" --abbrev=8 --dirty --tags | cut -c2-)
ifeq ($(GIT_VERSION),)
GIT_VERSION := $(shell cat VERSION)
endif
-CFLAGS += -DPROGRAM_VERSION=\"$(GIT_VERSION)\"
# Use hardening options on Linux
ifeq ($(UNAME_S),Linux)