Clean our tarball too
[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 RESOLVCONF = resolvconf resolvconf.8
14 SUBSCRIBERS = libc dnsmasq named
15 TARGET = $(RESOLVCONF) $(SUBSCRIBERS)
16
17 all: $(TARGET)
18
19 $(SUBSCRIBERS): $*.in
20         sed -e s':^PREFIX=.*:PREFIX="$(PREFIX)":' $*.in > $*
21
22 resolvconf: $*.in
23         sed -e s':^PREFIX=.*:PREFIX="$(PREFIX)":' $*.in > $*
24
25 resolvconf.8:
26         sed -e 's:%%PREFIX%%:$(PREFIX):g' $*.in > $*
27
28 clean:
29         rm -f $(TARGET) openresolv-$(VERSION).tar.bz2
30
31 install: $(TARGET)
32         $(INSTALL) -d $(BINDIR)
33         $(INSTALL) -d $(VARDIR)/resolvconf
34         $(INSTALL) resolvconf $(BINDIR)
35         $(INSTALL) -d $(MANDIR)
36         $(INSTALL) -d $(ETCDIR)/resolv.conf.d
37         $(INSTALL) -d $(ETCDIR)/update-libc.d
38         $(INSTALL) -d $(UPDATEDIR)
39         $(INSTALL) $(SUBSCRIBERS) $(UPDATEDIR)
40         $(INSTALL) -m 644 resolvconf.8 $(MANDIR)
41         ln -snf /var/run/resolvconf $(ETCDIR)/run
42
43 dist:
44         $(INSTALL) -m 0755 -d /tmp/openresolv-$(VERSION)
45         cp -RPp . /tmp/openresolv-$(VERSION)
46         (cd /tmp/openresolv-$(VERSION); $(MAKE) clean)
47         rm -rf /tmp/openresolv-$(VERSION)/*.bz2 /tmp/openresolv-$(VERSION)/.git
48         tar cvjpf openresolv-$(VERSION).tar.bz2 -C /tmp openresolv-$(VERSION)
49         rm -rf /tmp/openresolv-$(VERSION)
50         ls -l openresolv-$(VERSION).tar.bz2