Rejig our Makefile to better support NetBSD. We now talk to /var/run/resolvconf direc...
[openresolv] / Makefile
index a106f12336f9de2f66b732be50a9b44e871526fc..27f682a8710c560b5c33a8ff40e1d489fba5fef6 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,51 +1,50 @@
-NAME = openresolv
-VERSION = 1.3
-PKG = $(NAME)-$(VERSION)
+NAME=          openresolv
+VERSION=       1.3
+PKG=           ${NAME}-${VERSION}
 
-INSTALL ?= install
-MANPREFIX ?= /usr/share
+INSTALL?=      install
+MANPREFIX?=    /usr/share
+VARBASE?=      /var
 
-ROOT = $(DESTDIR)$(PREFIX)
-ETCDIR = $(ROOT)/etc/resolvconf
-MANDIR = $(DESTDIR)$(MANPREFIX)/man/man8
-BINDIR = $(ROOT)/sbin
-VARDIR = $(DESTDIR)/var/run
-UPDATEDIR = $(ETCDIR)/update.d
+BINMODE?=      0755
+MANMODE?=      0444
 
-RESOLVCONF = resolvconf resolvconf.8
-SUBSCRIBERS = libc dnsmasq named
-TARGET = $(RESOLVCONF) $(SUBSCRIBERS)
+SYSCONFDIR?=   ${PREFIX}/etc/resolvconf
+BINDIR=                /sbin
+MANDIR?=       ${MANPREFIX}/man
+
+RESOLVCONF=    resolvconf resolvconf.8
+SUBSCRIBERS=   libc dnsmasq named
+TARGET=                ${RESOLVCONF} ${SUBSCRIBERS}
 
 .SUFFIXES: .in
 
-all: $(TARGET)
+all: ${TARGET}
 
 .in:
-       sed -e s':^PREFIX=.*:PREFIX="$(PREFIX)":' $@.in > $@
-
-resolvconf.8: resolvconf.8.in
-       sed -e 's:@PREFIX@:$(PREFIX):g' $@.in > $@
+       sed -e 's:@PREFIX@:${PREFIX}:g' \
+               -e 's:@SYSCONFDIR@:${SYSCONFDIR}:g' \
+               -e 's:@VARBASE@:${VARBASE}:g' \
+               $@.in > $@
 
 clean:
-       rm -f $(TARGET) openresolv-$(VERSION).tar.bz2
-
-install: $(TARGET)
-       $(INSTALL) -d $(BINDIR)
-       $(INSTALL) -d $(VARDIR)/resolvconf
-       $(INSTALL) resolvconf $(BINDIR)
-       $(INSTALL) -d $(MANDIR)
-       $(INSTALL) -d $(ETCDIR)/resolv.conf.d
-       $(INSTALL) -d $(ETCDIR)/update-libc.d
-       $(INSTALL) -d $(UPDATEDIR)
-       $(INSTALL) $(SUBSCRIBERS) $(UPDATEDIR)
-       $(INSTALL) -m 0644 resolvconf.8 $(MANDIR)
-       ln -snf /var/run/resolvconf $(ETCDIR)/run
+       rm -f ${TARGET} openresolv-${VERSION}.tar.bz2
+
+install: ${TARGET}
+       ${INSTALL} -d ${DESTDIR}${PREFIX}${BINDIR}
+       ${INSTALL} -m ${BINMODE} resolvconf ${DESTDIR}${PREFIX}${BINDIR}
+       ${INSTALL} -d ${DESTDIR}${SYSCONFDIR}/resolv.conf.d
+       ${INSTALL} -d ${DESTDIR}${SYSCONFDIR}/update-libc.d
+       ${INSTALL} -d ${DESTDIR}${SYSCONFDIR}/update.d
+       ${INSTALL} -m ${BINMODE} ${SUBSCRIBERS} ${DESTDIR}${SYSCONFDIR}/update.d
+       ${INSTALL} -d ${DESTDIR}${MANDIR}/man8
+       ${INSTALL} -m ${MANMODE} resolvconf.8 ${DESTDIR}${MANDIR}/man8
 
 dist:
-       $(INSTALL) -d /tmp/$(PKG)
-       cp -RPp . /tmp/$(PKG)
-       (cd /tmp/$(PKG); $(MAKE) clean)
-       rm -rf /tmp/$(PKG)/*.bz2 /tmp/$(PKG)/.git /tmp/$(PKG)/.gitignore
-       tar cvjpf $(PKG).tar.bz2 -C /tmp $(PKG) 
-       rm -rf /tmp/$(PKG) 
-       ls -l $(PKG).tar.bz2
+       ${INSTALL} -d /tmp/${PKG}
+       cp -RPp . /tmp/${PKG}
+       (cd /tmp/${PKG}; ${MAKE} clean)
+       rm -rf /tmp/${PKG}/*.bz2 /tmp/${PKG}/.git /tmp/${PKG}/.gitignore
+       tar cvjpf ${PKG}.tar.bz2 -C /tmp ${PKG} 
+       rm -rf /tmp/${PKG} 
+       ls -l ${PKG}.tar.bz2