diff options
author | Christian Hesse <mail@eworm.de> | 2014-01-02 14:26:19 +0100 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2014-01-02 14:26:19 +0100 |
commit | f5c2bc9fa415bb47772b76fc8765c6ac5e954f81 (patch) | |
tree | a5f8baeadf508d6b56b5d16cf4545cee45b8c273 | |
parent | e88f533d13743151a01f63a135a25ed7d2372c06 (diff) | |
download | netlink-notify-f5c2bc9fa415bb47772b76fc8765c6ac5e954f81.tar.gz netlink-notify-f5c2bc9fa415bb47772b76fc8765c6ac5e954f81.tar.zst |
write version to header file
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | Makefile | 15 | ||||
-rw-r--r-- | netlink-notify.c | 2 |
3 files changed, 11 insertions, 7 deletions
@@ -3,3 +3,4 @@ netlink-notify-*.png netlink-notify README.html +version.h @@ -7,18 +7,19 @@ INSTALL := install RM := rm CFLAGS += -O2 -Wall -Werror CFLAGS += $(shell pkg-config --cflags --libs libnotify) -VERSION := $(shell git describe --tags --long 2>/dev/null) # this is just a fallback in case you do not use git but downloaded # a release tarball... -ifeq ($(VERSION),) VERSION := 0.6.3 -endif all: netlink-notify icons README.html -netlink-notify: netlink-notify.c - $(CC) $(CFLAGS) -o netlink-notify netlink-notify.c \ - -DVERSION="\"$(VERSION)\"" +netlink-notify: netlink-notify.c version.h + $(CC) $(CFLAGS) -o netlink-notify netlink-notify.c + +version.h: $(wildcard .git/HEAD .git/index .git/refs/tags/*) Makefile + echo "#ifndef VERSION" > $@ + echo "#define VERSION \"$(shell git describe --tags --long 2>/dev/null || echo ${VERSION})\"" >> $@ + echo "#endif" >> $@ icons: netlink-notify-up.png netlink-notify-down.png netlink-notify-address.png netlink-notify-away.png @@ -61,4 +62,4 @@ install-doc: README.html $(INSTALL) -D -m0644 screenshot-up.png $(DESTDIR)/usr/share/doc/netlink-notify/screenshot-up.png clean: - $(RM) -f *.o *~ netlink-notify-*.png README.html netlink-notify + $(RM) -f *.o *~ netlink-notify-*.png README.html netlink-notify version.h diff --git a/netlink-notify.c b/netlink-notify.c index 01b9a89..9ae38f0 100644 --- a/netlink-notify.c +++ b/netlink-notify.c @@ -26,6 +26,8 @@ #include <libnotify/notify.h> +#include "version.h" + #define PROGNAME "netlink-notify" #define MYPROTO NETLINK_ROUTE |