aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile18
1 files changed, 14 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index 879ff37..d7c7e4b 100644
--- a/Makefile
+++ b/Makefile
@@ -27,7 +27,7 @@ ID := $(shell shopt -u extglob && source /etc/os-release && echo $$ID)
# this is just a fallback in case you do not use git but downloaded
# a release tarball...
-VERSION := 0.6.0
+VERSION := 0.7.2
SERVICESIN = $(wildcard */*.service.in)
SERVICES = $(SERVICESIN:.in=)
@@ -36,14 +36,24 @@ HTML = $(MARKDOWN:.md=.html)
all: pacredir $(SERVICES) $(HTML)
-pacredir: pacredir.c pacredir.h config.h version.h
+pacredir: pacredir.c pacredir.h config.h favicon.h html.h version.h
$(CC) $< $(CFLAGS) $(CFLAGS_EXTRA) $(LDFLAGS) -DREPRODUCIBLE=$(REPRODUCIBLE) -o $@
config.h: config.def.h
$(CP) $< $@
version.h: $(wildcard .git/HEAD .git/index .git/refs/tags/*) Makefile
- printf "#ifndef VERSION\n#define VERSION \"%s\"\n#endif\n#define ARCH \"%s\"\n#define ID \"%s\"\n" $(shell git describe --long 2>/dev/null || echo ${VERSION}) $(ARCH) $(ID) > $@
+ printf '#ifndef VERSION_H\n#define VERSION_H\n#define VERSION\t"%s"\n#define ARCH\t"%s"\n#define ID\t"%s"\n#endif\n' $(shell git describe --long 2>/dev/null || echo ${VERSION}) $(ARCH) $(ID) > $@
+
+favicon.png: logo.svg Makefile
+ rsvg-convert --width 32 --height 32 $< > $@
+ oxipng $@
+
+favicon.h: favicon.png Makefile
+ printf '#ifndef FAVICON_H\n#define FAVICON_H\n' > $@
+ printf 'static unsigned char favicon[] = {\n' >> $@
+ od -t x1 -A n -v < $< | sed 's/\([0-9a-f]\{2\}\)/0x\1,/g' >> $@
+ printf '};\n#define FAVICON_SHA1 "%s"\n#endif\n' $(shell sha1sum $< | cut -d' ' -f1) >> $@
%.service: %.service.in
$(SED) 's/%ARCH%/$(ARCH)/; s/%ARCH_BYTES%/$(shell (printf $(ARCH) | wc -c; printf $(ARCH) | od -t d1 -A n) | tr -s " ")/; s/%ID%/$(ID)/; s/%ID_BYTES%/$(shell (printf $(ID) | wc -c; printf $(ID) | od -t d1 -A n) | tr -s " ")/' $< > $@
@@ -79,7 +89,7 @@ install-avahi: compat/pacserve-announce.service
$(INSTALL) -D -m0644 compat/02-pacredir-avahi-MulticastDNS-resolve.conf $(DESTDIR)/etc/systemd/resolved.conf.d/02-pacredir-avahi-MulticastDNS-resolve.conf
clean:
- $(RM) -f *.o *~ pacredir $(SERVICES) $(HTML) version.h
+ $(RM) -f *.o *~ pacredir $(SERVICES) $(HTML) favicon.png favicon.h version.h
distclean:
$(RM) -f *.o *~ pacredir $(SERVICES) $(HTML) version.h config.h