aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2012-03-14 10:56:23 +0100
committerNatanael Copa <ncopa@alpinelinux.org>2012-03-14 10:56:23 +0100
commit1f9f814770fb61f41122e5408bf62b47f718e6a1 (patch)
tree94817878a7c542077d43732ccf82963b62ad856f
parent68e94a0780098e8b5e4772a270f91a60a370b8f6 (diff)
downloadpingu-1f9f814770fb61f41122e5408bf62b47f718e6a1.tar.bz2
pingu-1f9f814770fb61f41122e5408bf62b47f718e6a1.tar.xz
build: use git version tag for version info if available
-rw-r--r--Makefile8
1 files changed, 7 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 3e7f2b0..7bd4315 100644
--- a/Makefile
+++ b/Makefile
@@ -4,6 +4,12 @@ SBIN_TARGETS = pingu pinguctl
LUA_TARGETS = client.so
TARGETS = $(BIN_TARGETS) $(SBIN_TARGETS) $(LUA_TARGETS)
VERSION = 1.0
+PINGU_VERSION := $(shell \
+ if [ -d .git ]; then \
+ git describe --long; \
+ else \
+ echo $(VERSION); \
+ fi)
prefix = /usr
localstatedir = /var
@@ -24,7 +30,7 @@ PKG_CONFIG ?= pkg-config
SUBDIRS := man
CFLAGS ?= -g
-CFLAGS += -DPINGU_VERSION=\"$(VERSION)\"
+CFLAGS += -DPINGU_VERSION=\"$(PINGU_VERSION)\"
CFLAGS += -Wall -Wstrict-prototypes -D_GNU_SOURCE -std=gnu99
CFLAGS += -DDEFAULT_PIDFILE=\"$(pingustatedir)/pingu.pid\"
CFLAGS += -DDEFAULT_ADM_client=\"$(pingustatedir)/pingu.ctl\"