Merge from vendor branch NTPD:
[dragonfly.git] / etc / Makefile
1 #       from: @(#)Makefile      5.11 (Berkeley) 5/21/91
2 # $FreeBSD: src/etc/Makefile,v 1.219.2.38 2003/03/04 09:49:00 ru Exp $
3 # $DragonFly: src/etc/Makefile,v 1.33 2004/11/23 06:32:36 dillon Exp $
4
5 .if !defined(NO_SENDMAIL)
6 SUBDIR= sendmail
7 .endif
8
9 # Files that should be installed read-only (444)
10 #
11 BINUPDATE= apmd.conf fbtab gettytab network.subr \
12         pf.os \
13         protocols \
14         rc rc.firewall rc.firewall6 \
15         rc.sendmail rc.shutdown \
16         rc.subr rpc services \
17         etc.${MACHINE_ARCH}/disktab \
18         ${.CURDIR}/../usr.bin/mail/misc/mail.rc \
19         ${.CURDIR}/../usr.bin/locate/locate/locate.rc
20
21 # Initial distribution files are installed read-write (644)
22 #
23 BIN1=   amd.map auth.conf \
24         crontab csh.cshrc csh.login csh.logout \
25         dhclient.conf dm.conf ftpusers group \
26         hosts hosts.allow host.conf hosts.equiv hosts.lpd \
27         inetd.conf login.access login.conf \
28         motd modems networks newsyslog.conf \
29         pam.conf pf.conf phones printcap profile \
30         remote \
31         shells sysctl.conf syslog.conf usbd.conf \
32         etc.${MACHINE_ARCH}/ttys \
33         ${.CURDIR}/../gnu/usr.bin/man/manpath/manpath.config
34
35 .if exists(${.CURDIR}/../crypto) && !defined(NO_OPENSSL)
36 .if !defined(NO_OPENSSH)
37 SSH=    lib/libssh \
38         usr.bin/ssh \
39         usr.sbin/sshd
40 .endif
41 SSL=    ${.CURDIR}/../crypto/openssl-0.9.7d/apps/openssl.cnf
42 .endif
43
44 # Files that should be installed read-only-executable (555) root:wheel
45 #
46 BIN2=   pccard_ether rc.suspend rc.resume
47
48 DEFAULTS= rc.conf make.conf pccard.conf periodic.conf
49
50 MTREE=  BSD.include.dist BSD.local.dist BSD.root.dist BSD.usr.dist \
51         BSD.var.dist BSD.x11.dist BSD.x11-4.dist
52 .if !defined(NO_SENDMAIL)
53 MTREE+= BSD.sendmail.dist
54 .endif
55
56 NAMEDB= PROTO.localhost.rev PROTO.localhost-v6.rev named.conf named.root \
57         make-localhost getroot README
58
59 PPPCNF= ppp.conf
60
61 ETCMAIL=Makefile README mailer.conf access.sample virtusertable.sample \
62         mailertable.sample aliases
63
64 # Special top level files for FreeBSD
65 FREEBSD=COPYRIGHT
66
67 distribute:
68         cd ${.CURDIR} ; ${MAKE} distribution DESTDIR=${DISTDIR}/${DISTRIBUTION}
69
70 preupgrade:
71 .if !defined(NO_SENDMAIL)
72         (pw groupshow smmsp -q > /dev/null) || \
73                 pw groupadd smmsp -g 25
74         (pw usershow smmsp -q > /dev/null) || \
75                 pw useradd smmsp -u 25 -c "Sendmail Submission User" \
76                    -d /var/spool/clientmqueue -s /sbin/nologin
77 .endif
78         (pw usershow _pflogd -q > /dev/null) || \
79                 pw useradd _pflogd -u 64 -c "pflogd privsep user" \
80                    -d /var/empty -s /sbin/nologin
81         (pw usershow _ntp -q > /dev/null) || \
82                 pw useradd _ntp -u 65 -c "ntpd privsep user" \
83                    -d /var/empty -s /sbin/nologin
84         (pw groupshow authpf -q > /dev/null) || \
85                 pw groupadd authpf -g 63
86         (pw groupshow _pflogd -q > /dev/null) || \
87                 pw groupadd _pflogd -g 64
88         (pw groupshow _ntp -q > /dev/null) || \
89                 pw groupadd _ntp -g 65
90
91 upgrade_etc:    preupgrade
92         cd ${.CURDIR}/../share/mk; ${MAKE} install
93         cd ${.CURDIR}; \
94             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
95                 ${BINUPDATE} ${DESTDIR}/etc; \
96             cap_mkdb ${DESTDIR}/etc/login.conf; \
97             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 555 \
98                 ${BIN2} ${DESTDIR}/etc;
99         cd ${.CURDIR}/defaults; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
100             ${DEFAULTS} ${DESTDIR}/etc/defaults
101         cd ${.CURDIR}/periodic; ${MAKE} install
102         cd ${.CURDIR}/rc.d; ${MAKE} install 
103         cd ${.CURDIR}/../share/termcap; ${MAKE} etc-termcap
104         cd ${.CURDIR}/../usr.sbin/rmt; ${MAKE} etc-rmt
105 .if !defined(NO_I4B)
106         cd ${.CURDIR}/isdn; ${MAKE} install
107 .endif
108 .if !defined(NO_MAKEDEV)
109         cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 555 \
110             MAKEDEV.local MAKEDEV ${DESTDIR}/dev
111 .if !defined(NO_MAKEDEV_RUN)
112         cd ${DESTDIR}/dev; sh MAKEDEV all
113 .endif
114 .endif
115         cd ${.CURDIR}/mtree; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
116             ${MTREE} ${DESTDIR}/etc/mtree
117         cd ${.CURDIR}/..; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
118             ${FREEBSD} ${DESTDIR}/
119 .if !defined(NOMAN)
120         cd ${.CURDIR}/../share/man; ${MAKE} makedb
121 .endif
122         rm -f ${DESTDIR}/usr/include/machine/ioctl_meteor.h
123         rm -f ${DESTDIR}/usr/include/machine/ioctl_bt848.h
124         ln -s "../dev/video/bktr/ioctl_bt848.h" ${DESTDIR}/usr/include/machine/ioctl_bt848.h
125         ln -s "../dev/video/meteor/ioctl_meteor.h" ${DESTDIR}/usr/include/machine/ioctl_meteor.h
126 .if exists(${DESTDIR}/usr/sbin/named-checkzone)
127         rm -f ${DESTDIR}/usr/libexec/named-xfer
128         rm -f ${DESTDIR}/usr/bin/dnsquery
129         rm -f ${DESTDIR}/usr/bin/dnskeygen
130         rm -f ${DESTDIR}/usr/sbin/ndc
131 .endif
132 .if exists(${DESTDIR}/usr/lib/crtbegin.o)
133         csh -c "rm -f ${DESTDIR}/usr/lib/gcc2/{crtbegin.o,crtbeginS.o,crtend.o,crtendS.o}"
134         csh -c "rm -f ${DESTDIR}/usr/lib/gcc3/{crtbegin.o,crtbeginS.o,crtend.o,crtendS.o}"
135 .endif
136 .if exists(${DESTDIR}/usr/include/netproto/802_11/if_wavelan_ieee.h)
137         rm -f ${DESTDIR}/usr/include/dev/netif/wi/if_wavelan_ieee.h
138         rm -f ${DESTDIR}/usr/include/net/if_ieee80211.h
139 .endif
140 .if exists(${DESTDIR}/usr/libexec/binutils212/elf/as)
141         ldconfig -m ${DESTDIR}/usr/lib/gcc2
142         rm -rf ${DESTDIR}/usr/lib/gcc3
143         rm -rf ${DESTDIR}/usr/libexec/gcc3
144         rm -rf ${DESTDIR}/usr/libdata/ldscripts
145         rm -rf ${DESTDIR}/usr/libdata/gcc2
146         rm -rf ${DESTDIR}/usr/libdata/gcc3
147         rm -rf ${DESTDIR}/usr/libexec/elf
148         rm -rf ${DESTDIR}/usr/libexec/aout
149         rm -rf ${DESTDIR}/usr/bin/gcc2
150         rm -rf ${DESTDIR}/usr/bin/gcc3
151         rm -rf ${DESTDIR}/usr/include/g++
152         csh -c "rm -f ${DESTDIR}/usr/bin/{genassym,gensetdefs,nawk,ptx,send-pr}"
153         csh -c "rm -f ${DESTDIR}/usr/share/man/{man8,cat8}/{genassym,gensetdefs}.8.gz"
154         csh -c "rm -f ${DESTDIR}/usr/share/man/{man1,cat1}/{gawk,nawk,send-pr}.1.gz"
155         csh -c "rm -f ${DESTDIR}/usr/libexec/{cc1,cc1obj,cc1plus}"
156         csh -c "rm -f ${DESTDIR}/usr/libexec/{cpp,cpp0,f771,objformat}"
157         csh -c "rm -f ${DESTDIR}/usr/libexec/binutils212/{cc1,cc1obj,cc1plus}"
158         csh -c "rm -f ${DESTDIR}/usr/libexec/binutils212/{cpp,cpp0,f771,objformat}"
159         csh -c "rm -f ${DESTDIR}/usr/libexec/binutils214/{cc1,cc1obj,cc1plus}"
160         csh -c "rm -f ${DESTDIR}/usr/libexec/binutils214/{cpp,cpp0,f771,objformat}"
161         csh -c "rm -f ${DESTDIR}/usr/lib/{libgcc.a,libgcc_p.a}"
162         csh -c "rm -f ${DESTDIR}/usr/lib/{libobjc.a,libobjc_p.a,libstdc++.a}"
163         csh -c "rm -f ${DESTDIR}/usr/lib/{libstdc++.so,libstdc++.so.3}"
164         csh -c "rm -f ${DESTDIR}/usr/lib/{libstdc++_p.a}"
165         csh -c "rm -f ${DESTDIR}/usr/bin/CC"
166         rm -f ${DESTDIR}/usr/bin/makewhatis
167         rm -f ${DESTDIR}/usr/sbin/prebind
168         rm -f ${DESTDIR}/modules/checkpt.ko
169         ldconfig -R
170 .endif
171 .if exists(${DESTDIR}/usr/share/examples/bc)
172         rm -rf ${DESTDIR}/usr/share/examples/bc
173 .endif
174 .if exists(${DESTDIR}/usr/share/info/dc.info.gz)
175         gzip -d ${DESTDIR}/usr/share/info/dc.info.gz
176         install-info --delete ${DESTDIR}/usr/share/info/dc.info ${DESTDIR}/usr/share/info/dir
177         rm -f ${DESTDIR}/usr/share/info/dc.info ${DESTDIR}/usr/share/info/dc.info.gz
178 .endif
179
180 distribution:
181         cd ${.CURDIR}; \
182             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
183                 ${BINUPDATE} ${DESTDIR}/etc; \
184             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
185                 ${BIN1} ${DESTDIR}/etc; \
186             cap_mkdb ${DESTDIR}/etc/login.conf; \
187             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 555 \
188                 ${BIN2} ${DESTDIR}/etc; \
189             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 \
190                 master.passwd nsmb.conf opieaccess ${DESTDIR}/etc; \
191             pwd_mkdb -p -d ${DESTDIR}/etc ${DESTDIR}/etc/master.passwd
192         cd ${.CURDIR}/defaults; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
193             ${DEFAULTS} ${DESTDIR}/etc/defaults
194         cd ${.CURDIR}/periodic; ${MAKE} install
195         cd ${.CURDIR}/rc.d; ${MAKE} install 
196         cd ${.CURDIR}/../share/termcap; ${MAKE} etc-termcap
197         cd ${.CURDIR}/../usr.sbin/rmt; ${MAKE} etc-rmt
198 .if !defined(NO_I4B)
199         cd ${.CURDIR}/isdn; ${MAKE} install
200 .endif
201 .if !defined(NO_SENDMAIL)
202         cd ${.CURDIR}/sendmail; ${MAKE} obj
203         cd ${.CURDIR}/sendmail; ${MAKE} distribution
204 .endif
205 .if exists(${.CURDIR}/../crypto) && !defined(NO_OPENSSL)
206 .if !defined(NO_OPENSSH)
207 .for _f in ${SSH}
208         cd ${.CURDIR}/../secure/${_f} && ${MAKE} obj
209         cd ${.CURDIR}/../secure/${_f} && ${MAKE} etc-ssh
210 .endfor
211 .endif
212         cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
213             ${SSL} ${DESTDIR}/etc/ssl
214 .endif
215 .if !defined(NO_MAKEDEV)
216         cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 555 \
217             MAKEDEV.local MAKEDEV ${DESTDIR}/dev
218 .if !defined(NO_MAKEDEV_RUN)
219         cd ${DESTDIR}/dev; sh MAKEDEV all
220 .endif
221 .endif
222         cd ${.CURDIR}/root; \
223             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
224                 dot.cshrc ${DESTDIR}/root/.cshrc; \
225             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
226                 dot.klogin ${DESTDIR}/root/.klogin; \
227             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
228                 dot.login ${DESTDIR}/root/.login; \
229             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
230                 dot.profile ${DESTDIR}/root/.profile; \
231             rm -f ${DESTDIR}/.cshrc ${DESTDIR}/.profile; \
232             ln ${DESTDIR}/root/.cshrc ${DESTDIR}/.cshrc; \
233             ln ${DESTDIR}/root/.profile ${DESTDIR}/.profile
234         cd ${.CURDIR}/mtree; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
235             ${MTREE} ${DESTDIR}/etc/mtree
236         cd ${.CURDIR}/namedb; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
237             ${NAMEDB} ${DESTDIR}/etc/namedb
238         cd ${.CURDIR}/ppp; ${INSTALL} -o root -g ${BINGRP} -m 600 \
239             ${PPPCNF} ${DESTDIR}/etc/ppp
240         cd ${.CURDIR}/mail; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
241             ${ETCMAIL} ${DESTDIR}/etc/mail
242         @if [ -d ${DESTDIR}/etc/mail -a -f ${DESTDIR}/etc/mail/aliases -a \
243               ! -f ${DESTDIR}/etc/aliases ]; then \
244                 set -x; \
245                 ln -s mail/aliases ${DESTDIR}/etc/aliases; \
246         fi
247         ${INSTALL} -o ${BINOWN} -g operator -m 664 /dev/null \
248             ${DESTDIR}/etc/dumpdates
249         ${INSTALL} -o nobody -g ${BINGRP} -m 644 /dev/null \
250             ${DESTDIR}/var/db/locate.database
251         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
252             ${DESTDIR}/var/log/auth.log
253         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
254             ${DESTDIR}/var/log/cron
255         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
256             ${DESTDIR}/var/log/lpd-errs
257         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 640 /dev/null \
258             ${DESTDIR}/var/log/maillog
259         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
260             ${DESTDIR}/var/log/lastlog
261         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
262             ${DESTDIR}/var/log/messages
263         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
264             ${DESTDIR}/var/log/security
265         ${INSTALL} -o ${BINOWN} -g network -m 640 /dev/null \
266             ${DESTDIR}/var/log/slip.log
267         ${INSTALL} -o ${BINOWN} -g network -m 640 /dev/null \
268             ${DESTDIR}/var/log/ppp.log
269         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
270             ${DESTDIR}/var/log/wtmp
271         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
272             ${DESTDIR}/var/run/utmp
273         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 ${.CURDIR}/minfree \
274             ${DESTDIR}/var/crash
275         cd ${.CURDIR}/..; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
276             ${FREEBSD} ${DESTDIR}/
277 .if !defined(NOMAN)
278         cd ${.CURDIR}/../share/man; ${MAKE} makedb
279 .endif
280
281 distrib-dirs:
282         -set - `grep "^[a-zA-Z]" ${.CURDIR}/locale.deprecated`; \
283         while [ $$# -gt 0 ] ; \
284         do \
285                 for dir in /usr/share/locale \
286                            /usr/share/nls \
287                            /usr/local/share/nls; \
288                 do \
289                         test -d ${DESTDIR}/$${dir} && cd ${DESTDIR}/$${dir}; \
290                         test -L "$$2" && rm -rf "$$2"; \
291                         test \! -L "$$1" && test -d "$$1" && mv "$$1" "$$2"; \
292                 done; \
293                 shift; shift; \
294         done
295         mtree -deU -f ${.CURDIR}/mtree/BSD.root.dist -p ${DESTDIR}/
296         mtree -deU -f ${.CURDIR}/mtree/BSD.var.dist -p ${DESTDIR}/var
297         mtree -deU -f ${.CURDIR}/mtree/BSD.usr.dist -p ${DESTDIR}/usr
298         mtree -deU -f ${.CURDIR}/mtree/BSD.include.dist \
299                 -p ${DESTDIR}/usr/include
300         mtree -deU -f ${.CURDIR}/mtree/BSD.include.dist \
301                 -p ${DESTDIR}/usr/libdata/perl/5.00503/mach
302 .if !defined(NO_SENDMAIL)
303         mtree -deU -f ${.CURDIR}/mtree/BSD.sendmail.dist -p ${DESTDIR}/
304 .endif
305         cd ${DESTDIR}/etc/namedb; rm -f etc/namedb; ln -s ".." etc/namedb
306         cd ${DESTDIR}/; rm -f ${DESTDIR}/sys; ln -s usr/src/sys sys
307         cd ${DESTDIR}/usr/share/man/en.ISO8859-1; ln -sf ../man* .
308         cd ${DESTDIR}/usr/share/man; \
309         set - `grep "^[a-zA-Z]" ${.CURDIR}/man.alias`; \
310         while [ $$# -gt 0 ] ; \
311         do \
312                 rm -rf "$$1"; \
313                 ln -s "$$2" "$$1"; \
314                 shift; shift; \
315         done
316         cd ${DESTDIR}/usr/share/locale; \
317         set - `grep "^[a-zA-Z]" ${.CURDIR}/locale.alias`; \
318         while [ $$# -gt 0 ] ; \
319         do \
320                 rm -rf "$$1"; \
321                 ln -s "$$2" "$$1"; \
322                 shift; shift; \
323         done
324         cd ${DESTDIR}/usr/share/openssl/man/en.ISO8859-1; ln -sf ../man* .
325         cd ${DESTDIR}/usr/share/nls; \
326         set - `grep "^[a-zA-Z]" ${.CURDIR}/nls.alias`; \
327         while [ $$# -gt 0 ] ; \
328         do \
329                 rm -rf "$$1"; \
330                 ln -s "$$2" "$$1"; \
331                 shift; shift; \
332         done
333
334 etc-examples:
335         cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
336             ${BINUPDATE} ${BIN1} ${BIN2} nsmb.conf opieaccess \
337             ${DESTDIR}/usr/share/examples/etc
338         cd ${.CURDIR}/defaults; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
339             ${DEFAULTS} ${DESTDIR}/usr/share/examples/etc/defaults
340
341 .include <bsd.prog.mk>