]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - etc/Makefile
Simplify using bsd.endian.mk and have it provide CAP_MKDB_ENDIAN, since it is
[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 .if ${MK_SENDMAIL} == "no"
156 ETCMAIL=mailer.conf aliases
157 .else
158 ETCMAIL=Makefile README mailer.conf access.sample virtusertable.sample \
159         mailertable.sample aliases
160 .endif
161
162 # Special top level files for FreeBSD
163 FREEBSD=COPYRIGHT
164
165 # Sanitize DESTDIR
166 DESTDIR:=       ${DESTDIR:C://*:/:g}
167
168 afterinstall:
169 .if ${MK_MAN} != "no"
170         ${_+_}cd ${SRCTOP}/share/man; ${MAKE} makedb
171 .endif
172
173 distribute:
174         # Avoid installing tests here; "make distribution" will do this and
175         # correctly place them in the right location.
176         ${_+_}cd ${.CURDIR} ; ${MAKE} MK_TESTS=no install \
177             DESTDIR=${DISTDIR}/${DISTRIBUTION}
178         ${_+_}cd ${.CURDIR} ; ${MAKE} distribution DESTDIR=${DISTDIR}/${DISTRIBUTION}
179
180 .include <bsd.endian.mk>
181
182 .if defined(NO_ROOT)
183 METALOG.add?=   cat -l >> ${METALOG}
184 .endif
185
186 distribution:
187 .if !defined(DESTDIR)
188         @echo "set DESTDIR before running \"make ${.TARGET}\""
189         @false
190 .endif
191         cd ${.CURDIR}; \
192             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
193                 ${BIN1} ${DESTDIR}/etc; \
194             cap_mkdb ${CAP_MKDB_ENDIAN} ${DESTDIR}/etc/login.conf; \
195             services_mkdb ${CAP_MKDB_ENDIAN} -q -o ${DESTDIR}/var/db/services.db \
196                 ${DESTDIR}/etc/services; \
197             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 755 \
198                 ${BIN2} ${DESTDIR}/etc; \
199             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 \
200                 master.passwd nsmb.conf opieaccess ${DESTDIR}/etc;
201 .if ${MK_BSNMP} != "no"
202         cd ${.CURDIR}; \
203             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 \
204                 snmpd.config ${DESTDIR}/etc;
205 .endif
206 .if ${MK_TCSH} == "no"
207         sed -i "" -e 's;/bin/csh;/bin/sh;' ${DESTDIR}/etc/master.passwd
208 .endif
209         pwd_mkdb -i -p -d ${DESTDIR}/etc ${DESTDIR}/etc/master.passwd
210 .if defined(NO_ROOT)
211         ( \
212                 echo "./etc/login.conf.db type=file mode=0644 uname=root gname=wheel"; \
213                 echo "./etc/passwd type=file mode=0644 uname=root gname=wheel"; \
214                 echo "./etc/pwd.db type=file mode=0644 uname=root gname=wheel"; \
215                 echo "./etc/spwd.db type=file mode=0600 uname=root gname=wheel"; \
216         ) | ${METALOG.add}
217 .endif
218 .if ${MK_AUTOFS} != "no"
219         ${_+_}cd ${.CURDIR}/autofs; ${MAKE} install
220 .endif
221 .if ${MK_BLUETOOTH} != "no"
222         ${_+_}cd ${.CURDIR}/bluetooth; ${MAKE} install
223 .endif
224         ${_+_}cd ${.CURDIR}/cron.d; ${MAKE} install
225         ${_+_}cd ${.CURDIR}/defaults; ${MAKE} install
226         ${_+_}cd ${.CURDIR}/devd; ${MAKE} install
227         ${_+_}cd ${.CURDIR}/gss; ${MAKE} install
228         ${_+_}cd ${.CURDIR}/mtree; ${MAKE} install
229         ${_+_}cd ${.CURDIR}/newsyslog.conf.d; ${MAKE} install
230 .if ${MK_NTP} != "no"
231         ${_+_}cd ${.CURDIR}/ntp; ${MAKE} install
232 .endif
233         ${_+_}cd ${.CURDIR}/periodic; ${MAKE} install
234 .if ${MK_PKGBOOTSTRAP} != "no"
235         ${_+_}cd ${.CURDIR}/pkg; ${MAKE} install
236 .endif
237         ${_+_}cd ${.CURDIR}/rc.d; ${MAKE} install
238         ${_+_}cd ${SRCTOP}/share/termcap; ${MAKE} etc-termcap
239         ${_+_}cd ${.CURDIR}/syslog.d; ${MAKE} install
240         ${_+_}cd ${SRCTOP}/usr.sbin/rmt; ${MAKE} etc-rmt
241         ${_+_}cd ${.CURDIR}/pam.d; ${MAKE} install
242         cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 0444 \
243             ${BSM_ETC_OPEN_FILES} ${BSM_ETC_DIR}
244         cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 0600 \
245             ${BSM_ETC_RESTRICTED_FILES} ${BSM_ETC_DIR}
246         cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 0500 \
247             ${BSM_ETC_EXEC_FILES} ${BSM_ETC_DIR}
248 .if ${MK_UNBOUND} != "no"
249         if [ ! -e ${DESTDIR}/etc/unbound ]; then \
250                 ${INSTALL_SYMLINK} ../var/unbound ${DESTDIR}/etc/unbound; \
251         fi
252 .endif
253 .if ${MK_SENDMAIL} != "no"
254         ${_+_}cd ${.CURDIR}/sendmail; ${MAKE} distribution
255 .endif
256 .if ${MK_OPENSSH} != "no"
257         cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
258             ${SSH} ${DESTDIR}/etc/ssh
259 .endif
260 .if ${MK_OPENSSL} != "no"
261         cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
262             ${SSL} ${DESTDIR}/etc/ssl
263 .endif
264 .if ${MK_KERBEROS} != "no"
265         cd ${.CURDIR}/root; \
266             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
267                 dot.k5login ${DESTDIR}/root/.k5login;
268 .endif
269         cd ${.CURDIR}/root; \
270             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
271                 dot.profile ${DESTDIR}/root/.profile; \
272             rm -f ${DESTDIR}/.profile; \
273             ln ${DESTDIR}/root/.profile ${DESTDIR}/.profile
274 .if ${MK_TCSH} != "no"
275         cd ${.CURDIR}/root; \
276             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
277                 dot.cshrc ${DESTDIR}/root/.cshrc; \
278             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
279                 dot.login ${DESTDIR}/root/.login; \
280             rm -f ${DESTDIR}/.cshrc; \
281             ln ${DESTDIR}/root/.cshrc ${DESTDIR}/.cshrc
282 .endif
283 .if ${MK_MAIL} != "no"
284         cd ${.CURDIR}/mail; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
285             ${ETCMAIL} ${DESTDIR}/etc/mail
286         if [ -d ${DESTDIR}/etc/mail -a -f ${DESTDIR}/etc/mail/aliases -a \
287               ! -f ${DESTDIR}/etc/aliases ]; then \
288                 ln -s mail/aliases ${DESTDIR}/etc/aliases; \
289         fi
290 .endif
291         ${INSTALL} -o ${BINOWN} -g operator -m 664 /dev/null \
292             ${DESTDIR}/etc/dumpdates
293 .if ${MK_LOCATE} != "no"
294         ${INSTALL} -o nobody -g ${BINGRP} -m 644 /dev/null \
295             ${DESTDIR}/var/db/locate.database
296 .endif
297         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 ${.CURDIR}/minfree \
298             ${DESTDIR}/var/crash
299         cd ${.CURDIR}/..; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
300                 ${FREEBSD} ${DESTDIR}/
301 .if ${MK_BOOT} != "no"
302 .if exists(${SRCTOP}/sys/${MACHINE}/conf/GENERIC.hints)
303         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
304             ${SRCTOP}/sys/${MACHINE}/conf/GENERIC.hints \
305             ${DESTDIR}/boot/device.hints
306 .endif
307 .endif
308 .if ${MK_NIS} == "no"
309         sed -i "" -e 's/.*_compat:/# &/' -e 's/compat$$/files/' \
310                 ${DESTDIR}/etc/nsswitch.conf
311 .endif
312
313 MTREE_CMD?=     mtree
314
315 MTREES=         mtree/BSD.root.dist             /               \
316                 mtree/BSD.var.dist              /var            \
317                 mtree/BSD.usr.dist              /usr            \
318                 mtree/BSD.include.dist          /usr/include    \
319                 mtree/BSD.debug.dist            /usr/lib
320 .if ${MK_LIB32} != "no"
321 MTREES+=        mtree/BSD.lib32.dist            /usr
322 MTREES+=        mtree/BSD.lib32.dist            /usr/lib/debug/usr
323 .endif
324 .if ${MK_LIBSOFT} != "no"
325 MTREES+=        mtree/BSD.libsoft.dist          /usr
326 MTREES+=        mtree/BSD.libsoft.dist          /usr/lib/debug/usr
327 .endif
328 .if ${MK_TESTS} != "no"
329 MTREES+=        mtree/BSD.tests.dist            ${TESTSBASE}
330 MTREES+=        mtree/BSD.tests.dist            /usr/lib/debug/${TESTSBASE}
331 .endif
332 .if ${MK_SENDMAIL} != "no"
333 MTREES+=        mtree/BSD.sendmail.dist         /
334 .endif
335 .for mtree in ${LOCAL_MTREE}
336 MTREES+=        ../${mtree}                     /
337 .endfor
338
339 # Clean up some directories that where mistakenly created as files that
340 # should not have been as part of the nvi update in r281994.
341 # This should be removed after 11.0-RELEASE.
342 DISTRIB_CLEANUP_SHARE_FILES=    ${SHAREDIR}/doc/usd/10.exref ${SHAREDIR}/doc/usd/11.edit
343 DISTRIB_CLEANUP_SHARE_FILES+=   ${SHAREDIR}/doc/usd/12.vi ${SHAREDIR}/doc/usd/13.viref
344 distrib-cleanup: .PHONY
345         for file in ${DISTRIB_CLEANUP_SHARE_FILES}; do \
346                 if [ -f ${DESTDIR}/$${file} ]; then \
347                         rm -f ${DESTDIR}/$${file}; \
348                 fi; \
349         done
350
351 distrib-dirs: ${MTREES:N/*} distrib-cleanup .PHONY
352         @set ${MTREES}; \
353         while test $$# -ge 2; do \
354                 m=${.CURDIR}/$$1; \
355                 shift; \
356                 d=${DESTDIR}$$1; \
357                 shift; \
358                 test -d $$d || mkdir -p $$d; \
359                 ${ECHO} ${MTREE_CMD} -deU ${MTREE_FSCHG} \
360                     ${MTREE_FOLLOWS_SYMLINKS} -f $$m -p $$d; \
361                 ${MTREE_FILTER} $$m | \
362                 ${MTREE_CMD} -deU ${MTREE_FSCHG} ${MTREE_FOLLOWS_SYMLINKS} \
363                     -p $$d; \
364         done; true
365 .if defined(NO_ROOT)
366         @set ${MTREES}; \
367         while test $$# -ge 2; do \
368                 m=${.CURDIR}/$$1; \
369                 shift; \
370                 d=$$1; \
371                 test "$$d" == "/" && d=""; \
372                 d=${DISTBASE}$$d; \
373                 shift; \
374                 test -d ${DESTDIR}/$$d || mkdir -p ${DESTDIR}/$$d; \
375                 ${ECHO} "${MTREE_CMD:N-W} -C -f $$m -K all | " \
376                     "sed s#^\.#.$$d# | ${METALOG.add}" ; \
377                 ${MTREE_FILTER} $$m | \
378                 ${MTREE_CMD:N-W} -C -K all | sed s#^\.#.$$d# | \
379                     ${METALOG.add} ; \
380         done; true
381 .endif
382 .if ${MK_NLS} != "no"
383         set - `grep "^[a-zA-Z]" ${.CURDIR}/nls.alias`; \
384         while [ $$# -gt 0 ] ; do \
385                 ${INSTALL_SYMLINK} "$$2" "${DESTDIR}${SHAREDIR}/nls/$$1"; \
386                 shift; shift; \
387         done
388 .endif
389
390 etc-examples-install: ${META_DEPS}
391         cd ${.CURDIR}; ${INSTALL} ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 \
392             ${BIN1} ${BIN2} nsmb.conf opieaccess \
393             ${DESTDIR}${SHAREDIR}/examples/etc
394
395 etc-examples: etc-examples-install
396         ${_+_}cd ${.CURDIR}/defaults; \
397             ${MAKE} ${${MK_STAGING} == "yes":?all:install} \
398             DESTDIR=${DESTDIR}${SHAREDIR}/examples
399
400 .include <bsd.prog.mk>
401
402 .if ${MK_INSTALL_AS_USER} == "yes" && ${_uid} != 0
403 MTREE_FILTER= sed -e 's,\([gu]\)name=,\1id=,g' \
404         -e 's,\(uid=\)[^ ]* ,\1${_uid} ,' \
405         -e 's,\(gid=\)[^ ]* ,\1${_gid} ,' \
406         -e 's,\(uid=\)[^ ]*$$,\1${_uid},' \
407         -e 's,\(gid=\)[^ ]*$$,\1${_gid},'
408 .else
409 MTREE_FILTER= cat
410 .if !defined(NO_FSCHG)
411 MTREE_FSCHG=    -i
412 .endif
413 .endif