]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - etc/Makefile
MFH @ r337607, in preparation for boarding
[FreeBSD/FreeBSD.git] / etc / Makefile
1 #       from: @(#)Makefile      5.11 (Berkeley) 5/21/91
2 # $FreeBSD$
3
4 .include <src.opts.mk>
5
6 FILESGROUPS=    FILES
7
8 # No need as it is empty and just causes rebuilds since this file does so much.
9 UPDATE_DEPENDFILE=      no
10
11 .if ${MK_SENDMAIL} != "no"
12 SUBDIR+=sendmail
13 .endif
14
15 BIN1=   crontab \
16         devd.conf \
17         devfs.conf \
18         ddb.conf \
19         dhclient.conf \
20         disktab \
21         fbtab \
22         gettytab \
23         group \
24         hosts \
25         hosts.allow \
26         hosts.equiv \
27         libalias.conf \
28         libmap.conf \
29         login.access \
30         login.conf \
31         mac.conf \
32         motd \
33         netconfig \
34         networks \
35         newsyslog.conf \
36         nsswitch.conf \
37         phones \
38         profile \
39         protocols \
40         rc.bsdextended \
41         rc.firewall \
42         remote \
43         rpc \
44         services \
45         sysctl.conf \
46         syslog.conf \
47         termcap.small
48
49 .if exists(${.CURDIR}/etc.${MACHINE}/ttys)
50 BIN1+=  etc.${MACHINE}/ttys
51 .elif exists(${.CURDIR}/etc.${MACHINE_ARCH}/ttys)
52 BIN1+=  etc.${MACHINE_ARCH}/ttys
53 .elif exists(${.CURDIR}/etc.${MACHINE_CPUARCH}/ttys)
54 BIN1+=  etc.${MACHINE_CPUARCH}/ttys
55 .else
56 .error etc.MACHINE/ttys missing
57 .endif
58
59 OPENBSMDIR=                     ${SRCTOP}/contrib/openbsm
60 BSM_ETC_OPEN_FILES=             ${OPENBSMDIR}/etc/audit_class \
61                                 ${OPENBSMDIR}/etc/audit_event
62 BSM_ETC_RESTRICTED_FILES=       ${OPENBSMDIR}/etc/audit_control \
63                                 ${OPENBSMDIR}/etc/audit_user
64 BSM_ETC_EXEC_FILES=             ${OPENBSMDIR}/etc/audit_warn
65 BSM_ETC_DIR=                    ${DESTDIR}/etc/security
66
67 # NB: keep these sorted by MK_* knobs
68
69 .if ${MK_AMD} != "no"
70 BIN1+= amd.map
71 .endif
72
73 .if ${MK_FTP} != "no"
74 BIN1+= ftpusers
75 .endif
76
77 .if ${MK_INETD} != "no"
78 BIN1+= inetd.conf
79 .endif
80
81 .if ${MK_LOCATE} != "no"
82 BIN1+=  ${SRCTOP}/usr.bin/locate/locate/locate.rc
83 .endif
84
85 .if ${MK_LPR} != "no"
86 BIN1+=  hosts.lpd printcap
87 .endif
88
89 .if ${MK_MAIL} != "no"
90 BIN1+=  ${SRCTOP}/usr.bin/mail/misc/mail.rc
91 .endif
92
93 .if ${MK_NTP} != "no"
94 BIN1+=  ntp.conf
95 .endif
96
97 .if ${MK_OPENSSH} != "no"
98 SSH=    ${SRCTOP}/crypto/openssh/ssh_config \
99         ${SRCTOP}/crypto/openssh/sshd_config \
100         ${SRCTOP}/crypto/openssh/moduli
101 .endif
102 .if ${MK_OPENSSL} != "no"
103 SSL=    ${SRCTOP}/crypto/openssl/apps/openssl.cnf
104 .endif
105
106 .if ${MK_PF} != "no"
107 BIN1+= pf.os
108 .endif
109
110 .if ${MK_SENDMAIL} != "no"
111 BIN1+=  rc.sendmail
112 .endif
113
114 .if ${MK_TCSH} != "no"
115 BIN1+= csh.cshrc csh.login csh.logout
116 .endif
117
118 .if ${MK_WIRELESS} != "no"
119 BIN1+= regdomain.xml
120 .endif
121
122 .if ${MK_SENDMAIL} == "no"
123 ETCMAIL=mailer.conf aliases
124 .else
125 ETCMAIL=Makefile README mailer.conf access.sample virtusertable.sample \
126         mailertable.sample aliases
127 .endif
128
129 # Special top level files for FreeBSD
130 FREEBSD=COPYRIGHT
131
132 # Sanitize DESTDIR
133 DESTDIR:=       ${DESTDIR:C://*:/:g}
134
135 afterinstall:
136 .if ${MK_MAN} != "no"
137         ${_+_}cd ${SRCTOP}/share/man; ${MAKE} makedb
138 .endif
139
140 distribute:
141         # Avoid installing tests here; "make distribution" will do this and
142         # correctly place them in the right location.
143         ${_+_}cd ${.CURDIR} ; ${MAKE} MK_TESTS=no install \
144             DESTDIR=${DISTDIR}/${DISTRIBUTION}
145         ${_+_}cd ${.CURDIR} ; ${MAKE} distribution DESTDIR=${DISTDIR}/${DISTRIBUTION}
146
147 .include <bsd.endian.mk>
148
149 .if defined(NO_ROOT)
150 METALOG.add?=   cat -l >> ${METALOG}
151 .endif
152
153 distribution:
154 .if !defined(DESTDIR)
155         @echo "set DESTDIR before running \"make ${.TARGET}\""
156         @false
157 .endif
158         cd ${.CURDIR}; \
159             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
160                 ${BIN1} ${DESTDIR}/etc; \
161             cap_mkdb ${CAP_MKDB_ENDIAN} ${DESTDIR}/etc/login.conf; \
162             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 \
163                 master.passwd nsmb.conf opieaccess ${DESTDIR}/etc;
164
165 .if ${MK_SERVICESDB} != "no"
166         cd ${.CURDIR}; \
167             services_mkdb ${CAP_MKDB_ENDIAN} -q -o ${DESTDIR}/var/db/services.db \
168                 ${DESTDIR}/etc/services;
169 .endif
170
171 .if ${MK_BSNMP} != "no"
172         cd ${.CURDIR}; \
173             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 \
174                 snmpd.config ${DESTDIR}/etc;
175 .endif
176 .if ${MK_TCSH} == "no"
177         sed -i "" -e 's;/bin/csh;/bin/sh;' ${DESTDIR}/etc/master.passwd
178 .endif
179         pwd_mkdb -i -p -d ${DESTDIR}/etc ${DESTDIR}/etc/master.passwd
180 .if defined(NO_ROOT)
181         ( \
182                 echo "./etc/login.conf.db type=file mode=0644 uname=root gname=wheel"; \
183                 echo "./etc/passwd type=file mode=0644 uname=root gname=wheel"; \
184                 echo "./etc/pwd.db type=file mode=0644 uname=root gname=wheel"; \
185                 echo "./etc/spwd.db type=file mode=0600 uname=root gname=wheel"; \
186                 echo "./var/db/services.db type=file mode=0644 uname=root gname=wheel"; \
187         ) | ${METALOG.add}
188 .endif
189 .if ${MK_BLUETOOTH} != "no"
190         ${_+_}cd ${.CURDIR}/bluetooth; ${MAKE} install
191 .endif
192         ${_+_}cd ${.CURDIR}/cron.d; ${MAKE} install
193         ${_+_}cd ${.CURDIR}/defaults; ${MAKE} install
194         ${_+_}cd ${.CURDIR}/devd; ${MAKE} install
195         ${_+_}cd ${.CURDIR}/gss; ${MAKE} install
196         ${_+_}cd ${.CURDIR}/mtree; ${MAKE} install
197         ${_+_}cd ${.CURDIR}/newsyslog.conf.d; ${MAKE} install
198 .if ${MK_NTP} != "no"
199         ${_+_}cd ${.CURDIR}/ntp; ${MAKE} install
200 .endif
201         ${_+_}cd ${.CURDIR}/periodic; ${MAKE} install
202         ${_+_}cd ${SRCTOP}/share/termcap; ${MAKE} etc-termcap
203         ${_+_}cd ${.CURDIR}/syslog.d; ${MAKE} install
204         ${_+_}cd ${SRCTOP}/usr.sbin/rmt; ${MAKE} etc-rmt
205         ${_+_}cd ${.CURDIR}/pam.d; ${MAKE} install
206         cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 0444 \
207             ${BSM_ETC_OPEN_FILES} ${BSM_ETC_DIR}
208         cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 0600 \
209             ${BSM_ETC_RESTRICTED_FILES} ${BSM_ETC_DIR}
210         cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 0500 \
211             ${BSM_ETC_EXEC_FILES} ${BSM_ETC_DIR}
212 .if ${MK_UNBOUND} != "no"
213         if [ ! -e ${DESTDIR}/etc/unbound ]; then \
214                 ${INSTALL_SYMLINK} ../var/unbound ${DESTDIR}/etc/unbound; \
215         fi
216 .endif
217 .if ${MK_SENDMAIL} != "no"
218         ${_+_}cd ${.CURDIR}/sendmail; ${MAKE} distribution
219 .endif
220 .if ${MK_OPENSSH} != "no"
221         cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
222             ${SSH} ${DESTDIR}/etc/ssh
223 .endif
224 .if ${MK_OPENSSL} != "no"
225         cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
226             ${SSL} ${DESTDIR}/etc/ssl
227 .endif
228 .if ${MK_KERBEROS} != "no"
229         cd ${.CURDIR}/root; \
230             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
231                 dot.k5login ${DESTDIR}/root/.k5login;
232 .endif
233         cd ${.CURDIR}/root; \
234             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
235                 dot.profile ${DESTDIR}/root/.profile; \
236             rm -f ${DESTDIR}/.profile; \
237             ${INSTALL_LINK} ${DESTDIR}/root/.profile ${DESTDIR}/.profile
238 .if ${MK_TCSH} != "no"
239         cd ${.CURDIR}/root; \
240             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
241                 dot.cshrc ${DESTDIR}/root/.cshrc; \
242             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
243                 dot.login ${DESTDIR}/root/.login; \
244             rm -f ${DESTDIR}/.cshrc; \
245             ${INSTALL_LINK} ${DESTDIR}/root/.cshrc ${DESTDIR}/.cshrc
246 .endif
247 .if ${MK_MAIL} != "no"
248         cd ${.CURDIR}/mail; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
249             ${ETCMAIL} ${DESTDIR}/etc/mail
250         if [ -d ${DESTDIR}/etc/mail -a -f ${DESTDIR}/etc/mail/aliases -a \
251               ! -f ${DESTDIR}/etc/aliases ]; then \
252                 ${INSTALL_SYMLINK} mail/aliases ${DESTDIR}/etc/aliases; \
253         fi
254 .endif
255 .if ${MK_LOCATE} != "no"
256         ${INSTALL} -o nobody -g ${BINGRP} -m 644 /dev/null \
257             ${DESTDIR}/var/db/locate.database
258 .endif
259         cd ${.CURDIR}/..; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
260                 ${FREEBSD} ${DESTDIR}/
261 .if ${MK_BOOT} != "no"
262 .if exists(${SRCTOP}/sys/${MACHINE}/conf/GENERIC.hints)
263         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
264             ${SRCTOP}/sys/${MACHINE}/conf/GENERIC.hints \
265             ${DESTDIR}/boot/device.hints
266 .endif
267 .endif
268 .if ${MK_NIS} == "no"
269         sed -i "" -e 's/.*_compat:/# &/' -e 's/compat$$/files/' \
270                 ${DESTDIR}/etc/nsswitch.conf
271 .endif
272
273 MTREE_CMD?=     mtree
274
275 MTREES=         mtree/BSD.root.dist             /               \
276                 mtree/BSD.var.dist              /var            \
277                 mtree/BSD.usr.dist              /usr            \
278                 mtree/BSD.include.dist          /usr/include    \
279                 mtree/BSD.debug.dist            /usr/lib
280 .if ${MK_LIB32} != "no"
281 MTREES+=        mtree/BSD.lib32.dist            /usr
282 MTREES+=        mtree/BSD.lib32.dist            /usr/lib/debug/usr
283 .endif
284 .if ${MK_LIBSOFT} != "no"
285 MTREES+=        mtree/BSD.libsoft.dist          /usr
286 MTREES+=        mtree/BSD.libsoft.dist          /usr/lib/debug/usr
287 .endif
288 .if ${MK_TESTS} != "no"
289 MTREES+=        mtree/BSD.tests.dist            ${TESTSBASE}
290 MTREES+=        mtree/BSD.tests.dist            /usr/lib/debug/${TESTSBASE}
291 .endif
292 .if ${MK_SENDMAIL} != "no"
293 MTREES+=        mtree/BSD.sendmail.dist         /
294 .endif
295 .for mtree in ${LOCAL_MTREE}
296 MTREES+=        ../${mtree}                     /
297 .endfor
298
299 # Clean up some directories that where mistakenly created as files that
300 # should not have been as part of the nvi update in r281994.
301 # This should be removed after 11.0-RELEASE.
302 DISTRIB_CLEANUP_SHARE_FILES=    ${SHAREDIR}/doc/usd/10.exref ${SHAREDIR}/doc/usd/11.edit
303 DISTRIB_CLEANUP_SHARE_FILES+=   ${SHAREDIR}/doc/usd/12.vi ${SHAREDIR}/doc/usd/13.viref
304 distrib-cleanup: .PHONY
305         for file in ${DISTRIB_CLEANUP_SHARE_FILES}; do \
306                 if [ -f ${DESTDIR}/$${file} ]; then \
307                         rm -f ${DESTDIR}/$${file}; \
308                 fi; \
309         done
310
311 distrib-dirs: ${MTREES:N/*} distrib-cleanup .PHONY
312         @set ${MTREES}; \
313         while test $$# -ge 2; do \
314                 m=${.CURDIR}/$$1; \
315                 shift; \
316                 d=${DESTDIR}$$1; \
317                 shift; \
318                 test -d $$d || mkdir -p $$d; \
319                 ${ECHO} ${MTREE_CMD} -deU ${MTREE_FSCHG} \
320                     ${MTREE_FOLLOWS_SYMLINKS} -f $$m -p $$d; \
321                 ${MTREE_FILTER} $$m | \
322                 ${MTREE_CMD} -deU ${MTREE_FSCHG} ${MTREE_FOLLOWS_SYMLINKS} \
323                     -p $$d; \
324         done; true
325 .if defined(NO_ROOT)
326         @set ${MTREES}; \
327         while test $$# -ge 2; do \
328                 m=${.CURDIR}/$$1; \
329                 shift; \
330                 d=$$1; \
331                 test "$$d" == "/" && d=""; \
332                 d=${DISTBASE}$$d; \
333                 shift; \
334                 test -d ${DESTDIR}/$$d || mkdir -p ${DESTDIR}/$$d; \
335                 ${ECHO} "${MTREE_CMD:N-W} -C -f $$m -K all | " \
336                     "sed s#^\.#.$$d# | ${METALOG.add}" ; \
337                 ${MTREE_FILTER} $$m | \
338                 ${MTREE_CMD:N-W} -C -K all | sed s#^\.#.$$d# | \
339                     ${METALOG.add} ; \
340         done; true
341 .endif
342 .if ${MK_NLS} != "no"
343         set - `grep "^[a-zA-Z]" ${.CURDIR}/nls.alias`; \
344         while [ $$# -gt 0 ] ; do \
345                 ${INSTALL_SYMLINK} "$$2" "${DESTDIR}${SHAREDIR}/nls/$$1"; \
346                 shift; shift; \
347         done
348 .endif
349
350 etc-examples-install: ${META_DEPS}
351         cd ${.CURDIR}; ${INSTALL} ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 \
352             ${BIN1} ${BIN2} nsmb.conf opieaccess \
353             ${DESTDIR}${SHAREDIR}/examples/etc
354
355 etc-examples: etc-examples-install
356         ${_+_}cd ${.CURDIR}/defaults; \
357             ${MAKE} ${${MK_STAGING} == "yes":?all:install} \
358             DESTDIR=${DESTDIR}${SHAREDIR}/examples
359
360 .include <bsd.prog.mk>
361
362 .if ${MK_INSTALL_AS_USER} == "yes" && ${_uid} != 0
363 MTREE_FILTER= sed -e 's,\([gu]\)name=,\1id=,g' \
364         -e 's,\(uid=\)[^ ]* ,\1${_uid} ,' \
365         -e 's,\(gid=\)[^ ]* ,\1${_gid} ,' \
366         -e 's,\(uid=\)[^ ]*$$,\1${_uid},' \
367         -e 's,\(gid=\)[^ ]*$$,\1${_gid},'
368 .else
369 MTREE_FILTER= cat
370 .if !defined(NO_FSCHG)
371 MTREE_FSCHG=    -i
372 .endif
373 .endif