diff options
author | Christian Hesse <mail@eworm.de> | 2014-01-02 14:33:11 +0100 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2014-01-02 14:33:11 +0100 |
commit | 4fd873f078e56e4094dd400362e6da82221938e2 (patch) | |
tree | f9bc8af36a7e65ab3e139d50e455c693ad7acea4 /Makefile | |
parent | 3488a6e741b736e1c422519531a4640ca750c266 (diff) | |
download | udev-block-notify-4fd873f078e56e4094dd400362e6da82221938e2.tar.gz udev-block-notify-4fd873f078e56e4094dd400362e6da82221938e2.tar.zst |
write version to header file
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 19 |
1 files changed, 10 insertions, 9 deletions
@@ -5,20 +5,21 @@ MD := markdown INSTALL := install RM := rm CFLAGS += -O2 -Wall -Werror -CFLAGS += $(shell pkg-config --cflags --libs libudev) \ - $(shell pkg-config --cflags --libs libnotify) -VERSION := $(shell git describe --tags --long 2>/dev/null) +CFLAGS += $(shell pkg-config --cflags --libs libudev) +CFLAGS += $(shell pkg-config --cflags --libs libnotify) # this is just a fallback in case you do not use git but downloaded # a release tarball... -ifeq ($(VERSION),) VERSION := 0.7.2 -endif all: udev-block-notify README.html -udev-block-notify: udev-block-notify.c - $(CC) $(CFLAGS) -o udev-block-notify udev-block-notify.c \ - -DVERSION="\"$(VERSION)\"" +udev-block-notify: udev-block-notify.c version.h + $(CC) $(CFLAGS) -o udev-block-notify udev-block-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" >> $@ README.html: README.md $(MD) README.md > README.html @@ -35,4 +36,4 @@ install-doc: README.html $(INSTALL) -D -m0644 screenshot.png $(DESTDIR)/usr/share/doc/udev-block-notify/screenshot.png clean: - $(RM) -f *.o *~ README.html udev-block-notify + $(RM) -f *.o *~ README.html udev-block-notify version.h |