d5e0b1420c6170225d684593e9e4f74640395356
[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.15 2004/02/16 05:14:03 dillon Exp $
4
5 .if !defined(NO_SENDMAIL)
6 SUBDIR= sendmail
7 .endif
8
9 BINUPDATE= apmd.conf fbtab gettytab network.subr \
10         protocols \
11         rc rc.firewall rc.firewall6 \
12         rc.sendmail rc.shutdown \
13         rc.subr rpc services \
14         etc.${MACHINE_ARCH}/disktab \
15         ${.CURDIR}/../usr.bin/mail/misc/mail.rc \
16         ${.CURDIR}/../usr.bin/locate/locate/locate.rc
17
18 BIN1=   ${BINUPDATE} \
19         amd.map auth.conf \
20         crontab csh.cshrc csh.login csh.logout \
21         dhclient.conf dm.conf ftpusers group \
22         hosts hosts.allow host.conf hosts.equiv hosts.lpd \
23         inetd.conf login.access login.conf \
24         motd modems networks newsyslog.conf \
25         pam.conf phones printcap profile \
26         remote \
27         shells sysctl.conf syslog.conf usbd.conf \
28         etc.${MACHINE_ARCH}/ttys \
29         ${.CURDIR}/../gnu/usr.bin/man/manpath/manpath.config
30
31 .if exists(${.CURDIR}/../crypto) && !defined(NO_OPENSSL)
32 .if !defined(NO_OPENSSH)
33 SSH=    ${.CURDIR}/../crypto/openssh/ssh_config \
34         ${.CURDIR}/../crypto/openssh/sshd_config \
35         moduli
36 .endif
37 SSL=    ${.CURDIR}/../crypto/openssl/apps/openssl.cnf
38 .endif
39
40 # -rwxr-xr-x root:wheel, for the new cron root:wheel
41 BIN2=   pccard_ether rc.suspend rc.resume
42
43 DEFAULTS= rc.conf make.conf pccard.conf periodic.conf
44
45 MTREE=  BSD.include.dist BSD.local.dist BSD.root.dist BSD.usr.dist \
46         BSD.var.dist BSD.x11.dist BSD.x11-4.dist
47 .if !defined(NO_SENDMAIL)
48 MTREE+= BSD.sendmail.dist
49 .endif
50
51 NAMEDB= PROTO.localhost.rev PROTO.localhost-v6.rev named.conf named.root \
52         make-localhost
53
54 PPPCNF= ppp.conf
55
56 ETCMAIL=Makefile README mailer.conf access.sample virtusertable.sample \
57         mailertable.sample aliases
58
59 # Special top level files for FreeBSD
60 FREEBSD=COPYRIGHT
61
62 distribute:
63         cd ${.CURDIR} ; ${MAKE} distribution DESTDIR=${DISTDIR}/${DISTRIBUTION}
64 .if defined(OBJFORMAT)
65         echo OBJFORMAT=${OBJFORMAT} > ${DISTDIR}/${DISTRIBUTION}/etc/objformat
66 .endif
67
68 upgrade_etc:
69         cd ${.CURDIR}/../share/mk; ${MAKE} install
70         cd ${.CURDIR}; \
71             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
72                 ${BINUPDATE} ${DESTDIR}/etc; \
73             cap_mkdb ${DESTDIR}/etc/login.conf; \
74             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 755 \
75                 ${BIN2} ${DESTDIR}/etc;
76         cd ${.CURDIR}/defaults; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
77             ${DEFAULTS} ${DESTDIR}/etc/defaults
78         cd ${.CURDIR}/periodic; ${MAKE} install
79         cd ${.CURDIR}/rc.d; ${MAKE} install 
80         cd ${.CURDIR}/../share/termcap; ${MAKE} etc-termcap
81         cd ${.CURDIR}/../usr.sbin/rmt; ${MAKE} etc-rmt
82 .if !defined(NO_I4B)
83         cd ${.CURDIR}/isdn; ${MAKE} install
84 .endif
85 .if !defined(NO_MAKEDEV)
86         cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 555 \
87             MAKEDEV.local MAKEDEV ${DESTDIR}/dev
88 .if !defined(NO_MAKEDEV_RUN)
89         cd ${DESTDIR}/dev; sh MAKEDEV all
90 .endif
91 .endif
92         cd ${.CURDIR}/mtree; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
93             ${MTREE} ${DESTDIR}/etc/mtree
94         cd ${.CURDIR}/..; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
95             ${FREEBSD} ${DESTDIR}/
96 .if !defined(NOMAN)
97         cd ${.CURDIR}/../share/man; ${MAKE} makedb
98 .endif
99 .if exists(${DESTDIR}/usr/libexec/binutils212/elf/as)
100         ldconfig -m ${DESTDIR}/usr/lib/gcc2
101         rm -rf ${DESTDIR}/usr/libdata/ldscripts
102         rm -rf ${DESTDIR}/usr/libdata/gcc2
103         rm -rf ${DESTDIR}/usr/libdata/gcc3
104         rm -rf ${DESTDIR}/usr/libexec/elf
105         rm -rf ${DESTDIR}/usr/libexec/aout
106         rm -rf ${DESTDIR}/usr/bin/gcc2
107         rm -rf ${DESTDIR}/usr/bin/gcc3
108         csh -c "rm -f ${DESTDIR}/usr/bin/{genassym,gensetdefs}"
109         csh -c "rm -f ${DESTDIR}/usr/share/man/{man8,cat8}/{genassym,gensetdefs}.8.gz"
110         csh -c "rm -f ${DESTDIR}/usr/libexec/{cc1,cc1obj,cc1plus}"
111         csh -c "rm -f ${DESTDIR}/usr/libexec/{cpp,cpp0,f771,objformat}"
112         csh -c "rm -f ${DESTDIR}/usr/libexec/binutils212/{cc1,cc1obj,cc1plus}"
113         csh -c "rm -f ${DESTDIR}/usr/libexec/binutils212/{cpp,cpp0,f771,objformat}"
114         csh -c "rm -f ${DESTDIR}/usr/libexec/binutils214/{cc1,cc1obj,cc1plus}"
115         csh -c "rm -f ${DESTDIR}/usr/libexec/binutils214/{cpp,cpp0,f771,objformat}"
116         csh -c "rm -f ${DESTDIR}/usr/lib/{crtbegin.o,crtbeginS.o,crtend.o}"
117         csh -c "rm -f ${DESTDIR}/usr/lib/{crtendS.o,libgcc.a,libgcc_p.a}"
118         csh -c "rm -f ${DESTDIR}/usr/lib/{libobjc.a,libobjc_p.a,libstdc++.a}"
119         csh -c "rm -f ${DESTDIR}/usr/lib/{libstdc++.so,libstdc++.so.3}"
120         csh -c "rm -f ${DESTDIR}/usr/lib/{libstdc++_p.a}"
121         csh -c "rm -f ${DESTDIR}/usr/bin/CC"
122         ldconfig -R
123 .endif
124
125 distribution:
126         cd ${.CURDIR}; \
127             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
128                 ${BIN1} ${DESTDIR}/etc; \
129             cap_mkdb ${DESTDIR}/etc/login.conf; \
130             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 755 \
131                 ${BIN2} ${DESTDIR}/etc; \
132             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 \
133                 master.passwd nsmb.conf opieaccess ${DESTDIR}/etc; \
134             pwd_mkdb -p -d ${DESTDIR}/etc ${DESTDIR}/etc/master.passwd
135         cd ${.CURDIR}/defaults; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
136             ${DEFAULTS} ${DESTDIR}/etc/defaults
137         cd ${.CURDIR}/periodic; ${MAKE} install
138         cd ${.CURDIR}/rc.d; ${MAKE} install 
139         cd ${.CURDIR}/../share/termcap; ${MAKE} etc-termcap
140         cd ${.CURDIR}/../usr.sbin/rmt; ${MAKE} etc-rmt
141 .if !defined(NO_I4B)
142         cd ${.CURDIR}/isdn; ${MAKE} install
143 .endif
144 .if !defined(NO_SENDMAIL)
145         cd ${.CURDIR}/sendmail; ${MAKE} distribution
146 .endif
147 .if exists(${.CURDIR}/../crypto) && !defined(NO_OPENSSL)
148 .if !defined(NO_OPENSSH)
149         cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
150             ${SSH} ${DESTDIR}/etc/ssh
151 .endif
152         cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
153             ${SSL} ${DESTDIR}/etc/ssl
154 .endif
155 .if !defined(NO_MAKEDEV)
156         cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 555 \
157             MAKEDEV.local MAKEDEV ${DESTDIR}/dev
158 .if !defined(NO_MAKEDEV_RUN)
159         cd ${DESTDIR}/dev; sh MAKEDEV all
160 .endif
161 .endif
162         cd ${.CURDIR}/root; \
163             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
164                 dot.cshrc ${DESTDIR}/root/.cshrc; \
165             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
166                 dot.klogin ${DESTDIR}/root/.klogin; \
167             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
168                 dot.login ${DESTDIR}/root/.login; \
169             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
170                 dot.profile ${DESTDIR}/root/.profile; \
171             rm -f ${DESTDIR}/.cshrc ${DESTDIR}/.profile; \
172             ln ${DESTDIR}/root/.cshrc ${DESTDIR}/.cshrc; \
173             ln ${DESTDIR}/root/.profile ${DESTDIR}/.profile
174         cd ${.CURDIR}/mtree; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
175             ${MTREE} ${DESTDIR}/etc/mtree
176         cd ${.CURDIR}/namedb; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
177             ${NAMEDB} ${DESTDIR}/etc/namedb
178         cd ${.CURDIR}/ppp; ${INSTALL} -o root -g ${BINGRP} -m 600 \
179             ${PPPCNF} ${DESTDIR}/etc/ppp
180         cd ${.CURDIR}/mail; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
181             ${ETCMAIL} ${DESTDIR}/etc/mail
182         @if [ -d ${DESTDIR}/etc/mail -a -f ${DESTDIR}/etc/mail/aliases -a \
183               ! -f ${DESTDIR}/etc/aliases ]; then \
184                 set -x; \
185                 ln -s mail/aliases ${DESTDIR}/etc/aliases; \
186         fi
187         ${INSTALL} -o ${BINOWN} -g operator -m 664 /dev/null \
188             ${DESTDIR}/etc/dumpdates
189         ${INSTALL} -o nobody -g ${BINGRP} -m 644 /dev/null \
190             ${DESTDIR}/var/db/locate.database
191         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
192             ${DESTDIR}/var/log/auth.log
193         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
194             ${DESTDIR}/var/log/cron
195         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
196             ${DESTDIR}/var/log/lpd-errs
197         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 640 /dev/null \
198             ${DESTDIR}/var/log/maillog
199         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
200             ${DESTDIR}/var/log/lastlog
201         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
202             ${DESTDIR}/var/log/messages
203         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
204             ${DESTDIR}/var/log/security
205         ${INSTALL} -o ${BINOWN} -g network -m 640 /dev/null \
206             ${DESTDIR}/var/log/slip.log
207         ${INSTALL} -o ${BINOWN} -g network -m 640 /dev/null \
208             ${DESTDIR}/var/log/ppp.log
209         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
210             ${DESTDIR}/var/log/wtmp
211         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
212             ${DESTDIR}/var/run/utmp
213         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 ${.CURDIR}/minfree \
214             ${DESTDIR}/var/crash
215         cd ${.CURDIR}/..; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
216             ${FREEBSD} ${DESTDIR}/
217 .if !defined(NOMAN)
218         cd ${.CURDIR}/../share/man; ${MAKE} makedb
219 .endif
220
221 distrib-dirs:
222         -set - `grep "^[a-zA-Z]" ${.CURDIR}/locale.deprecated`; \
223         while [ $$# -gt 0 ] ; \
224         do \
225                 for dir in /usr/share/locale \
226                            /usr/share/nls \
227                            /usr/local/share/nls; \
228                 do \
229                         test -d ${DESTDIR}/$${dir} && cd ${DESTDIR}/$${dir}; \
230                         test -L "$$2" && rm -rf "$$2"; \
231                         test \! -L "$$1" && test -d "$$1" && mv "$$1" "$$2"; \
232                 done; \
233                 shift; shift; \
234         done
235         mtree -deU -f ${.CURDIR}/mtree/BSD.root.dist -p ${DESTDIR}/
236         mtree -deU -f ${.CURDIR}/mtree/BSD.var.dist -p ${DESTDIR}/var
237         mtree -deU -f ${.CURDIR}/mtree/BSD.usr.dist -p ${DESTDIR}/usr
238         mtree -deU -f ${.CURDIR}/mtree/BSD.include.dist \
239                 -p ${DESTDIR}/usr/include
240         mtree -deU -f ${.CURDIR}/mtree/BSD.include.dist \
241                 -p ${DESTDIR}/usr/libdata/perl/5.00503/mach
242 .if !defined(NO_SENDMAIL)
243         mtree -deU -f ${.CURDIR}/mtree/BSD.sendmail.dist -p ${DESTDIR}/
244 .endif
245         cd ${DESTDIR}/; rm -f ${DESTDIR}/sys; ln -s usr/src/sys sys
246         cd ${DESTDIR}/usr/share/man/en.ISO8859-1; ln -sf ../man* .
247         cd ${DESTDIR}/usr/share/man; \
248         set - `grep "^[a-zA-Z]" ${.CURDIR}/man.alias`; \
249         while [ $$# -gt 0 ] ; \
250         do \
251                 rm -rf "$$1"; \
252                 ln -s "$$2" "$$1"; \
253                 shift; shift; \
254         done
255         cd ${DESTDIR}/usr/share/locale; \
256         set - `grep "^[a-zA-Z]" ${.CURDIR}/locale.alias`; \
257         while [ $$# -gt 0 ] ; \
258         do \
259                 rm -rf "$$1"; \
260                 ln -s "$$2" "$$1"; \
261                 shift; shift; \
262         done
263         cd ${DESTDIR}/usr/share/openssl/man/en.ISO8859-1; ln -sf ../man* .
264         cd ${DESTDIR}/usr/share/nls; \
265         set - `grep "^[a-zA-Z]" ${.CURDIR}/nls.alias`; \
266         while [ $$# -gt 0 ] ; \
267         do \
268                 rm -rf "$$1"; \
269                 ln -s "$$2" "$$1"; \
270                 shift; shift; \
271         done
272
273 etc-examples:
274         cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
275             ${BIN1} ${BIN2} nsmb.conf opieaccess \
276             ${DESTDIR}/usr/share/examples/etc
277         cd ${.CURDIR}/defaults; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
278             ${DEFAULTS} ${DESTDIR}/usr/share/examples/etc/defaults
279
280 .include <bsd.prog.mk>