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