diff options
author | Christian Hesse <mail@eworm.de> | 2014-01-02 14:02:45 +0100 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2014-01-02 14:02:45 +0100 |
commit | 1a7c70f44b496134a2d5e5236d072615ccd918a3 (patch) | |
tree | 47140e2d5f784b35c626b49d8e69deec3397e678 /Makefile | |
parent | c074bd0e43e48af175db000a61c36d148548aa1a (diff) | |
download | cqrlogo-1a7c70f44b496134a2d5e5236d072615ccd918a3.tar.gz cqrlogo-1a7c70f44b496134a2d5e5236d072615ccd918a3.tar.zst |
wirte version to header file
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 17 |
1 files changed, 9 insertions, 8 deletions
@@ -15,18 +15,19 @@ CFLAGS += -liniparser CFLAGS += $(shell pkg-config --cflags --libs libpng) CFLAGS += $(shell pkg-config --cflags --libs zlib) CFLAGS += $(shell pkg-config --cflags --libs libqrencode) -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.3.5 -endif all: cqrlogo README.html cqrlogo.png -cqrlogo: cqrlogo.c config.h - $(CC) $(CFLAGS) $(LDFLAGS) -o cqrlogo cqrlogo.c \ - -DVERSION="\"$(VERSION)\"" +cqrlogo: cqrlogo.c config.h version.h + $(CC) $(CFLAGS) $(LDFLAGS) -o cqrlogo cqrlogo.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" >> $@ config.h: $(CP) config.def.h config.h @@ -142,7 +143,7 @@ check: $(GREP) -e '^This QR Code has been stolen from https://eworm.net/!$$' clean: - $(RM) -f *.o *~ *.png README.html cqrlogo + $(RM) -f *.o *~ *.png README.html cqrlogo version.h distclean: - $(RM) -f *.o *~ *.png README.html cqrlogo config.h + $(RM) -f *.o *~ *.png README.html cqrlogo version.h config.h |