Makefile: Implement sysconfdir and localstatedir.
authorPhilipp Kern <pkern@debian.org>
Sun, 8 Sep 2013 21:10:55 +0000 (23:10 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 8 Sep 2013 21:14:59 +0000 (23:14 +0200)
It is a bit odd to use $(PREFIX) for some, but not all directories. Make
this a useable middle ground akin autoconf, which allows to pass in
different paths for /var (--localstatedir) and /etc (--sysconfdir).

Makefile

index a0b5f50..eef4a38 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -26,18 +26,26 @@ clean:
        $(RM) cubemap $(OBJS) $(DEPS) state.pb.h state.pb.cc
 
 PREFIX=/usr/local
+SYSCONFDIR=/etc
+LOCALSTATEDIR=/var
 install:
-       $(INSTALL) -m 755 -o root -g root -d $(DESTDIR)$(PREFIX)/bin $(DESTDIR)$(PREFIX)/share/man/man1 $(DESTDIR)/etc $(DESTDIR)/var/lib/cubemap $(DESTDIR)/var/log/cubemap $(DESTDIR)$(PREFIX)/share/munin/plugins
+       $(INSTALL) -m 755 -o root -g root -d \
+               $(DESTDIR)$(PREFIX)/bin \
+               $(DESTDIR)$(PREFIX)/share/man/man1 \
+               $(DESTDIR)$(SYSCONFDIR) \
+               $(DESTDIR)$(LOCALSTATEDIR)/lib/cubemap \
+               $(DESTDIR)$(LOCALSTATEDIR)/log/cubemap \
+               $(DESTDIR)$(PREFIX)/share/munin/plugins
        $(INSTALL) -m 755 -o root -g root cubemap $(DESTDIR)$(PREFIX)/bin/cubemap
        $(INSTALL) -m 755 -o root -g root munin/cubemap munin/cubemap_input $(DESTDIR)$(PREFIX)/share/munin/plugins/
        sed \
-               -e 's,cubemap\.stats,/var/lib/cubemap/\0,g' \
-               -e 's,cubemap-input\.stats,/var/lib/cubemap/\0,g' \
-               -e 's,access\.log,/var/log/cubemap/\0,g' \
-               -e 's,cubemap\.log,/var/log/cubemap/\0,g' \
+               -e "s,cubemap\.stats,$(LOCALSTATEDIR)/lib/cubemap/\0,g" \
+               -e "s,cubemap-input\.stats,$(LOCALSTATEDIR)/lib/cubemap/\0,g" \
+               -e "s,access\.log,$(LOCALSTATEDIR)/log/cubemap/\0,g" \
+               -e "s,cubemap\.log,$(LOCALSTATEDIR)/log/cubemap/\0,g" \
                -e 's,^stream,#\0,g' \
                -e 's,^udpstream,#\0,g' \
-               cubemap.config.sample > $(DESTDIR)/etc/cubemap.config
+               cubemap.config.sample > $(DESTDIR)$(SYSCONFDIR)/cubemap.config
        gzip -c cubemap.1 > $(DESTDIR)$(PREFIX)/share/man/man1/cubemap.1.gz
 
 .PHONY: clean install