Don't rely on /etc/init.d being OpenRC
[openresolv] / Makefile
index d0ae99fa272b73f5c5e260ae3b293d5e5ad98ab4..d1a7c58f507e6c11887c892e107a1d2afedb341f 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,6 @@
+VERSION = 1.0
 DESTDIR =
-PREFIX = /
+PREFIX =
 ROOT = $(DESTDIR)$(PREFIX)
 INSTALL = install 
 ETCDIR = $(ROOT)/etc/resolvconf
@@ -9,7 +10,7 @@ BINDIR = $(ROOT)/sbin
 VARDIR = $(DESTDIR)/var/run
 UPDATEDIR = $(ETCDIR)/update.d
 
-default:
+.PHONY: all default clean
 
 install:
        $(INSTALL) -d $(ETCDIR)/resolv.conf.d
@@ -19,11 +20,22 @@ install:
        $(INSTALL) -d $(BINDIR)
        $(INSTALL) -d $(VARDIR)/resolvconf
        $(INSTALL) resolvconf $(BINDIR)
-       $(INSTALL) libc $(UPDATEDIR)
-       if test "$(PREFIX)" "!=" "/"; then \
-               for x in $(BINDIR)/resolvconf $(UPDATEDIR)/libc; do \
+       $(INSTALL) libc dnsmasq named $(UPDATEDIR)
+       $(INSTALL) -m 644 resolvconf.8 $(MANDIR)
+       if test "$(PREFIX)" "!=" "/" && test -n "$(PREFIX)"; then \
+               for x in $(BINDIR)/resolvconf $(UPDATEDIR)/libc $(UPDATEDIR)/dnsmasq $(UPDATEDIR)/named; do \
                sed -i.bak -e s':^PREFIX=.*:PREFIX="$(PREFIX)":' "$$x"; rm "$$x".bak; \
                done; \
-               fi;
-       $(INSTALL) -m 644 resolvconf.8 $(MANDIR)
+       fi;
+       sed -i.bak -e 's:%%PREFIX%%:$(PREFIX):g' $(MANDIR)/resolvconf.8
+       rm $(MANDIR)/resolvconf.8.bak; \
        ln -snf /var/run/resolvconf $(ETCDIR)/run
+
+dist:
+       $(INSTALL) -m 0755 -d /tmp/openresolv-$(VERSION)
+       cp -RPp . /tmp/openresolv-$(VERSION)
+       (cd /tmp/openresolv-$(VERSION); $(MAKE) clean)
+       rm -rf /tmp/openresolv-$(VERSION)/*.bz2 /tmp/openresolv-$(VERSION)/.git
+       tar cvjpf openresolv-$(VERSION).tar.bz2 -C /tmp openresolv-$(VERSION)
+       rm -rf /tmp/openresolv-$(VERSION)
+       ls -l openresolv-$(VERSION).tar.bz2