Fix manpage typo
[openresolv] / Makefile
index 0c904299aa49c64774626da2b7d61bb8d9adff7e..32c40af021ed851e46de13161931d5ddd7d73b59 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,42 +1,53 @@
+NAME = openresolv
 VERSION = 1.0
+PKG = $(NAME)-$(VERSION)
+
 DESTDIR =
 PREFIX =
 MANPREFIX ?= /usr/share
 ROOT = $(DESTDIR)$(PREFIX)
-INSTALL = install 
 ETCDIR = $(ROOT)/etc/resolvconf
-SHAREDIR = $(ROOT)/usr/share/man
-MANDIR = $(MANPREFIX)/man8
+MANDIR = $(DESTDIR)$(MANPREFIX)/man/man8
 BINDIR = $(ROOT)/sbin
 VARDIR = $(DESTDIR)/var/run
 UPDATEDIR = $(ETCDIR)/update.d
 
-.PHONY: all default clean
+RESOLVCONF = resolvconf resolvconf.8
+SUBSCRIBERS = libc dnsmasq named
+TARGET = $(RESOLVCONF) $(SUBSCRIBERS)
 
-install:
-       $(INSTALL) -d $(ETCDIR)/resolv.conf.d
-       $(INSTALL) -d $(UPDATEDIR)
-       $(INSTALL) -d $(ETCDIR)/update-libc.d
-       $(INSTALL) -d $(MANDIR)
+INSTALL ?= install
+
+.SUFFIXES: .in
+
+all: $(TARGET)
+
+.in:
+       sed -e s':^PREFIX=.*:PREFIX="$(PREFIX)":' $@.in > $@
+
+resolvconf.8: resolvconf.8.in
+       sed -e 's:%%PREFIX%%:$(PREFIX):g' $@.in > $@
+
+clean:
+       rm -f $(TARGET) openresolv-$(VERSION).tar.bz2
+
+install: $(TARGET)
        $(INSTALL) -d $(BINDIR)
        $(INSTALL) -d $(VARDIR)/resolvconf
        $(INSTALL) resolvconf $(BINDIR)
-       $(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;
-       sed -i.bak -e 's:%%PREFIX%%:$(PREFIX):g' $(MANDIR)/resolvconf.8
-       rm $(MANDIR)/resolvconf.8.bak; \
+       $(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
 
 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
+       $(INSTALL) -d /tmp/$(PKG)
+       cp -RPp . /tmp/$(PKG)
+       (cd /tmp/$(PKG); $(MAKE) clean)
+       rm -rf /tmp/$(PKG)/*.bz2 /tmp/$(PKG)/.git
+       tar cvjpf $(PKG).tar.bz2 -C /tmp $(PKG) 
+       rm -rf /tmp/$(PKG) 
+       ls -l $(PKG).tar.bz2