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