]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/blob - etc/Makefile
Set up the /usr/tests hierarchy.
[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 .if ${MK_SENDMAIL} != "no"
7 SUBDIR= sendmail
8 .endif
9
10 BIN1=   crontab \
11         devd.conf \
12         devfs.conf \
13         ddb.conf \
14         dhclient.conf \
15         disktab \
16         fbtab \
17         ftpusers \
18         gettytab \
19         group \
20         hosts \
21         hosts.allow \
22         hosts.equiv \
23         inetd.conf \
24         libalias.conf \
25         libmap.conf \
26         login.access \
27         login.conf \
28         mac.conf \
29         motd \
30         netconfig \
31         network.subr \
32         networks \
33         newsyslog.conf \
34         nsswitch.conf \
35         phones \
36         profile \
37         protocols \
38         rc \
39         rc.bsdextended \
40         rc.firewall \
41         rc.initdiskless \
42         rc.sendmail \
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_BSNMP} != "no"
86 BIN1+= snmpd.config
87 .endif
88
89 .if ${MK_FREEBSD_UPDATE} != "no"
90 BIN1+= freebsd-update.conf
91 .endif
92
93 .if ${MK_LOCATE} != "no"
94 BIN1+=  ${.CURDIR}/../usr.bin/locate/locate/locate.rc
95 .endif
96
97 .if ${MK_LPR} != "no"
98 BIN1+=  hosts.lpd printcap
99 .endif
100
101 .if ${MK_MAIL} != "no"
102 BIN1+=  ${.CURDIR}/../usr.bin/mail/misc/mail.rc
103 .endif
104
105 .if ${MK_NTP} != "no"
106 BIN1+=  ntp.conf
107 .endif
108
109 .if ${MK_OPENSSH} != "no"
110 SSH=    ${.CURDIR}/../crypto/openssh/ssh_config \
111         ${.CURDIR}/../crypto/openssh/sshd_config \
112         ${.CURDIR}/../crypto/openssh/moduli
113 .endif
114 .if ${MK_OPENSSL} != "no"
115 SSL=    ${.CURDIR}/../crypto/openssl/apps/openssl.cnf
116 .endif
117
118 .if ${MK_NS_CACHING} != "no"
119 BIN1+= nscd.conf
120 .endif
121
122 .if ${MK_PORTSNAP} != "no"
123 BIN1+= portsnap.conf
124 .endif
125
126 .if ${MK_PF} != "no"
127 BIN1+= pf.os
128 .endif
129
130 .if ${MK_TCSH} != "no"
131 BIN1+= csh.cshrc csh.login csh.logout
132 .endif
133
134 .if ${MK_WIRELESS} != "no"
135 BIN1+= regdomain.xml
136 .endif
137
138 # -rwxr-xr-x root:wheel, for the new cron root:wheel
139 BIN2=   netstart pccard_ether rc.suspend rc.resume
140
141 MTREE=  BSD.include.dist BSD.root.dist BSD.usr.dist BSD.var.dist
142 .if ${MK_TESTS} != "no"
143 MTREE+= BSD.tests.dist
144 .endif
145 .if ${MK_SENDMAIL} != "no"
146 MTREE+= BSD.sendmail.dist
147 .endif
148 .if ${MK_DEBUG_FILES} != "no"
149 MTREE+= BSD.debug.dist
150 .endif
151
152 PPPCNF= ppp.conf
153
154 .if ${MK_SENDMAIL} == "no"
155 ETCMAIL=mailer.conf aliases
156 .else
157 ETCMAIL=Makefile README mailer.conf access.sample virtusertable.sample \
158         mailertable.sample aliases
159 .endif
160
161 # Special top level files for FreeBSD
162 FREEBSD=COPYRIGHT
163
164 # Sanitize DESTDIR
165 DESTDIR:=       ${DESTDIR:C://*:/:g}
166
167 afterinstall:
168 .if ${MK_MAN} != "no"
169         ${_+_}cd ${.CURDIR}/../share/man; ${MAKE} makedb
170 .endif
171
172 distribute:
173         ${_+_}cd ${.CURDIR} ; ${MAKE} install DESTDIR=${DISTDIR}/${DISTRIBUTION}
174         ${_+_}cd ${.CURDIR} ; ${MAKE} distribution DESTDIR=${DISTDIR}/${DISTRIBUTION}
175
176 .include <bsd.endian.mk>
177 .if ${TARGET_ENDIANNESS} == "1234"
178 CAP_MKDB_ENDIAN?= -l
179 PWD_MKDB_ENDIAN?= -L
180 .elif ${TARGET_ENDIANNESS} == "4321"
181 CAP_MKDB_ENDIAN?= -b
182 PWD_MKDB_ENDIAN?= -B
183 .else
184 CAP_MKDB_ENDIAN?=
185 PWD_MKDB_ENDIAN?=
186 .endif
187
188 .if defined(NO_ROOT)
189 METALOG.add?=   cat -l >> ${METALOG}
190 .endif
191
192 distribution:
193 .if !defined(DESTDIR)
194         @echo "set DESTDIR before running \"make ${.TARGET}\""
195         @false
196 .endif
197         cd ${.CURDIR}; \
198             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
199                 ${BIN1} ${DESTDIR}/etc; \
200             cap_mkdb ${CAP_MKDB_ENDIAN} ${DESTDIR}/etc/login.conf; \
201             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 755 \
202                 ${BIN2} ${DESTDIR}/etc; \
203             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 \
204                 master.passwd nsmb.conf opieaccess ${DESTDIR}/etc;
205 .if ${MK_AT} == "no"
206         sed -i "" -e 's;.*/usr/libexec/atrun;#&;' ${DESTDIR}/etc/crontab
207 .endif
208 .if ${MK_TCSH} == "no"
209         sed -i "" -e 's;/bin/csh;/bin/sh;' ${DESTDIR}/etc/master.passwd
210 .endif
211         pwd_mkdb ${PWD_MKDB_ENDIAN} -i -p -d ${DESTDIR}/etc \
212             ${DESTDIR}/etc/master.passwd
213 .if defined(NO_ROOT)
214         ( \
215                 echo "./etc/login.conf.db type=file mode=0644 uname=root gname=wheel"; \
216                 echo "./etc/passwd type=file mode=0644 uname=root gname=wheel"; \
217                 echo "./etc/pwd.db type=file mode=0644 uname=root gname=wheel"; \
218                 echo "./etc/spwd.db type=file mode=0600 uname=root gname=wheel"; \
219         ) | ${METALOG.add}
220 .endif
221 .if ${MK_BLUETOOTH} != "no"
222         ${_+_}cd ${.CURDIR}/bluetooth; ${MAKE} install
223 .endif
224         ${_+_}cd ${.CURDIR}/defaults; ${MAKE} install
225         ${_+_}cd ${.CURDIR}/devd; ${MAKE} install
226         ${_+_}cd ${.CURDIR}/gss; ${MAKE} install
227         ${_+_}cd ${.CURDIR}/periodic; ${MAKE} install
228 .if ${MK_PKGBOOTSTRAP} != "no"
229         ${_+_}cd ${.CURDIR}/pkg; ${MAKE} install
230 .endif
231         ${_+_}cd ${.CURDIR}/rc.d; ${MAKE} install
232         ${_+_}cd ${.CURDIR}/../gnu/usr.bin/send-pr; ${MAKE} etc-gnats-freefall
233         ${_+_}cd ${.CURDIR}/../share/termcap; ${MAKE} etc-termcap
234         ${_+_}cd ${.CURDIR}/../usr.sbin/rmt; ${MAKE} etc-rmt
235         ${_+_}cd ${.CURDIR}/pam.d; ${MAKE} install
236         cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 0444 \
237             ${BSM_ETC_OPEN_FILES} ${BSM_ETC_DIR}
238         cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 0600 \
239             ${BSM_ETC_RESTRICTED_FILES} ${BSM_ETC_DIR}
240         cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 0500 \
241             ${BSM_ETC_EXEC_FILES} ${BSM_ETC_DIR}
242 .if ${MK_UNBOUND} != "no"
243         if [ ! -e ${DESTDIR}/etc/unbound ]; then \
244                 ${INSTALL_SYMLINK} ../var/unbound ${DESTDIR}/etc/unbound; \
245         fi
246 .endif
247 .if ${MK_SENDMAIL} != "no"
248         ${_+_}cd ${.CURDIR}/sendmail; ${MAKE} distribution
249 .endif
250 .if ${MK_OPENSSH} != "no"
251         cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
252             ${SSH} ${DESTDIR}/etc/ssh
253 .endif
254 .if ${MK_OPENSSL} != "no"
255         cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
256             ${SSL} ${DESTDIR}/etc/ssl
257 .endif
258 .if ${MK_KERBEROS} != "no"
259         cd ${.CURDIR}/root; \
260             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
261                 dot.k5login ${DESTDIR}/root/.k5login;
262 .endif
263         cd ${.CURDIR}/root; \
264             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
265                 dot.profile ${DESTDIR}/root/.profile; \
266             rm -f ${DESTDIR}/.profile; \
267             ln ${DESTDIR}/root/.profile ${DESTDIR}/.profile
268 .if ${MK_TCSH} != "no"
269         cd ${.CURDIR}/root; \
270             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
271                 dot.cshrc ${DESTDIR}/root/.cshrc; \
272             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
273                 dot.login ${DESTDIR}/root/.login; \
274             rm -f ${DESTDIR}/.cshrc; \
275             ln ${DESTDIR}/root/.cshrc ${DESTDIR}/.cshrc
276 .endif
277         cd ${.CURDIR}/mtree; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
278             ${MTREE} ${DESTDIR}/etc/mtree
279 .if ${MK_PPP} != "no"
280         cd ${.CURDIR}/ppp; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 \
281             ${PPPCNF} ${DESTDIR}/etc/ppp
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         ${INSTALL} -o nobody -g ${BINGRP} -m 644 /dev/null \
294             ${DESTDIR}/var/db/locate.database
295         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 ${.CURDIR}/minfree \
296             ${DESTDIR}/var/crash
297         cd ${.CURDIR}/..; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
298                 ${FREEBSD} ${DESTDIR}/
299 .if ${MK_BOOT} != "no"
300 .if exists(${.CURDIR}/../sys/${MACHINE}/conf/GENERIC.hints)
301         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
302             ${.CURDIR}/../sys/${MACHINE}/conf/GENERIC.hints \
303             ${DESTDIR}/boot/device.hints
304 .endif
305 .endif
306 .if ${MK_NIS} == "no"
307         sed -i "" -e 's/.*_compat:/# &/' -e 's/compat$$/files/' \
308                 ${DESTDIR}/etc/nsswitch.conf
309 .endif
310
311 MTREE_CMD?=     mtree
312
313 MTREES=         mtree/BSD.root.dist             /               \
314                 mtree/BSD.var.dist              /var            \
315                 mtree/BSD.usr.dist              /usr            \
316                 mtree/BSD.include.dist          /usr/include
317 .if ${MK_DEBUG_FILES} != "no"
318 MTREES+=        mtree/BSD.debug.dist            /usr/lib
319 .endif
320 .if ${MK_GROFF} != "no"
321 MTREES+=        mtree/BSD.groff.dist            /usr
322 .endif
323 .if ${MK_TESTS} != "no"
324 MTREES+=        mtree/BSD.tests.dist            ${TESTSBASE}
325 .endif
326 .if ${MK_SENDMAIL} != "no"
327 MTREES+=        mtree/BSD.sendmail.dist         /
328 .endif
329 .for mtree in ${LOCAL_MTREE}
330 MTREES+=        ../${mtree}                     /
331 .endfor
332
333 distrib-dirs: ${MTREES:N/*}
334         @set ${MTREES}; \
335         while test $$# -ge 2; do \
336                 m=${.CURDIR}/$$1; \
337                 shift; \
338                 d=${DESTDIR}$$1; \
339                 shift; \
340                 ${ECHO} ${MTREE_CMD} -deU ${MTREE_FOLLOWS_SYMLINKS} \
341                     -f $$m -p $$d; \
342                 ${MTREE_CMD} -deU ${MTREE_FOLLOWS_SYMLINKS} -f $$m -p $$d; \
343         done; true
344 .if defined(NO_ROOT)
345         @set ${MTREES}; \
346         while test $$# -ge 2; do \
347                 m=${.CURDIR}/$$1; \
348                 shift; \
349                 d=$$1; \
350                 test "$$d" == "/" && d=""; \
351                 d=${DISTBASE}$$d; \
352                 shift; \
353                 ${ECHO} "${MTREE_CMD:N-W} -C -f $$m -K uname,gname | " \
354                     "sed s#^\.#.$$d# | ${METALOG.add}" ; \
355                 ${MTREE_CMD:N-W} -C -f $$m -K uname,gname | sed s#^\.#.$$d# | \
356                     ${METALOG.add} ; \
357         done; true
358 .endif
359         ${INSTALL_SYMLINK} usr/src/sys ${DESTDIR}/sys
360         cd ${DESTDIR}/usr/share/man; \
361         for mandir in man*; do \
362                 ${INSTALL_SYMLINK} ../$$mandir \
363                     ${DESTDIR}/usr/share/man/en.ISO8859-1/; \
364                 ${INSTALL_SYMLINK} ../$$mandir \
365                     ${DESTDIR}/usr/share/man/en.UTF-8/; \
366         done
367         cd ${DESTDIR}/usr/share/openssl/man; \
368         for mandir in man*; do \
369                 ${INSTALL_SYMLINK} ../$$mandir \
370                     ${DESTDIR}/usr/share/openssl/man/en.ISO8859-1/; \
371         done
372         set - `grep "^[a-zA-Z]" ${.CURDIR}/man.alias`; \
373         while [ $$# -gt 0 ] ; do \
374                 ${INSTALL_SYMLINK} "$$2" "${DESTDIR}/usr/share/man/$$1"; \
375                 ${INSTALL_SYMLINK} "$$2" \
376                     "${DESTDIR}/usr/share/openssl/man/$$1"; \
377                 shift; shift; \
378         done
379         set - `grep "^[a-zA-Z]" ${.CURDIR}/nls.alias`; \
380         while [ $$# -gt 0 ] ; do \
381                 ${INSTALL_SYMLINK} "$$2" "${DESTDIR}/usr/share/nls/$$1"; \
382                 shift; shift; \
383         done
384
385 etc-examples:
386         cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
387             ${BIN1} ${BIN2} nsmb.conf opieaccess \
388             ${DESTDIR}/usr/share/examples/etc
389         ${_+_}cd ${.CURDIR}/defaults; ${MAKE} install \
390             DESTDIR=${DESTDIR}/usr/share/examples
391
392 .include <bsd.prog.mk>