Respect MANPREFIX
[openresolv] / Makefile
1 VERSION = 1.0
2 DESTDIR =
3 PREFIX =
4 MANPREFIX ?= /usr/share
5 ROOT = $(DESTDIR)$(PREFIX)
6 INSTALL = install 
7 ETCDIR = $(ROOT)/etc/resolvconf
8 SHAREDIR = $(ROOT)/usr/share/man
9 MANDIR = $(MANPREFIX)/man8
10 BINDIR = $(ROOT)/sbin
11 VARDIR = $(DESTDIR)/var/run
12 UPDATEDIR = $(ETCDIR)/update.d
13
14 .PHONY: all default clean
15
16 install:
17         $(INSTALL) -d $(ETCDIR)/resolv.conf.d
18         $(INSTALL) -d $(UPDATEDIR)
19         $(INSTALL) -d $(ETCDIR)/update-libc.d
20         $(INSTALL) -d $(MANDIR)
21         $(INSTALL) -d $(BINDIR)
22         $(INSTALL) -d $(VARDIR)/resolvconf
23         $(INSTALL) resolvconf $(BINDIR)
24         $(INSTALL) libc dnsmasq named $(UPDATEDIR)
25         $(INSTALL) -m 644 resolvconf.8 $(MANDIR)
26         if test "$(PREFIX)" "!=" "/" && test -n "$(PREFIX)"; then \
27                 for x in $(BINDIR)/resolvconf $(UPDATEDIR)/libc $(UPDATEDIR)/dnsmasq $(UPDATEDIR)/named; do \
28                 sed -i.bak -e s':^PREFIX=.*:PREFIX="$(PREFIX)":' "$$x"; rm "$$x".bak; \
29                 done; \
30         fi;
31         sed -i.bak -e 's:%%PREFIX%%:$(PREFIX):g' $(MANDIR)/resolvconf.8
32         rm $(MANDIR)/resolvconf.8.bak; \
33         ln -snf /var/run/resolvconf $(ETCDIR)/run
34
35 dist:
36         $(INSTALL) -m 0755 -d /tmp/openresolv-$(VERSION)
37         cp -RPp . /tmp/openresolv-$(VERSION)
38         (cd /tmp/openresolv-$(VERSION); $(MAKE) clean)
39         rm -rf /tmp/openresolv-$(VERSION)/*.bz2 /tmp/openresolv-$(VERSION)/.git
40         tar cvjpf openresolv-$(VERSION).tar.bz2 -C /tmp openresolv-$(VERSION)
41         rm -rf /tmp/openresolv-$(VERSION)
42         ls -l openresolv-$(VERSION).tar.bz2