]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - etc/Makefile
Merge llvm, clang, lld, lldb, compiler-rt and libc++ r304149, and update
[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         network.subr \
35         networks \
36         newsyslog.conf \
37         nsswitch.conf \
38         phones \
39         profile \
40         protocols \
41         rc \
42         rc.bsdextended \
43         rc.firewall \
44         rc.initdiskless \
45         rc.shutdown \
46         rc.subr \
47         remote \
48         rpc \
49         services \
50         shells \
51         sysctl.conf \
52         syslog.conf \
53         termcap.small
54
55 .if exists(${.CURDIR}/etc.${MACHINE}/ttys)
56 BIN1+=  etc.${MACHINE}/ttys
57 .elif exists(${.CURDIR}/etc.${MACHINE_ARCH}/ttys)
58 BIN1+=  etc.${MACHINE_ARCH}/ttys
59 .elif exists(${.CURDIR}/etc.${MACHINE_CPUARCH}/ttys)
60 BIN1+=  etc.${MACHINE_CPUARCH}/ttys
61 .else
62 .error etc.MACHINE/ttys missing
63 .endif
64
65 OPENBSMDIR=                     ${SRCTOP}/contrib/openbsm
66 BSM_ETC_OPEN_FILES=             ${OPENBSMDIR}/etc/audit_class \
67                                 ${OPENBSMDIR}/etc/audit_event
68 BSM_ETC_RESTRICTED_FILES=       ${OPENBSMDIR}/etc/audit_control \
69                                 ${OPENBSMDIR}/etc/audit_user
70 BSM_ETC_EXEC_FILES=             ${OPENBSMDIR}/etc/audit_warn
71 BSM_ETC_DIR=                    ${DESTDIR}/etc/security
72
73 # NB: keep these sorted by MK_* knobs
74
75 .if ${MK_AMD} != "no"
76 BIN1+= amd.map
77 .endif
78
79 .if ${MK_APM} != "no"
80 BIN1+= apmd.conf
81 .endif
82
83 .if ${MK_AUTOFS} != "no"
84 BIN1+=  auto_master
85 .endif
86
87 .if ${MK_BLACKLIST} != "no"
88 BIN1+= blacklistd.conf
89 .endif
90
91 .if ${MK_FREEBSD_UPDATE} != "no"
92 BIN1+= freebsd-update.conf
93 .endif
94
95 .if ${MK_FTP} != "no"
96 BIN1+= ftpusers
97 .endif
98
99 .if ${MK_INETD} != "no"
100 BIN1+= inetd.conf
101 .endif
102
103 .if ${MK_LOCATE} != "no"
104 BIN1+=  ${SRCTOP}/usr.bin/locate/locate/locate.rc
105 .endif
106
107 .if ${MK_LPR} != "no"
108 BIN1+=  hosts.lpd printcap
109 .endif
110
111 .if ${MK_MAIL} != "no"
112 BIN1+=  ${SRCTOP}/usr.bin/mail/misc/mail.rc
113 .endif
114
115 .if ${MK_NTP} != "no"
116 BIN1+=  ntp.conf
117 .endif
118
119 .if ${MK_OPENSSH} != "no"
120 SSH=    ${SRCTOP}/crypto/openssh/ssh_config \
121         ${SRCTOP}/crypto/openssh/sshd_config \
122         ${SRCTOP}/crypto/openssh/moduli
123 .endif
124 .if ${MK_OPENSSL} != "no"
125 SSL=    ${SRCTOP}/crypto/openssl/apps/openssl.cnf
126 .endif
127
128 .if ${MK_NS_CACHING} != "no"
129 BIN1+= nscd.conf
130 .endif
131
132 .if ${MK_PORTSNAP} != "no"
133 BIN1+= portsnap.conf
134 .endif
135
136 .if ${MK_PF} != "no"
137 BIN1+= pf.os
138 .endif
139
140 .if ${MK_SENDMAIL} != "no"
141 BIN1+=  rc.sendmail
142 .endif
143
144 .if ${MK_TCSH} != "no"
145 BIN1+= csh.cshrc csh.login csh.logout
146 .endif
147
148 .if ${MK_WIRELESS} != "no"
149 BIN1+= regdomain.xml
150 .endif
151
152 # -rwxr-xr-x root:wheel, for the new cron root:wheel
153 BIN2=   netstart pccard_ether rc.suspend rc.resume
154
155 MTREE=  BSD.debug.dist BSD.include.dist BSD.root.dist BSD.usr.dist BSD.var.dist
156 .if ${MK_LIB32} != "no"
157 MTREE+= BSD.lib32.dist
158 .endif
159 .if ${MK_LIBSOFT} != "no"
160 MTREE+= BSD.libsoft.dist
161 .endif
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 ${SRCTOP}/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 .elif ${TARGET_ENDIANNESS} == "4321"
200 CAP_MKDB_ENDIAN?= -b
201 .else
202 CAP_MKDB_ENDIAN?=
203 .endif
204
205 .if defined(NO_ROOT)
206 METALOG.add?=   cat -l >> ${METALOG}
207 .endif
208
209 distribution:
210 .if !defined(DESTDIR)
211         @echo "set DESTDIR before running \"make ${.TARGET}\""
212         @false
213 .endif
214         cd ${.CURDIR}; \
215             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
216                 ${BIN1} ${DESTDIR}/etc; \
217             cap_mkdb ${CAP_MKDB_ENDIAN} ${DESTDIR}/etc/login.conf; \
218             services_mkdb ${CAP_MKDB_ENDIAN} -q -o ${DESTDIR}/var/db/services.db \
219                 ${DESTDIR}/etc/services; \
220             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 755 \
221                 ${BIN2} ${DESTDIR}/etc; \
222             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 \
223                 master.passwd nsmb.conf opieaccess ${DESTDIR}/etc;
224 .if ${MK_BSNMP} != "no"
225         cd ${.CURDIR}; \
226             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 \
227                 snmpd.config ${DESTDIR}/etc;
228 .endif
229 .if ${MK_AT} == "no"
230         sed -i "" -e 's;.*/usr/libexec/atrun;#&;' ${DESTDIR}/etc/crontab
231 .endif
232 .if ${MK_TCSH} == "no"
233         sed -i "" -e 's;/bin/csh;/bin/sh;' ${DESTDIR}/etc/master.passwd
234 .endif
235         pwd_mkdb -i -p -d ${DESTDIR}/etc ${DESTDIR}/etc/master.passwd
236 .if defined(NO_ROOT)
237         ( \
238                 echo "./etc/login.conf.db type=file mode=0644 uname=root gname=wheel"; \
239                 echo "./etc/passwd type=file mode=0644 uname=root gname=wheel"; \
240                 echo "./etc/pwd.db type=file mode=0644 uname=root gname=wheel"; \
241                 echo "./etc/spwd.db type=file mode=0600 uname=root gname=wheel"; \
242         ) | ${METALOG.add}
243 .endif
244 .if ${MK_AUTOFS} != "no"
245         ${_+_}cd ${.CURDIR}/autofs; ${MAKE} install
246 .endif
247 .if ${MK_BLUETOOTH} != "no"
248         ${_+_}cd ${.CURDIR}/bluetooth; ${MAKE} install
249 .endif
250 .if ${MK_CASPER} != "no"
251         ${_+_}cd ${.CURDIR}/casper; ${MAKE} install
252 .endif
253         ${_+_}cd ${.CURDIR}/cron.d; ${MAKE} install
254         ${_+_}cd ${.CURDIR}/defaults; ${MAKE} install
255         ${_+_}cd ${.CURDIR}/devd; ${MAKE} install
256         ${_+_}cd ${.CURDIR}/gss; ${MAKE} install
257         ${_+_}cd ${.CURDIR}/newsyslog.conf.d; ${MAKE} install
258 .if ${MK_NTP} != "no"
259         ${_+_}cd ${.CURDIR}/ntp; ${MAKE} install
260 .endif
261         ${_+_}cd ${.CURDIR}/periodic; ${MAKE} install
262 .if ${MK_PKGBOOTSTRAP} != "no"
263         ${_+_}cd ${.CURDIR}/pkg; ${MAKE} install
264 .endif
265         ${_+_}cd ${.CURDIR}/rc.d; ${MAKE} install
266         ${_+_}cd ${SRCTOP}/share/termcap; ${MAKE} etc-termcap
267         ${_+_}cd ${.CURDIR}/syslog.d; ${MAKE} install
268         ${_+_}cd ${SRCTOP}/usr.sbin/rmt; ${MAKE} etc-rmt
269         ${_+_}cd ${.CURDIR}/pam.d; ${MAKE} install
270         cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 0444 \
271             ${BSM_ETC_OPEN_FILES} ${BSM_ETC_DIR}
272         cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 0600 \
273             ${BSM_ETC_RESTRICTED_FILES} ${BSM_ETC_DIR}
274         cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 0500 \
275             ${BSM_ETC_EXEC_FILES} ${BSM_ETC_DIR}
276 .if ${MK_UNBOUND} != "no"
277         if [ ! -e ${DESTDIR}/etc/unbound ]; then \
278                 ${INSTALL_SYMLINK} ../var/unbound ${DESTDIR}/etc/unbound; \
279         fi
280 .endif
281 .if ${MK_SENDMAIL} != "no"
282         ${_+_}cd ${.CURDIR}/sendmail; ${MAKE} distribution
283 .endif
284 .if ${MK_OPENSSH} != "no"
285         cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
286             ${SSH} ${DESTDIR}/etc/ssh
287 .endif
288 .if ${MK_OPENSSL} != "no"
289         cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
290             ${SSL} ${DESTDIR}/etc/ssl
291 .endif
292 .if ${MK_KERBEROS} != "no"
293         cd ${.CURDIR}/root; \
294             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
295                 dot.k5login ${DESTDIR}/root/.k5login;
296 .endif
297         cd ${.CURDIR}/root; \
298             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
299                 dot.profile ${DESTDIR}/root/.profile; \
300             rm -f ${DESTDIR}/.profile; \
301             ln ${DESTDIR}/root/.profile ${DESTDIR}/.profile
302 .if ${MK_TCSH} != "no"
303         cd ${.CURDIR}/root; \
304             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
305                 dot.cshrc ${DESTDIR}/root/.cshrc; \
306             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
307                 dot.login ${DESTDIR}/root/.login; \
308             rm -f ${DESTDIR}/.cshrc; \
309             ln ${DESTDIR}/root/.cshrc ${DESTDIR}/.cshrc
310 .endif
311         cd ${.CURDIR}/mtree; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
312             ${MTREE} ${DESTDIR}/etc/mtree
313 .if ${MK_MAIL} != "no"
314         cd ${.CURDIR}/mail; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
315             ${ETCMAIL} ${DESTDIR}/etc/mail
316         if [ -d ${DESTDIR}/etc/mail -a -f ${DESTDIR}/etc/mail/aliases -a \
317               ! -f ${DESTDIR}/etc/aliases ]; then \
318                 ln -s mail/aliases ${DESTDIR}/etc/aliases; \
319         fi
320 .endif
321         ${INSTALL} -o ${BINOWN} -g operator -m 664 /dev/null \
322             ${DESTDIR}/etc/dumpdates
323 .if ${MK_LOCATE} != "no"
324         ${INSTALL} -o nobody -g ${BINGRP} -m 644 /dev/null \
325             ${DESTDIR}/var/db/locate.database
326 .endif
327         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 ${.CURDIR}/minfree \
328             ${DESTDIR}/var/crash
329         cd ${.CURDIR}/..; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
330                 ${FREEBSD} ${DESTDIR}/
331 .if ${MK_BOOT} != "no"
332 .if exists(${SRCTOP}/sys/${MACHINE}/conf/GENERIC.hints)
333         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
334             ${SRCTOP}/sys/${MACHINE}/conf/GENERIC.hints \
335             ${DESTDIR}/boot/device.hints
336 .endif
337 .endif
338 .if ${MK_NIS} == "no"
339         sed -i "" -e 's/.*_compat:/# &/' -e 's/compat$$/files/' \
340                 ${DESTDIR}/etc/nsswitch.conf
341 .endif
342
343 MTREE_CMD?=     mtree
344
345 .if ${MK_INSTALL_AS_USER} == "yes" && ${_uid} != 0
346 MTREE_FILTER= sed -e 's,\([gu]\)name=,\1id=,g' \
347         -e 's,\(uid=\)[^ ]* ,\1${_uid} ,' \
348         -e 's,\(gid=\)[^ ]* ,\1${_gid} ,' \
349         -e 's,\(uid=\)[^ ]*$$,\1${_uid},' \
350         -e 's,\(gid=\)[^ ]*$$,\1${_gid},' 
351 .else
352 MTREE_FILTER= cat
353 .if !defined(NO_FSCHG)
354 MTREE_FSCHG=    -i
355 .endif
356 .endif
357
358 MTREES=         mtree/BSD.root.dist             /               \
359                 mtree/BSD.var.dist              /var            \
360                 mtree/BSD.usr.dist              /usr            \
361                 mtree/BSD.include.dist          /usr/include    \
362                 mtree/BSD.debug.dist            /usr/lib
363 .if ${MK_GROFF} != "no"
364 MTREES+=        mtree/BSD.groff.dist            /usr
365 .endif
366 .if ${MK_LIB32} != "no"
367 MTREES+=        mtree/BSD.lib32.dist            /usr
368 MTREES+=        mtree/BSD.lib32.dist            /usr/lib/debug/usr
369 .endif
370 .if ${MK_LIBSOFT} != "no"
371 MTREES+=        mtree/BSD.libsoft.dist          /usr
372 MTREES+=        mtree/BSD.libsoft.dist          /usr/lib/debug/usr
373 .endif
374 .if ${MK_TESTS} != "no"
375 MTREES+=        mtree/BSD.tests.dist            ${TESTSBASE}
376 MTREES+=        mtree/BSD.tests.dist            /usr/lib/debug/${TESTSBASE}
377 .endif
378 .if ${MK_SENDMAIL} != "no"
379 MTREES+=        mtree/BSD.sendmail.dist         /
380 .endif
381 .for mtree in ${LOCAL_MTREE}
382 MTREES+=        ../${mtree}                     /
383 .endfor
384
385 # Clean up some directories that where mistakenly created as files that
386 # should not have been as part of the nvi update in r281994.
387 # This should be removed after 11.0-RELEASE.
388 DISTRIB_CLEANUP_SHARE_FILES=    ${SHAREDIR}/doc/usd/10.exref ${SHAREDIR}/doc/usd/11.edit
389 DISTRIB_CLEANUP_SHARE_FILES+=   ${SHAREDIR}/doc/usd/12.vi ${SHAREDIR}/doc/usd/13.viref
390 distrib-cleanup: .PHONY
391         for file in ${DISTRIB_CLEANUP_SHARE_FILES}; do \
392                 if [ -f ${DESTDIR}/$${file} ]; then \
393                         rm -f ${DESTDIR}/$${file}; \
394                 fi; \
395         done
396
397 distrib-dirs: ${MTREES:N/*} distrib-cleanup .PHONY
398         @set ${MTREES}; \
399         while test $$# -ge 2; do \
400                 m=${.CURDIR}/$$1; \
401                 shift; \
402                 d=${DESTDIR}$$1; \
403                 shift; \
404                 test -d $$d || mkdir -p $$d; \
405                 ${ECHO} ${MTREE_CMD} -deU ${MTREE_FSCHG} \
406                     ${MTREE_FOLLOWS_SYMLINKS} -f $$m -p $$d; \
407                 ${MTREE_FILTER} $$m | \
408                 ${MTREE_CMD} -deU ${MTREE_FSCHG} ${MTREE_FOLLOWS_SYMLINKS} \
409                     -p $$d; \
410         done; true
411 .if defined(NO_ROOT)
412         @set ${MTREES}; \
413         while test $$# -ge 2; do \
414                 m=${.CURDIR}/$$1; \
415                 shift; \
416                 d=$$1; \
417                 test "$$d" == "/" && d=""; \
418                 d=${DISTBASE}$$d; \
419                 shift; \
420                 test -d ${DESTDIR}/$$d || mkdir -p ${DESTDIR}/$$d; \
421                 ${ECHO} "${MTREE_CMD:N-W} -C -f $$m -K uname,gname | " \
422                     "sed s#^\.#.$$d# | ${METALOG.add}" ; \
423                 ${MTREE_FILTER} $$m | \
424                 ${MTREE_CMD:N-W} -C -K uname,gname | sed s#^\.#.$$d# | \
425                     ${METALOG.add} ; \
426         done; true
427 .endif
428         ${INSTALL_SYMLINK} usr/src/sys ${DESTDIR}/sys
429 .if ${MK_MAN} != "no"
430         cd ${DESTDIR}${SHAREDIR}/man; \
431         for mandir in man*; do \
432                 ${INSTALL_SYMLINK} ../$$mandir \
433                     ${DESTDIR}${SHAREDIR}/man/en.ISO8859-1/; \
434                 ${INSTALL_SYMLINK} ../$$mandir \
435                     ${DESTDIR}${SHAREDIR}/man/en.UTF-8/; \
436         done
437 .if ${MK_OPENSSL} != "no"
438         cd ${DESTDIR}${SHAREDIR}/openssl/man; \
439         for mandir in man*; do \
440                 ${INSTALL_SYMLINK} ../$$mandir \
441                     ${DESTDIR}${SHAREDIR}/openssl/man/en.ISO8859-1/; \
442         done
443 .endif
444         set - `grep "^[a-zA-Z]" ${.CURDIR}/man.alias`; \
445         while [ $$# -gt 0 ] ; do \
446                 ${INSTALL_SYMLINK} "$$2" "${DESTDIR}${SHAREDIR}/man/$$1"; \
447                 if [ "${MK_OPENSSL}" != "no" ]; then \
448                         ${INSTALL_SYMLINK} "$$2" \
449                             "${DESTDIR}${SHAREDIR}/openssl/man/$$1"; \
450                 fi; \
451                 shift; shift; \
452         done
453 .endif
454 .if ${MK_NLS} != "no"
455         set - `grep "^[a-zA-Z]" ${.CURDIR}/nls.alias`; \
456         while [ $$# -gt 0 ] ; do \
457                 ${INSTALL_SYMLINK} "$$2" "${DESTDIR}${SHAREDIR}/nls/$$1"; \
458                 shift; shift; \
459         done
460 .endif
461
462 etc-examples-install: ${META_DEPS}
463         cd ${.CURDIR}; ${INSTALL} ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 \
464             ${BIN1} ${BIN2} nsmb.conf opieaccess \
465             ${DESTDIR}${SHAREDIR}/examples/etc
466
467 etc-examples: etc-examples-install
468         ${_+_}cd ${.CURDIR}/defaults; \
469             ${MAKE} ${${MK_STAGING} == "yes":?all:install} \
470             DESTDIR=${DESTDIR}${SHAREDIR}/examples
471
472 .include <bsd.prog.mk>