Commit | Line | Data |
---|---|---|
b4588d5c GP |
1 | #!/usr/bin/make -f |
2 | ||
3 | STRIP =strip | |
4 | ifneq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) | |
5 | STRIP =: nostrip | |
6 | endif | |
7 | ||
8 | DIR =$(shell pwd)/debian/djbdns | |
9 | DIRDBN =$(shell pwd)/debian/dbndns | |
10 | DIRCACHERUN =$(shell pwd)/debian/dnscache-run | |
11 | ||
12 | configure: deb-checkdir configure-stamp | |
13 | configure-stamp: | |
14 | for i in `cat FILES`; do \ | |
15 | test -r dbndns/$$i || cp -p $$i dbndns/$$i || exit 1; \ | |
16 | done | |
17 | touch configure-stamp | |
18 | ||
19 | patch: deb-checkdir patch-stamp dbndns/patch-stamp | |
20 | patch-stamp: configure-stamp | |
21 | for i in `ls -1 debian/diff/*.diff || :`; do \ | |
22 | patch -p1 <$$i || exit 1; \ | |
23 | done | |
24 | touch patch-stamp | |
25 | dbndns/patch-stamp: configure-stamp | |
26 | for i in `ls -1 dbndns/diff/*.diff || :`; do \ | |
27 | (cd dbndns/ && patch -p1) <$$i || exit 1; \ | |
28 | done | |
29 | touch dbndns/patch-stamp | |
30 | ||
31 | build: deb-checkdir build-stamp dbndns/build-stamp | |
32 | build-stamp: patch-stamp | |
33 | test -r conf-home'{orig}' || cp -f conf-home conf-home'{orig}' | |
34 | echo /usr >conf-home | |
35 | test -r conf-cc'{orig}' || cp conf-cc conf-cc'{orig}' | |
36 | echo 'gcc -O2 -g -include /usr/include/errno.h' >conf-cc | |
37 | $(MAKE) | |
38 | touch build-stamp | |
39 | dbndns/build-stamp: dbndns/patch-stamp | |
40 | test -r dbndns/conf-home'{orig}' || \ | |
41 | cp -f dbndns/conf-home dbndns/conf-home'{orig}' | |
42 | echo /usr >dbndns/conf-home | |
43 | test -r dbndns/conf-cc'{orig}' || \ | |
44 | cp dbndns/conf-cc dbndns/conf-cc'{orig}' | |
45 | echo 'gcc -O2 -g -include /usr/include/errno.h' >dbndns/conf-cc | |
46 | $(MAKE) -Cdbndns/ | |
47 | touch dbndns/build-stamp | |
48 | ||
49 | clean: deb-checkdir deb-checkuid | |
50 | rm -f `cat TARGETS` | |
51 | for i in dbndns/*; do test -d $$i || rm -f $$i; done | |
52 | test ! -e patch-stamp || \ | |
53 | for i in `ls -1r debian/diff/*.diff || :`; do patch -p1 -R <$$i; done | |
54 | rm -f configure-stamp patch-stamp build-stamp \ | |
55 | dbndns/patch-stamp dbndns/build-stamp | |
56 | rm -rf '$(DIR)' '$(DIRDBN)' '$(DIRCACHERUN)' | |
57 | rm -f debian/files debian/substvars changelog | |
58 | test ! -r conf-home'{orig}' || mv -f conf-home'{orig}' conf-home | |
59 | test ! -r conf-cc'{orig}' || mv conf-cc'{orig}' conf-cc | |
60 | ||
61 | install: install-arch install-indep | |
62 | install-arch: deb-checkdir deb-checkuid build-stamp dbndns/build-stamp | |
63 | rm -rf '$(DIR)' '$(DIRDBN)' | |
64 | # djbdns programs | |
65 | install -d -m0755 '$(DIR)'/usr | |
66 | test -r conf-home'{orig}' || cp conf-home conf-home'{orig}' | |
67 | echo '$(DIR)'/usr >conf-home | |
68 | rm -f install instcheck install.o instcheck.o hier.o auto_home.o | |
69 | $(MAKE) install instcheck | |
70 | mv -f conf-home'{orig}' conf-home | |
71 | ./install | |
72 | ./instcheck | |
73 | for i in '$(DIR)'/usr/bin/*; do \ | |
74 | test "`head -c2 $$i`" = '#!' || \ | |
75 | $(STRIP) -R .comment -R .note $$i || exit 1; \ | |
76 | done | |
77 | # dbndns programs | |
78 | install -d -m0755 '$(DIRDBN)'/usr | |
79 | test -r dbndns/conf-home'{orig}' || \ | |
80 | cp dbndns/conf-home dbndns/conf-home'{orig}' | |
81 | echo '$(DIRDBN)'/usr >dbndns/conf-home | |
82 | (cd dbndns/ && \ | |
83 | rm -f install instcheck install.o instcheck.o hier.o auto_home.o) | |
84 | $(MAKE) -Cdbndns/ install instcheck | |
85 | mv -f dbndns/conf-home'{orig}' dbndns/conf-home | |
86 | (cd dbndns/ && ./install) | |
87 | (cd dbndns/ && ./instcheck) | |
88 | for i in '$(DIRDBN)'/usr/bin/*; do \ | |
89 | test "`head -c2 $$i`" = '#!' || \ | |
90 | $(STRIP) -R .comment -R .note $$i || exit 1; \ | |
91 | done | |
92 | # etc | |
93 | install -d -m0755 '$(DIR)'/etc | |
94 | install -m0644 debian/dnsroots.global '$(DIR)'/etc/dnsroots.global | |
95 | cp -a '$(DIR)'/etc '$(DIRDBN)'/etc | |
96 | # manpages | |
97 | for i in 1 8; do \ | |
98 | install -d -m0755 '$(DIR)'/usr/share/man/man$$i; \ | |
99 | for j in debian/djbdns-man/*.$$i; do \ | |
100 | install -m0644 $$j '$(DIR)'/usr/share/man/man$$i/ && \ | |
101 | gzip -9 '$(DIR)'/usr/share/man/man$$i/$${j##*/} || exit 1; \ | |
102 | done; \ | |
103 | done | |
104 | install -d -m0755 '$(DIRDBN)'/usr/share | |
105 | cp -a '$(DIR)'/usr/share/man '$(DIRDBN)'/usr/share/man | |
106 | # fix up directory permissions | |
107 | chmod g-s '$(DIR)'/usr '$(DIR)'/usr/bin | |
108 | chmod g-s '$(DIRDBN)'/usr '$(DIRDBN)'/usr/bin | |
109 | # changelog | |
110 | rm -f changelog && ln -s CHANGES changelog | |
111 | install-indep: deb-checkdir deb-checkuid | |
112 | rm -rf '$(DIRCACHERUN)' | |
113 | $(MAKE) -Cdnscache-run install DESTDIR='$(DIRCACHERUN)' | |
114 | ln -s sv/dnscache '$(DIRCACHERUN)'/etc/dnscache | |
115 | install -d -m0755 '$(DIRCACHERUN)'/var/log/dnscache | |
116 | ln -s /var/log/dnscache '$(DIRCACHERUN)'/etc/sv/dnscache/log/main | |
117 | ||
118 | binary: binary-indep binary-arch | |
119 | binary-arch: install-arch djbdns.deb dbndns.deb | |
120 | rm -f debian/substvars | |
121 | dpkg-shlibdeps '$(DIR)'/usr/bin/* | |
122 | dpkg-gencontrol -isp -pdjbdns -P'$(DIR)' | |
123 | dpkg -b '$(DIR)' .. | |
124 | rm -f debian/substvars | |
125 | dpkg-shlibdeps '$(DIRDBN)'/usr/bin/* | |
126 | dpkg-gencontrol -isp -pdbndns -P'$(DIRDBN)' | |
127 | dpkg -b '$(DIRDBN)' .. | |
128 | binary-indep: install-indep dnscache-run.deb | |
129 | dpkg-gencontrol -isp -pdnscache-run -P'$(DIRCACHERUN)' | |
130 | dpkg -b '$(DIRCACHERUN)' .. | |
131 | ||
132 | .PHONY: configure patch dbndns/patch build dbndns/build clean install \ | |
133 | binary-indep binary-arch binary | |
134 | ||
135 | include debian/implicit |