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