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