]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/blob - etc/Makefile
MFC r283989:
[FreeBSD/stable/10.git] / etc / Makefile
1 #       from: @(#)Makefile      5.11 (Berkeley) 5/21/91
2 # $FreeBSD$
3
4 .include <bsd.own.mk>
5
6 SUBDIR= \
7         newsyslog.conf.d
8
9 .if ${MK_SENDMAIL} != "no"
10 SUBDIR+=sendmail
11 .endif
12
13 BIN1=   crontab \
14         devd.conf \
15         devfs.conf \
16         ddb.conf \
17         dhclient.conf \
18         disktab \
19         fbtab \
20         gettytab \
21         group \
22         hosts \
23         hosts.allow \
24         hosts.equiv \
25         libalias.conf \
26         libmap.conf \
27         login.access \
28         login.conf \
29         mac.conf \
30         motd \
31         netconfig \
32         network.subr \
33         networks \
34         newsyslog.conf \
35         nsswitch.conf \
36         phones \
37         profile \
38         protocols \
39         rc \
40         rc.bsdextended \
41         rc.firewall \
42         rc.initdiskless \
43         rc.shutdown \
44         rc.subr \
45         remote \
46         rpc \
47         services \
48         shells \
49         sysctl.conf \
50         syslog.conf \
51         termcap.small \
52
53 .if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "powerpc64"
54 BIN1+=  libmap32.conf
55 .endif
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_BSNMP} != "no"
90 BIN1+= snmpd.config
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.include.dist BSD.root.dist BSD.usr.dist BSD.var.dist
158 .if ${MK_TESTS} != "no"
159 MTREE+= BSD.tests.dist
160 .endif
161 .if ${MK_SENDMAIL} != "no"
162 MTREE+= BSD.sendmail.dist
163 .endif
164 .if ${MK_DEBUG_FILES} != "no"
165 MTREE+= BSD.debug.dist
166 .endif
167
168 PPPCNF= ppp.conf
169
170 .if ${MK_SENDMAIL} == "no"
171 ETCMAIL=mailer.conf aliases
172 .else
173 ETCMAIL=Makefile README mailer.conf access.sample virtusertable.sample \
174         mailertable.sample aliases
175 .endif
176
177 # Special top level files for FreeBSD
178 FREEBSD=COPYRIGHT
179
180 # Sanitize DESTDIR
181 DESTDIR:=       ${DESTDIR:C://*:/:g}
182
183 afterinstall:
184 .if ${MK_MAN} != "no"
185         ${_+_}cd ${.CURDIR}/../share/man; ${MAKE} makedb
186 .endif
187
188 distribute:
189         # Avoid installing tests here; "make distribution" will do this and
190         # correctly place them in the right location.
191         ${_+_}cd ${.CURDIR} ; ${MAKE} -DNO_TESTS install \
192             DESTDIR=${DISTDIR}/${DISTRIBUTION}
193         ${_+_}cd ${.CURDIR} ; ${MAKE} distribution DESTDIR=${DISTDIR}/${DISTRIBUTION}
194
195 .include <bsd.endian.mk>
196 .if ${TARGET_ENDIANNESS} == "1234"
197 CAP_MKDB_ENDIAN?= -l
198 PWD_MKDB_ENDIAN?= -L
199 .elif ${TARGET_ENDIANNESS} == "4321"
200 CAP_MKDB_ENDIAN?= -b
201 PWD_MKDB_ENDIAN?= -B
202 .else
203 CAP_MKDB_ENDIAN?=
204 PWD_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_AT} == "no"
227         sed -i "" -e 's;.*/usr/libexec/atrun;#&;' ${DESTDIR}/etc/crontab
228 .endif
229 .if ${MK_TCSH} == "no"
230         sed -i "" -e 's;/bin/csh;/bin/sh;' ${DESTDIR}/etc/master.passwd
231 .endif
232         pwd_mkdb ${PWD_MKDB_ENDIAN} -i -p -d ${DESTDIR}/etc \
233             ${DESTDIR}/etc/master.passwd
234 .if defined(NO_ROOT)
235         ( \
236                 echo "./etc/login.conf.db type=file mode=0644 uname=root gname=wheel"; \
237                 echo "./etc/passwd type=file mode=0644 uname=root gname=wheel"; \
238                 echo "./etc/pwd.db type=file mode=0644 uname=root gname=wheel"; \
239                 echo "./etc/spwd.db type=file mode=0600 uname=root gname=wheel"; \
240         ) | ${METALOG.add}
241 .endif
242 .if ${MK_AUTOFS} != "no"
243         ${_+_}cd ${.CURDIR}/autofs; ${MAKE} install
244 .endif
245 .if ${MK_BLUETOOTH} != "no"
246         ${_+_}cd ${.CURDIR}/bluetooth; ${MAKE} install
247 .endif
248         ${_+_}cd ${.CURDIR}/defaults; ${MAKE} install
249         ${_+_}cd ${.CURDIR}/devd; ${MAKE} install
250         ${_+_}cd ${.CURDIR}/gss; ${MAKE} install
251         ${_+_}cd ${.CURDIR}/periodic; ${MAKE} install
252 .if ${MK_PKGBOOTSTRAP} != "no"
253         ${_+_}cd ${.CURDIR}/pkg; ${MAKE} install
254 .endif
255         ${_+_}cd ${.CURDIR}/rc.d; ${MAKE} install
256         ${_+_}cd ${.CURDIR}/../share/termcap; ${MAKE} etc-termcap
257         ${_+_}cd ${.CURDIR}/../usr.sbin/rmt; ${MAKE} etc-rmt
258         ${_+_}cd ${.CURDIR}/pam.d; ${MAKE} install
259         cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 0444 \
260             ${BSM_ETC_OPEN_FILES} ${BSM_ETC_DIR}
261         cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 0600 \
262             ${BSM_ETC_RESTRICTED_FILES} ${BSM_ETC_DIR}
263         cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 0500 \
264             ${BSM_ETC_EXEC_FILES} ${BSM_ETC_DIR}
265 .if ${MK_UNBOUND} != "no"
266         if [ ! -e ${DESTDIR}/etc/unbound ]; then \
267                 ${INSTALL_SYMLINK} ../var/unbound ${DESTDIR}/etc/unbound; \
268         fi
269 .endif
270 .if ${MK_SENDMAIL} != "no"
271         ${_+_}cd ${.CURDIR}/sendmail; ${MAKE} distribution
272 .endif
273 .if ${MK_OPENSSH} != "no"
274         cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
275             ${SSH} ${DESTDIR}/etc/ssh
276 .endif
277 .if ${MK_OPENSSL} != "no"
278         cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
279             ${SSL} ${DESTDIR}/etc/ssl
280 .endif
281 .if ${MK_KERBEROS} != "no"
282         cd ${.CURDIR}/root; \
283             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
284                 dot.k5login ${DESTDIR}/root/.k5login;
285 .endif
286         cd ${.CURDIR}/root; \
287             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
288                 dot.profile ${DESTDIR}/root/.profile; \
289             rm -f ${DESTDIR}/.profile; \
290             ln ${DESTDIR}/root/.profile ${DESTDIR}/.profile
291 .if ${MK_TCSH} != "no"
292         cd ${.CURDIR}/root; \
293             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
294                 dot.cshrc ${DESTDIR}/root/.cshrc; \
295             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
296                 dot.login ${DESTDIR}/root/.login; \
297             rm -f ${DESTDIR}/.cshrc; \
298             ln ${DESTDIR}/root/.cshrc ${DESTDIR}/.cshrc
299 .endif
300         cd ${.CURDIR}/mtree; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
301             ${MTREE} ${DESTDIR}/etc/mtree
302 .if ${MK_PPP} != "no"
303         cd ${.CURDIR}/ppp; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 \
304             ${PPPCNF} ${DESTDIR}/etc/ppp
305 .endif
306 .if ${MK_MAIL} != "no"
307         cd ${.CURDIR}/mail; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
308             ${ETCMAIL} ${DESTDIR}/etc/mail
309         if [ -d ${DESTDIR}/etc/mail -a -f ${DESTDIR}/etc/mail/aliases -a \
310               ! -f ${DESTDIR}/etc/aliases ]; then \
311                 ln -s mail/aliases ${DESTDIR}/etc/aliases; \
312         fi
313 .endif
314         ${INSTALL} -o ${BINOWN} -g operator -m 664 /dev/null \
315             ${DESTDIR}/etc/dumpdates
316 .if ${MK_LOCATE} != "no"
317         ${INSTALL} -o nobody -g ${BINGRP} -m 644 /dev/null \
318             ${DESTDIR}/var/db/locate.database
319 .endif
320         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 ${.CURDIR}/minfree \
321             ${DESTDIR}/var/crash
322         cd ${.CURDIR}/..; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
323                 ${FREEBSD} ${DESTDIR}/
324 .if ${MK_BOOT} != "no"
325 .if exists(${.CURDIR}/../sys/${MACHINE}/conf/GENERIC.hints)
326         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
327             ${.CURDIR}/../sys/${MACHINE}/conf/GENERIC.hints \
328             ${DESTDIR}/boot/device.hints
329 .endif
330 .endif
331 .if ${MK_NIS} == "no"
332         sed -i "" -e 's/.*_compat:/# &/' -e 's/compat$$/files/' \
333                 ${DESTDIR}/etc/nsswitch.conf
334 .endif
335
336 MTREE_CMD?=     mtree
337
338 MTREES=         mtree/BSD.root.dist             /               \
339                 mtree/BSD.var.dist              /var            \
340                 mtree/BSD.usr.dist              /usr            \
341                 mtree/BSD.include.dist          /usr/include
342 .if ${MK_DEBUG_FILES} != "no"
343 MTREES+=        mtree/BSD.debug.dist            /usr/lib
344 .endif
345 .if ${MK_GROFF} != "no"
346 MTREES+=        mtree/BSD.groff.dist            /usr
347 .endif
348 .if ${MK_TESTS} != "no"
349 MTREES+=        mtree/BSD.tests.dist            ${TESTSBASE}
350 .endif
351 .if ${MK_SENDMAIL} != "no"
352 MTREES+=        mtree/BSD.sendmail.dist         /
353 .endif
354 .for mtree in ${LOCAL_MTREE}
355 MTREES+=        ../${mtree}                     /
356 .endfor
357
358 distrib-dirs: ${MTREES:N/*}
359         @set ${MTREES}; \
360         while test $$# -ge 2; do \
361                 m=${.CURDIR}/$$1; \
362                 shift; \
363                 d=${DESTDIR}$$1; \
364                 shift; \
365                 test -d $$d || mkdir -p $$d; \
366                 ${ECHO} ${MTREE_CMD} -deU ${MTREE_FOLLOWS_SYMLINKS} \
367                     -f $$m -p $$d; \
368                 ${MTREE_CMD} -deU ${MTREE_FOLLOWS_SYMLINKS} -f $$m -p $$d; \
369         done; true
370 .if defined(NO_ROOT)
371         @set ${MTREES}; \
372         while test $$# -ge 2; do \
373                 m=${.CURDIR}/$$1; \
374                 shift; \
375                 d=$$1; \
376                 test "$$d" == "/" && d=""; \
377                 d=${DISTBASE}$$d; \
378                 shift; \
379                 test -d $$d || mkdir -p $$d; \
380                 ${ECHO} "${MTREE_CMD:N-W} -C -f $$m -K uname,gname | " \
381                     "sed s#^\.#.$$d# | ${METALOG.add}" ; \
382                 ${MTREE_CMD:N-W} -C -f $$m -K uname,gname | sed s#^\.#.$$d# | \
383                     ${METALOG.add} ; \
384         done; true
385 .endif
386         ${INSTALL_SYMLINK} usr/src/sys ${DESTDIR}/sys
387 .if ${MK_MAN} != "no"
388         cd ${DESTDIR}/usr/share/man; \
389         for mandir in man*; do \
390                 ${INSTALL_SYMLINK} ../$$mandir \
391                     ${DESTDIR}/usr/share/man/en.ISO8859-1/; \
392                 ${INSTALL_SYMLINK} ../$$mandir \
393                     ${DESTDIR}/usr/share/man/en.UTF-8/; \
394         done
395 .if ${MK_OPENSSL} != "no"
396         cd ${DESTDIR}/usr/share/openssl/man; \
397         for mandir in man*; do \
398                 ${INSTALL_SYMLINK} ../$$mandir \
399                     ${DESTDIR}/usr/share/openssl/man/en.ISO8859-1/; \
400         done
401 .endif
402         set - `grep "^[a-zA-Z]" ${.CURDIR}/man.alias`; \
403         while [ $$# -gt 0 ] ; do \
404                 ${INSTALL_SYMLINK} "$$2" "${DESTDIR}/usr/share/man/$$1"; \
405                 if [ "${MK_OPENSSL}" != "no" ]; then \
406                         ${INSTALL_SYMLINK} "$$2" \
407                             "${DESTDIR}/usr/share/openssl/man/$$1"; \
408                 fi; \
409                 shift; shift; \
410         done
411 .endif
412 .if ${MK_NLS} != "no"
413         set - `grep "^[a-zA-Z]" ${.CURDIR}/nls.alias`; \
414         while [ $$# -gt 0 ] ; do \
415                 ${INSTALL_SYMLINK} "$$2" "${DESTDIR}/usr/share/nls/$$1"; \
416                 shift; shift; \
417         done
418 .endif
419
420 etc-examples:
421         cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
422             ${BIN1} ${BIN2} nsmb.conf opieaccess \
423             ${DESTDIR}/usr/share/examples/etc
424         ${_+_}cd ${.CURDIR}/defaults; ${MAKE} install \
425             DESTDIR=${DESTDIR}/usr/share/examples
426
427 .include <bsd.prog.mk>