]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/blob - etc/Makefile
MFC r308139,r308157,r308160,r316818,r318250,r318443:
[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         cron.d \
8         newsyslog.conf.d \
9         syslog.d
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 ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "powerpc64"
56 BIN1+=  libmap32.conf
57 .endif
58
59 .if exists(${.CURDIR}/etc.${MACHINE}/ttys)
60 BIN1+=  etc.${MACHINE}/ttys
61 .elif exists(${.CURDIR}/etc.${MACHINE_ARCH}/ttys)
62 BIN1+=  etc.${MACHINE_ARCH}/ttys
63 .elif exists(${.CURDIR}/etc.${MACHINE_CPUARCH}/ttys)
64 BIN1+=  etc.${MACHINE_CPUARCH}/ttys
65 .else
66 .error etc.MACHINE/ttys missing
67 .endif
68
69 OPENBSMDIR=                     ${.CURDIR}/../contrib/openbsm
70 BSM_ETC_OPEN_FILES=             ${OPENBSMDIR}/etc/audit_class \
71                                 ${OPENBSMDIR}/etc/audit_event
72 BSM_ETC_RESTRICTED_FILES=       ${OPENBSMDIR}/etc/audit_control \
73                                 ${OPENBSMDIR}/etc/audit_user
74 BSM_ETC_EXEC_FILES=             ${OPENBSMDIR}/etc/audit_warn
75 BSM_ETC_DIR=                    ${DESTDIR}/etc/security
76
77 # NB: keep these sorted by MK_* knobs
78
79 .if ${MK_AMD} != "no"
80 BIN1+= amd.map
81 .endif
82
83 .if ${MK_APM} != "no"
84 BIN1+= apmd.conf
85 .endif
86
87 .if ${MK_AUTOFS} != "no"
88 BIN1+= auto_master
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+=  ${.CURDIR}/../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+=  ${.CURDIR}/../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=    ${.CURDIR}/../crypto/openssh/ssh_config \
121         ${.CURDIR}/../crypto/openssh/sshd_config \
122         ${.CURDIR}/../crypto/openssh/moduli
123 .endif
124 .if ${MK_OPENSSL} != "no"
125 SSL=    ${.CURDIR}/../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 MTREE=  BSD.debug.dist BSD.include.dist BSD.root.dist BSD.usr.dist BSD.var.dist
156 .if ${MK_TESTS} != "no"
157 MTREE+= BSD.tests.dist
158 .endif
159 .if ${MK_SENDMAIL} != "no"
160 MTREE+= BSD.sendmail.dist
161 .endif
162
163 PPPCNF= ppp.conf
164
165 .if ${MK_SENDMAIL} == "no"
166 ETCMAIL=mailer.conf aliases
167 .else
168 ETCMAIL=Makefile README mailer.conf access.sample virtusertable.sample \
169         mailertable.sample aliases
170 .endif
171
172 # Special top level files for FreeBSD
173 FREEBSD=COPYRIGHT
174
175 # Sanitize DESTDIR
176 DESTDIR:=       ${DESTDIR:C://*:/:g}
177
178 afterinstall:
179 .if ${MK_MAN} != "no"
180         ${_+_}cd ${.CURDIR}/../share/man; ${MAKE} makedb
181 .endif
182
183 distribute:
184         # Avoid installing tests here; "make distribution" will do this and
185         # correctly place them in the right location.
186         ${_+_}cd ${.CURDIR} ; ${MAKE} -DNO_TESTS install \
187             DESTDIR=${DISTDIR}/${DISTRIBUTION}
188         ${_+_}cd ${.CURDIR} ; ${MAKE} distribution DESTDIR=${DISTDIR}/${DISTRIBUTION}
189
190 .include <bsd.endian.mk>
191 .if ${TARGET_ENDIANNESS} == "1234"
192 CAP_MKDB_ENDIAN?= -l
193 PWD_MKDB_ENDIAN?= -L
194 .elif ${TARGET_ENDIANNESS} == "4321"
195 CAP_MKDB_ENDIAN?= -b
196 PWD_MKDB_ENDIAN?= -B
197 .else
198 CAP_MKDB_ENDIAN?=
199 PWD_MKDB_ENDIAN?=
200 .endif
201
202 .if defined(NO_ROOT)
203 METALOG.add?=   cat -l >> ${METALOG}
204 .endif
205
206 distribution:
207 .if !defined(DESTDIR)
208         @echo "set DESTDIR before running \"make ${.TARGET}\""
209         @false
210 .endif
211         cd ${.CURDIR}; \
212             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
213                 ${BIN1} ${DESTDIR}/etc; \
214             cap_mkdb ${CAP_MKDB_ENDIAN} ${DESTDIR}/etc/login.conf; \
215             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 755 \
216                 ${BIN2} ${DESTDIR}/etc; \
217             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 \
218                 master.passwd nsmb.conf opieaccess ${DESTDIR}/etc;
219 .if ${MK_BSNMP} != "no"
220         cd ${.CURDIR}; \
221             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 \
222                 snmpd.config ${DESTDIR}/etc;
223 .endif
224 .if ${MK_AT} == "no"
225         sed -i "" -e 's;.*/usr/libexec/atrun;#&;' ${DESTDIR}/etc/crontab
226 .endif
227 .if ${MK_TCSH} == "no"
228         sed -i "" -e 's;/bin/csh;/bin/sh;' ${DESTDIR}/etc/master.passwd
229 .endif
230         pwd_mkdb ${PWD_MKDB_ENDIAN} -i -p -d ${DESTDIR}/etc \
231             ${DESTDIR}/etc/master.passwd
232 .if defined(NO_ROOT)
233         ( \
234                 echo "./etc/login.conf.db type=file mode=0644 uname=root gname=wheel"; \
235                 echo "./etc/passwd type=file mode=0644 uname=root gname=wheel"; \
236                 echo "./etc/pwd.db type=file mode=0644 uname=root gname=wheel"; \
237                 echo "./etc/spwd.db type=file mode=0600 uname=root gname=wheel"; \
238         ) | ${METALOG.add}
239 .endif
240 .if ${MK_AUTOFS} != "no"
241         ${_+_}cd ${.CURDIR}/autofs; ${MAKE} install
242 .endif
243 .if ${MK_BLUETOOTH} != "no"
244         ${_+_}cd ${.CURDIR}/bluetooth; ${MAKE} install
245 .endif
246         ${_+_}cd ${.CURDIR}/defaults; ${MAKE} install
247         ${_+_}cd ${.CURDIR}/devd; ${MAKE} install
248         ${_+_}cd ${.CURDIR}/gss; ${MAKE} install
249 .if ${MK_NTP} != "no"
250         ${_+_}cd ${.CURDIR}/ntp; ${MAKE} install
251 .endif
252         ${_+_}cd ${.CURDIR}/periodic; ${MAKE} install
253 .if ${MK_PKGBOOTSTRAP} != "no"
254         ${_+_}cd ${.CURDIR}/pkg; ${MAKE} install
255 .endif
256         ${_+_}cd ${.CURDIR}/rc.d; ${MAKE} install
257         ${_+_}cd ${.CURDIR}/../share/termcap; ${MAKE} etc-termcap
258         ${_+_}cd ${.CURDIR}/../usr.sbin/rmt; ${MAKE} etc-rmt
259         ${_+_}cd ${.CURDIR}/pam.d; ${MAKE} install
260         cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 0444 \
261             ${BSM_ETC_OPEN_FILES} ${BSM_ETC_DIR}
262         cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 0600 \
263             ${BSM_ETC_RESTRICTED_FILES} ${BSM_ETC_DIR}
264         cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 0500 \
265             ${BSM_ETC_EXEC_FILES} ${BSM_ETC_DIR}
266 .if ${MK_UNBOUND} != "no"
267         if [ ! -e ${DESTDIR}/etc/unbound ]; then \
268                 ${INSTALL_SYMLINK} ../var/unbound ${DESTDIR}/etc/unbound; \
269         fi
270 .endif
271 .if ${MK_SENDMAIL} != "no"
272         ${_+_}cd ${.CURDIR}/sendmail; ${MAKE} distribution
273 .endif
274 .if ${MK_OPENSSH} != "no"
275         cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
276             ${SSH} ${DESTDIR}/etc/ssh
277 .endif
278 .if ${MK_OPENSSL} != "no"
279         cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
280             ${SSL} ${DESTDIR}/etc/ssl
281 .endif
282 .if ${MK_KERBEROS} != "no"
283         cd ${.CURDIR}/root; \
284             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
285                 dot.k5login ${DESTDIR}/root/.k5login;
286 .endif
287         cd ${.CURDIR}/root; \
288             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
289                 dot.profile ${DESTDIR}/root/.profile; \
290             rm -f ${DESTDIR}/.profile; \
291             ln ${DESTDIR}/root/.profile ${DESTDIR}/.profile
292 .if ${MK_TCSH} != "no"
293         cd ${.CURDIR}/root; \
294             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
295                 dot.cshrc ${DESTDIR}/root/.cshrc; \
296             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
297                 dot.login ${DESTDIR}/root/.login; \
298             rm -f ${DESTDIR}/.cshrc; \
299             ln ${DESTDIR}/root/.cshrc ${DESTDIR}/.cshrc
300 .endif
301         cd ${.CURDIR}/mtree; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
302             ${MTREE} ${DESTDIR}/etc/mtree
303 .if ${MK_PPP} != "no"
304         cd ${.CURDIR}/ppp; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 \
305             ${PPPCNF} ${DESTDIR}/etc/ppp
306 .endif
307 .if ${MK_MAIL} != "no"
308         cd ${.CURDIR}/mail; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
309             ${ETCMAIL} ${DESTDIR}/etc/mail
310         if [ -d ${DESTDIR}/etc/mail -a -f ${DESTDIR}/etc/mail/aliases -a \
311               ! -f ${DESTDIR}/etc/aliases ]; then \
312                 ln -s mail/aliases ${DESTDIR}/etc/aliases; \
313         fi
314 .endif
315         ${INSTALL} -o ${BINOWN} -g operator -m 664 /dev/null \
316             ${DESTDIR}/etc/dumpdates
317 .if ${MK_LOCATE} != "no"
318         ${INSTALL} -o nobody -g ${BINGRP} -m 644 /dev/null \
319             ${DESTDIR}/var/db/locate.database
320 .endif
321         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 ${.CURDIR}/minfree \
322             ${DESTDIR}/var/crash
323         cd ${.CURDIR}/..; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
324                 ${FREEBSD} ${DESTDIR}/
325 .if ${MK_BOOT} != "no"
326 .if exists(${.CURDIR}/../sys/${MACHINE}/conf/GENERIC.hints)
327         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
328             ${.CURDIR}/../sys/${MACHINE}/conf/GENERIC.hints \
329             ${DESTDIR}/boot/device.hints
330 .endif
331 .endif
332 .if ${MK_NIS} == "no"
333         sed -i "" -e 's/.*_compat:/# &/' -e 's/compat$$/files/' \
334                 ${DESTDIR}/etc/nsswitch.conf
335 .endif
336
337 MTREE_CMD?=     mtree
338
339 MTREES=         mtree/BSD.root.dist             /               \
340                 mtree/BSD.var.dist              /var            \
341                 mtree/BSD.usr.dist              /usr            \
342                 mtree/BSD.include.dist          /usr/include    \
343                 mtree/BSD.debug.dist            /usr/lib
344 .if ${MK_GROFF} != "no"
345 MTREES+=        mtree/BSD.groff.dist            /usr
346 .endif
347 .if ${MK_TESTS} != "no"
348 MTREES+=        mtree/BSD.tests.dist            ${TESTSBASE}
349 .endif
350 .if ${MK_SENDMAIL} != "no"
351 MTREES+=        mtree/BSD.sendmail.dist         /
352 .endif
353 .for mtree in ${LOCAL_MTREE}
354 MTREES+=        ../${mtree}                     /
355 .endfor
356
357 distrib-dirs: ${MTREES:N/*}
358         @set ${MTREES}; \
359         while test $$# -ge 2; do \
360                 m=${.CURDIR}/$$1; \
361                 shift; \
362                 d=${DESTDIR}$$1; \
363                 shift; \
364                 test -d $$d || mkdir -p $$d; \
365                 ${ECHO} ${MTREE_CMD} -deU ${MTREE_FOLLOWS_SYMLINKS} \
366                     -f $$m -p $$d; \
367                 ${MTREE_CMD} -deU ${MTREE_FOLLOWS_SYMLINKS} -f $$m -p $$d; \
368         done; true
369 .if defined(NO_ROOT)
370         @set ${MTREES}; \
371         while test $$# -ge 2; do \
372                 m=${.CURDIR}/$$1; \
373                 shift; \
374                 d=$$1; \
375                 test "$$d" == "/" && d=""; \
376                 d=${DISTBASE}$$d; \
377                 shift; \
378                 test -d $$d || mkdir -p $$d; \
379                 ${ECHO} "${MTREE_CMD:N-W} -C -f $$m -K uname,gname | " \
380                     "sed s#^\.#.$$d# | ${METALOG.add}" ; \
381                 ${MTREE_CMD:N-W} -C -f $$m -K uname,gname | sed s#^\.#.$$d# | \
382                     ${METALOG.add} ; \
383         done; true
384 .endif
385         ${INSTALL_SYMLINK} usr/src/sys ${DESTDIR}/sys
386 .if ${MK_MAN} != "no"
387         cd ${DESTDIR}${SHAREDIR}/man; \
388         for mandir in man*; do \
389                 ${INSTALL_SYMLINK} ../$$mandir \
390                     ${DESTDIR}${SHAREDIR}/man/en.ISO8859-1/; \
391                 ${INSTALL_SYMLINK} ../$$mandir \
392                     ${DESTDIR}${SHAREDIR}/man/en.UTF-8/; \
393         done
394 .if ${MK_OPENSSL} != "no"
395         cd ${DESTDIR}${SHAREDIR}/openssl/man; \
396         for mandir in man*; do \
397                 ${INSTALL_SYMLINK} ../$$mandir \
398                     ${DESTDIR}${SHAREDIR}/openssl/man/en.ISO8859-1/; \
399         done
400 .endif
401         set - `grep "^[a-zA-Z]" ${.CURDIR}/man.alias`; \
402         while [ $$# -gt 0 ] ; do \
403                 ${INSTALL_SYMLINK} "$$2" "${DESTDIR}${SHAREDIR}/man/$$1"; \
404                 if [ "${MK_OPENSSL}" != "no" ]; then \
405                         ${INSTALL_SYMLINK} "$$2" \
406                             "${DESTDIR}${SHAREDIR}/openssl/man/$$1"; \
407                 fi; \
408                 shift; shift; \
409         done
410 .endif
411 .if ${MK_NLS} != "no"
412         set - `grep "^[a-zA-Z]" ${.CURDIR}/nls.alias`; \
413         while [ $$# -gt 0 ] ; do \
414                 ${INSTALL_SYMLINK} "$$2" "${DESTDIR}${SHAREDIR}/nls/$$1"; \
415                 shift; shift; \
416         done
417 .endif
418
419 etc-examples:
420         cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
421             ${BIN1} ${BIN2} nsmb.conf opieaccess \
422             ${DESTDIR}${SHAREDIR}/examples/etc
423         ${_+_}cd ${.CURDIR}/defaults; ${MAKE} install \
424             DESTDIR=${DESTDIR}${SHAREDIR}/examples
425
426 .include <bsd.prog.mk>