summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stapelberg <michael@stapelberg.de>2010-07-23 23:13:41 +0200
committerMichael Stapelberg <michael@stapelberg.de>2010-07-23 23:13:41 +0200
commitefde6a170d924cfe5e65fffdff2f77825f8ce477 (patch)
treee057d1565bff36cde60064a97d4cc72ffab0ad57
parent5d43c2053868dd1f3932dd5330df5ed57039cbbb (diff)
print version number when invoked with -v
-rw-r--r--Makefile2
-rw-r--r--i3lock.c2
2 files changed, 3 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 7cb5052..6b00e9a 100644
--- a/Makefile
+++ b/Makefile
@@ -18,6 +18,8 @@ FILES:=$(wildcard *.c)
FILES:=$(FILES:.c=.o)
VERSION:=$(shell git describe --tags --abbrev=0)
+GIT_VERSION:="$(shell git describe --tags --always) ($(shell git log --pretty=format:%cd --date=short -n1))"
+CFLAGS += -DVERSION=\"${GIT_VERSION}\"
.PHONY: install clean uninstall
diff --git a/i3lock.c b/i3lock.c
index ba742d1..d1add20 100644
--- a/i3lock.c
+++ b/i3lock.c
@@ -267,7 +267,7 @@ int main(int argc, char *argv[]) {
while ((o = getopt_long(argc, argv, "vnbdi:c:tp:", longopts, &optind)) != -1) {
switch (o) {
case 'v':
- errx(EXIT_SUCCESS, "i3lock © 2010 Michael Stapelberg\n");
+ errx(EXIT_SUCCESS, "version " VERSION " © 2010 Michael Stapelberg\n");
case 'n':
dont_fork = true;
break;