Don't hardcode as much
[openresolv] / Makefile
1 NAME = openresolv 
2 VERSION = 1.0
3 PKG = $(NAME)-$(VERSION)
4
5 DESTDIR =
6 PREFIX =
7 MANPREFIX ?= /usr/share
8 ROOT = $(DESTDIR)$(PREFIX)
9 INSTALL = install
10 ETCDIR = $(ROOT)/etc/resolvconf
11 MANDIR = $(MANPREFIX)/man/man8
12 BINDIR = $(ROOT)/sbin
13 VARDIR = $(DESTDIR)/var/run
14 UPDATEDIR = $(ETCDIR)/update.d
15
16 RESOLVCONF = resolvconf resolvconf.8
17 SUBSCRIBERS = libc dnsmasq named
18 TARGET = $(RESOLVCONF) $(SUBSCRIBERS)
19
20 .SUFFIXES: .in
21
22 all: $(TARGET)
23
24 .in:
25         sed -e s':^PREFIX=.*:PREFIX="$(PREFIX)":' $@.in > $@
26
27 resolvconf.8: resolvconf.8.in
28         sed -e 's:%%PREFIX%%:$(PREFIX):g' $@.in > $@
29
30 clean:
31         rm -f $(TARGET) openresolv-$(VERSION).tar.bz2
32
33 install: $(TARGET)
34         $(INSTALL) -d $(BINDIR)
35         $(INSTALL) -d $(VARDIR)/resolvconf
36         $(INSTALL) resolvconf $(BINDIR)
37         $(INSTALL) -d $(MANDIR)
38         $(INSTALL) -d $(ETCDIR)/resolv.conf.d
39         $(INSTALL) -d $(ETCDIR)/update-libc.d
40         $(INSTALL) -d $(UPDATEDIR)
41         $(INSTALL) $(SUBSCRIBERS) $(UPDATEDIR)
42         $(INSTALL) -m 0644 resolvconf.8 $(MANDIR)
43         ln -snf /var/run/resolvconf $(ETCDIR)/run
44
45 dist:
46         $(INSTALL) -d /tmp/$(PKG)
47         cp -RPp . /tmp/$(PKG)
48         (cd /tmp/$(PKG); $(MAKE) clean)
49         rm -rf /tmp/$(PKG)/*.bz2 /tmp/$(PKG)/.git
50         tar cvjpf $(PKG).tar.bz2 -C /tmp $(PKG) 
51         rm -rf /tmp/$(PKG) 
52         ls -l $(PKG).tar.bz2