diff options
-rw-r--r-- | Makefile | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -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) |