]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - etc/Makefile
Merge from HEAD
[FreeBSD/FreeBSD.git] / etc / Makefile
1 #       from: @(#)Makefile      5.11 (Berkeley) 5/21/91
2 # $FreeBSD$
3
4 .include <src.opts.mk>
5
6 SUBDIR= \
7         newsyslog.conf.d
8
9 .if ${MK_SENDMAIL} != "no"
10 SUBDIR+=sendmail
11 .endif
12
13 .if ${MK_TESTS} != "no"
14 SUBDIR+=tests
15 .endif
16
17 BIN1=   crontab \
18         devd.conf \
19         devfs.conf \
20         ddb.conf \
21         dhclient.conf \
22         disktab \
23         fbtab \
24         gettytab \
25         group \
26         hosts \
27         hosts.allow \
28         hosts.equiv \
29         libalias.conf \
30         libmap.conf \
31         login.access \
32         login.conf \
33         mac.conf \
34         motd \
35         netconfig \
36         network.subr \
37         networks \
38         newsyslog.conf \
39         nsswitch.conf \
40         phones \
41         profile \
42         protocols \
43         rc \
44         rc.bsdextended \
45         rc.firewall \
46         rc.initdiskless \
47         rc.shutdown \
48         rc.subr \
49         remote \
50         rpc \
51         services \
52         shells \
53         sysctl.conf \
54         syslog.conf \
55         termcap.small
56
57 .if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "powerpc64"
58 BIN1+=  libmap32.conf
59 .endif
60
61 .if exists(${.CURDIR}/etc.${MACHINE}/ttys)
62 BIN1+=  etc.${MACHINE}/ttys
63 .elif exists(${.CURDIR}/etc.${MACHINE_ARCH}/ttys)
64 BIN1+=  etc.${MACHINE_ARCH}/ttys
65 .elif exists(${.CURDIR}/etc.${MACHINE_CPUARCH}/ttys)
66 BIN1+=  etc.${MACHINE_CPUARCH}/ttys
67 .else
68 .error etc.MACHINE/ttys missing
69 .endif
70
71 OPENBSMDIR=                     ${.CURDIR}/../contrib/openbsm
72 BSM_ETC_OPEN_FILES=             ${OPENBSMDIR}/etc/audit_class \
73                                 ${OPENBSMDIR}/etc/audit_event
74 BSM_ETC_RESTRICTED_FILES=       ${OPENBSMDIR}/etc/audit_control \
75                                 ${OPENBSMDIR}/etc/audit_user
76 BSM_ETC_EXEC_FILES=             ${OPENBSMDIR}/etc/audit_warn
77 BSM_ETC_DIR=                    ${DESTDIR}/etc/security
78
79 # NB: keep these sorted by MK_* knobs
80
81 .if ${MK_AMD} != "no"
82 BIN1+= amd.map
83 .endif
84
85 .if ${MK_APM} != "no"
86 BIN1+= apmd.conf
87 .endif
88
89 .if ${MK_AUTOFS} != "no"
90 BIN1+= auto_master
91 .endif
92
93 .if ${MK_BSNMP} != "no"
94 BIN1+= snmpd.config
95 .endif
96
97 .if ${MK_FREEBSD_UPDATE} != "no"
98 BIN1+= freebsd-update.conf
99 .endif
100
101 .if ${MK_FTP} != "no"
102 BIN1+= ftpusers
103 .endif
104
105 .if ${MK_INETD} != "no"
106 BIN1+= inetd.conf
107 .endif
108
109 .if ${MK_LOCATE} != "no"
110 BIN1+=  ${.CURDIR}/../usr.bin/locate/locate/locate.rc
111 .endif
112
113 .if ${MK_LPR} != "no"
114 BIN1+=  hosts.lpd printcap
115 .endif
116
117 .if ${MK_MAIL} != "no"
118 BIN1+=  ${.CURDIR}/../usr.bin/mail/misc/mail.rc
119 .endif
120
121 .if ${MK_NTP} != "no"
122 BIN1+=  ntp.conf
123 .endif
124
125 .if ${MK_OPENSSH} != "no"
126 SSH=    ${.CURDIR}/../crypto/openssh/ssh_config \
127         ${.CURDIR}/../crypto/openssh/sshd_config \
128         ${.CURDIR}/../crypto/openssh/moduli
129 .endif
130 .if ${MK_OPENSSL} != "no"
131 SSL=    ${.CURDIR}/../crypto/openssl/apps/openssl.cnf
132 .endif
133
134 .if ${MK_NS_CACHING} != "no"
135 BIN1+= nscd.conf
136 .endif
137
138 .if ${MK_PORTSNAP} != "no"
139 BIN1+= portsnap.conf
140 .endif
141
142 .if ${MK_PF} != "no"
143 BIN1+= pf.os
144 .endif
145
146 .if ${MK_SENDMAIL} != "no"
147 BIN1+=  rc.sendmail
148 .endif
149
150 .if ${MK_TCSH} != "no"
151 BIN1+= csh.cshrc csh.login csh.logout
152 .endif
153
154 .if ${MK_WIRELESS} != "no"
155 BIN1+= regdomain.xml
156 .endif
157
158 # -rwxr-xr-x root:wheel, for the new cron root:wheel
159 BIN2=   netstart pccard_ether rc.suspend rc.resume
160
161 MTREE=  BSD.debug.dist BSD.include.dist BSD.root.dist BSD.usr.dist BSD.var.dist
162 .if ${MK_TESTS} != "no"
163 MTREE+= BSD.tests.dist
164 .endif
165 .if ${MK_SENDMAIL} != "no"
166 MTREE+= BSD.sendmail.dist
167 .endif
168
169 PPPCNF= ppp.conf
170
171 .if ${MK_SENDMAIL} == "no"
172 ETCMAIL=mailer.conf aliases
173 .else
174 ETCMAIL=Makefile README mailer.conf access.sample virtusertable.sample \
175         mailertable.sample aliases
176 .endif
177
178 # Special top level files for FreeBSD
179 FREEBSD=COPYRIGHT
180
181 # Sanitize DESTDIR
182 DESTDIR:=       ${DESTDIR:C://*:/:g}
183
184 afterinstall:
185 .if ${MK_MAN} != "no"
186         ${_+_}cd ${.CURDIR}/../share/man; ${MAKE} makedb
187 .endif
188
189 distribute:
190         # Avoid installing tests here; "make distribution" will do this and
191         # correctly place them in the right location.
192         ${_+_}cd ${.CURDIR} ; ${MAKE} MK_TESTS=no install \
193             DESTDIR=${DISTDIR}/${DISTRIBUTION}
194         ${_+_}cd ${.CURDIR} ; ${MAKE} distribution DESTDIR=${DISTDIR}/${DISTRIBUTION}
195
196 .include <bsd.endian.mk>
197 .if ${TARGET_ENDIANNESS} == "1234"
198 CAP_MKDB_ENDIAN?= -l
199 PWD_MKDB_ENDIAN?= -L
200 .elif ${TARGET_ENDIANNESS} == "4321"
201 CAP_MKDB_ENDIAN?= -b
202 PWD_MKDB_ENDIAN?= -B
203 .else
204 CAP_MKDB_ENDIAN?=
205 PWD_MKDB_ENDIAN?=
206 .endif
207
208 .if defined(NO_ROOT)
209 METALOG.add?=   cat -l >> ${METALOG}
210 .endif
211
212 distribution:
213 .if !defined(DESTDIR)
214         @echo "set DESTDIR before running \"make ${.TARGET}\""
215         @false
216 .endif
217         cd ${.CURDIR}; \
218             ${INSTALL} ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 644 \
219                 ${BIN1} ${DESTDIR}/etc; \
220             cap_mkdb ${CAP_MKDB_ENDIAN} ${DESTDIR}/etc/login.conf; \
221             ${INSTALL} ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 755 \
222                 ${BIN2} ${DESTDIR}/etc; \
223             ${INSTALL} ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 600 \
224                 master.passwd nsmb.conf opieaccess ${DESTDIR}/etc;
225 .if ${MK_AT} == "no"
226         sed -i "" -e 's;.*/usr/libexec/atrun;#&;' ${DESTDIR}/etc/crontab
227 .endif
228 .if ${MK_TCSH} == "no"
229         sed -i "" -e 's;/bin/csh;/bin/sh;' ${DESTDIR}/etc/master.passwd
230 .endif
231         pwd_mkdb ${PWD_MKDB_ENDIAN} -i -p -d ${DESTDIR}/etc \
232             ${DESTDIR}/etc/master.passwd
233 .if defined(NO_ROOT)
234         ( \
235                 echo "./etc/login.conf.db type=file mode=0644 uname=root gname=wheel"; \
236                 echo "./etc/passwd type=file mode=0644 uname=root gname=wheel"; \
237                 echo "./etc/pwd.db type=file mode=0644 uname=root gname=wheel"; \
238                 echo "./etc/spwd.db type=file mode=0600 uname=root gname=wheel"; \
239         ) | ${METALOG.add}
240 .endif
241 .if ${MK_AUTOFS} != "no"
242         ${_+_}cd ${.CURDIR}/autofs; ${MAKE} install
243 .endif
244 .if ${MK_BLUETOOTH} != "no"
245         ${_+_}cd ${.CURDIR}/bluetooth; ${MAKE} install
246 .endif
247 .if ${MK_CASPER} != "no"
248         ${_+_}cd ${.CURDIR}/casper; ${MAKE} install
249 .endif
250         ${_+_}cd ${.CURDIR}/defaults; ${MAKE} install
251         ${_+_}cd ${.CURDIR}/devd; ${MAKE} install
252 .if ${MK_DMAGENT} != "no"
253         ${_+_}cd ${.CURDIR}/dma; ${MAKE} install
254 .endif
255         ${_+_}cd ${.CURDIR}/gss; ${MAKE} install
256         ${_+_}cd ${.CURDIR}/periodic; ${MAKE} install
257 .if ${MK_PKGBOOTSTRAP} != "no"
258         ${_+_}cd ${.CURDIR}/pkg; ${MAKE} install
259 .endif
260         ${_+_}cd ${.CURDIR}/rc.d; ${MAKE} install
261         ${_+_}cd ${.CURDIR}/../share/termcap; ${MAKE} etc-termcap
262         ${_+_}cd ${.CURDIR}/../usr.sbin/rmt; ${MAKE} etc-rmt
263         ${_+_}cd ${.CURDIR}/pam.d; ${MAKE} install
264         cd ${.CURDIR}; ${INSTALL} ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 0444 \
265             ${BSM_ETC_OPEN_FILES} ${BSM_ETC_DIR}
266         cd ${.CURDIR}; ${INSTALL} ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 0600 \
267             ${BSM_ETC_RESTRICTED_FILES} ${BSM_ETC_DIR}
268         cd ${.CURDIR}; ${INSTALL} ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 0500 \
269             ${BSM_ETC_EXEC_FILES} ${BSM_ETC_DIR}
270 .if ${MK_UNBOUND} != "no"
271         if [ ! -e ${DESTDIR}/etc/unbound ]; then \
272                 ${INSTALL_SYMLINK} -T package=unbound ../var/unbound ${DESTDIR}/etc/unbound; \
273         fi
274 .endif
275 .if ${MK_SENDMAIL} != "no"
276         ${_+_}cd ${.CURDIR}/sendmail; ${MAKE} distribution
277 .endif
278 .if ${MK_OPENSSH} != "no"
279         cd ${.CURDIR}; ${INSTALL} -T package=ssh,config -o ${BINOWN} -g ${BINGRP} -m 644 \
280             ${SSH} ${DESTDIR}/etc/ssh
281 .endif
282 .if ${MK_OPENSSL} != "no"
283         cd ${.CURDIR}; ${INSTALL} ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 644 \
284             ${SSL} ${DESTDIR}/etc/ssl
285 .endif
286 .if ${MK_KERBEROS} != "no"
287         cd ${.CURDIR}/root; \
288             ${INSTALL} ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 644 \
289                 dot.k5login ${DESTDIR}/root/.k5login;
290 .endif
291         cd ${.CURDIR}/root; \
292             ${INSTALL} ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 644 \
293                 dot.profile ${DESTDIR}/root/.profile; \
294             rm -f ${DESTDIR}/.profile; \
295             ln ${DESTDIR}/root/.profile ${DESTDIR}/.profile
296 .if ${MK_TCSH} != "no"
297         cd ${.CURDIR}/root; \
298             ${INSTALL} ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 644 \
299                 dot.cshrc ${DESTDIR}/root/.cshrc; \
300             ${INSTALL} ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 644 \
301                 dot.login ${DESTDIR}/root/.login; \
302             rm -f ${DESTDIR}/.cshrc; \
303             ln ${DESTDIR}/root/.cshrc ${DESTDIR}/.cshrc
304 .endif
305         cd ${.CURDIR}/mtree; ${INSTALL} ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 \
306             ${MTREE} ${DESTDIR}/etc/mtree
307 .if ${MK_PPP} != "no"
308         cd ${.CURDIR}/ppp; ${INSTALL} ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 600 \
309             ${PPPCNF} ${DESTDIR}/etc/ppp
310 .endif
311 .if ${MK_MAIL} != "no"
312         cd ${.CURDIR}/mail; ${INSTALL} ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 644 \
313             ${ETCMAIL} ${DESTDIR}/etc/mail
314         if [ -d ${DESTDIR}/etc/mail -a -f ${DESTDIR}/etc/mail/aliases -a \
315               ! -f ${DESTDIR}/etc/aliases ]; then \
316                 ln -s mail/aliases ${DESTDIR}/etc/aliases; \
317         fi
318 .endif
319         ${INSTALL} ${TAG_ARGS} -o ${BINOWN} -g operator -m 664 /dev/null \
320             ${DESTDIR}/etc/dumpdates
321 .if ${MK_LOCATE} != "no"
322         ${INSTALL} ${TAG_ARGS} -o nobody -g ${BINGRP} -m 644 /dev/null \
323             ${DESTDIR}/var/db/locate.database
324 .endif
325         ${INSTALL} ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 644 ${.CURDIR}/minfree \
326             ${DESTDIR}/var/crash
327         cd ${.CURDIR}/..; ${INSTALL} ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 \
328                 ${FREEBSD} ${DESTDIR}/
329 .if ${MK_BOOT} != "no"
330 .if exists(${.CURDIR}/../sys/${MACHINE}/conf/GENERIC.hints)
331         ${INSTALL} ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 \
332             ${.CURDIR}/../sys/${MACHINE}/conf/GENERIC.hints \
333             ${DESTDIR}/boot/device.hints
334 .endif
335 .endif
336 .if ${MK_NIS} == "no"
337         sed -i "" -e 's/.*_compat:/# &/' -e 's/compat$$/files/' \
338                 ${DESTDIR}/etc/nsswitch.conf
339 .endif
340
341 MTREE_CMD?=     mtree
342
343 MTREES=         mtree/BSD.root.dist             /               \
344                 mtree/BSD.var.dist              /var            \
345                 mtree/BSD.usr.dist              /usr            \
346                 mtree/BSD.include.dist          /usr/include    \
347                 mtree/BSD.debug.dist            /usr/lib
348 .if ${MK_GROFF} != "no"
349 MTREES+=        mtree/BSD.groff.dist            /usr
350 .endif
351 .if ${MK_TESTS} != "no"
352 MTREES+=        mtree/BSD.tests.dist            ${TESTSBASE}
353 .endif
354 .if ${MK_SENDMAIL} != "no"
355 MTREES+=        mtree/BSD.sendmail.dist         /
356 .endif
357 .for mtree in ${LOCAL_MTREE}
358 MTREES+=        ../${mtree}                     /
359 .endfor
360
361 distrib-dirs: ${MTREES:N/*}
362         @set ${MTREES}; \
363         while test $$# -ge 2; do \
364                 m=${.CURDIR}/$$1; \
365                 shift; \
366                 d=${DESTDIR}$$1; \
367                 shift; \
368                 test -d $$d || mkdir -p $$d; \
369                 ${ECHO} ${MTREE_CMD} -deU ${MTREE_FOLLOWS_SYMLINKS} \
370                     -f $$m -p $$d; \
371                 ${MTREE_CMD} -deU ${MTREE_FOLLOWS_SYMLINKS} -f $$m -p $$d; \
372         done; true
373 .if defined(NO_ROOT)
374         @set ${MTREES}; \
375         while test $$# -ge 2; do \
376                 m=${.CURDIR}/$$1; \
377                 shift; \
378                 d=$$1; \
379                 test "$$d" == "/" && d=""; \
380                 d=$$d; \
381                 shift; \
382                 ${ECHO} "${MTREE_CMD:N-W} -C -f $$m -K all | " \
383                     "sed s#^\.#.$$d# | ${METALOG.add}" ; \
384                 ${MTREE_CMD:N-W} -C -f $$m -K all | sed s#^\.#.$$d# | \
385                     ${METALOG.add} ; \
386         done; true
387 .endif
388         ${INSTALL_SYMLINK} usr/src/sys ${DESTDIR}/sys
389 .if ${MK_MAN} != "no"
390         cd ${DESTDIR}/usr/share/man; \
391         for mandir in man*; do \
392                 ${INSTALL_SYMLINK} ../$$mandir \
393                     ${DESTDIR}/usr/share/man/en.ISO8859-1/; \
394                 ${INSTALL_SYMLINK} ../$$mandir \
395                     ${DESTDIR}/usr/share/man/en.UTF-8/; \
396         done
397 .if ${MK_OPENSSL} != "no"
398         cd ${DESTDIR}/usr/share/openssl/man; \
399         for mandir in man*; do \
400                 ${INSTALL_SYMLINK} ../$$mandir \
401                     ${DESTDIR}/usr/share/openssl/man/en.ISO8859-1/; \
402         done
403 .endif
404         set - `grep "^[a-zA-Z]" ${.CURDIR}/man.alias`; \
405         while [ $$# -gt 0 ] ; do \
406                 ${INSTALL_SYMLINK} "$$2" "${DESTDIR}/usr/share/man/$$1"; \
407                 if [ "${MK_OPENSSL}" != "no" ]; then \
408                         ${INSTALL_SYMLINK} "$$2" \
409                             "${DESTDIR}/usr/share/openssl/man/$$1"; \
410                 fi; \
411                 shift; shift; \
412         done
413 .endif
414 .if ${MK_NLS} != "no"
415         set - `grep "^[a-zA-Z]" ${.CURDIR}/nls.alias`; \
416         while [ $$# -gt 0 ] ; do \
417                 ${INSTALL_SYMLINK} "$$2" "${DESTDIR}/usr/share/nls/$$1"; \
418                 shift; shift; \
419         done
420 .endif
421
422 etc-examples:
423         cd ${.CURDIR}; ${INSTALL} ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 \
424             ${BIN1} ${BIN2} nsmb.conf opieaccess \
425             ${DESTDIR}/usr/share/examples/etc
426         ${_+_}cd ${.CURDIR}/defaults; ${MAKE} install \
427             DESTDIR=${DESTDIR}/usr/share/examples
428
429 .include <bsd.prog.mk>