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