]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - etc/Makefile
Move the text section to the start of the output file, so that when you
[FreeBSD/FreeBSD.git] / etc / Makefile
1 #       from: @(#)Makefile      5.11 (Berkeley) 5/21/91
2 # $FreeBSD$
3
4 .include <src.opts.mk>
5
6 SUBDIR= \
7         newsyslog.conf.d
8
9 .if ${MK_SENDMAIL} != "no"
10 SUBDIR+=sendmail
11 .endif
12
13 .if ${MK_TESTS} != "no"
14 SUBDIR+=tests
15 .endif
16
17 BIN1=   crontab \
18         devd.conf \
19         devfs.conf \
20         ddb.conf \
21         dhclient.conf \
22         disktab \
23         fbtab \
24         gettytab \
25         group \
26         hosts \
27         hosts.allow \
28         hosts.equiv \
29         libalias.conf \
30         libmap.conf \
31         login.access \
32         login.conf \
33         mac.conf \
34         motd \
35         netconfig \
36         network.subr \
37         networks \
38         newsyslog.conf \
39         nsswitch.conf \
40         phones \
41         profile \
42         protocols \
43         rc \
44         rc.bsdextended \
45         rc.firewall \
46         rc.initdiskless \
47         rc.shutdown \
48         rc.subr \
49         remote \
50         rpc \
51         services \
52         shells \
53         sysctl.conf \
54         syslog.conf \
55         termcap.small
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.debug.dist 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
165 PPPCNF= ppp.conf
166
167 .if ${MK_SENDMAIL} == "no"
168 ETCMAIL=mailer.conf aliases
169 .else
170 ETCMAIL=Makefile README mailer.conf access.sample virtusertable.sample \
171         mailertable.sample aliases
172 .endif
173
174 # Special top level files for FreeBSD
175 FREEBSD=COPYRIGHT
176
177 # Sanitize DESTDIR
178 DESTDIR:=       ${DESTDIR:C://*:/:g}
179
180 afterinstall:
181 .if ${MK_MAN} != "no"
182         ${_+_}cd ${.CURDIR}/../share/man; ${MAKE} makedb
183 .endif
184
185 distribute:
186         # Avoid installing tests here; "make distribution" will do this and
187         # correctly place them in the right location.
188         ${_+_}cd ${.CURDIR} ; ${MAKE} MK_TESTS=no install \
189             DESTDIR=${DISTDIR}/${DISTRIBUTION}
190         ${_+_}cd ${.CURDIR} ; ${MAKE} distribution DESTDIR=${DISTDIR}/${DISTRIBUTION}
191
192 .include <bsd.endian.mk>
193 .if ${TARGET_ENDIANNESS} == "1234"
194 CAP_MKDB_ENDIAN?= -l
195 PWD_MKDB_ENDIAN?= -L
196 .elif ${TARGET_ENDIANNESS} == "4321"
197 CAP_MKDB_ENDIAN?= -b
198 PWD_MKDB_ENDIAN?= -B
199 .else
200 CAP_MKDB_ENDIAN?=
201 PWD_MKDB_ENDIAN?=
202 .endif
203
204 .if defined(NO_ROOT)
205 METALOG.add?=   cat -l >> ${METALOG}
206 .endif
207
208 distribution:
209 .if !defined(DESTDIR)
210         @echo "set DESTDIR before running \"make ${.TARGET}\""
211         @false
212 .endif
213         cd ${.CURDIR}; \
214             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
215                 ${BIN1} ${DESTDIR}/etc; \
216             cap_mkdb ${CAP_MKDB_ENDIAN} ${DESTDIR}/etc/login.conf; \
217             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 755 \
218                 ${BIN2} ${DESTDIR}/etc; \
219             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 \
220                 master.passwd nsmb.conf opieaccess ${DESTDIR}/etc;
221 .if ${MK_AT} == "no"
222         sed -i "" -e 's;.*/usr/libexec/atrun;#&;' ${DESTDIR}/etc/crontab
223 .endif
224 .if ${MK_TCSH} == "no"
225         sed -i "" -e 's;/bin/csh;/bin/sh;' ${DESTDIR}/etc/master.passwd
226 .endif
227         pwd_mkdb ${PWD_MKDB_ENDIAN} -i -p -d ${DESTDIR}/etc \
228             ${DESTDIR}/etc/master.passwd
229 .if defined(NO_ROOT)
230         ( \
231                 echo "./etc/login.conf.db type=file mode=0644 uname=root gname=wheel"; \
232                 echo "./etc/passwd type=file mode=0644 uname=root gname=wheel"; \
233                 echo "./etc/pwd.db type=file mode=0644 uname=root gname=wheel"; \
234                 echo "./etc/spwd.db type=file mode=0600 uname=root gname=wheel"; \
235         ) | ${METALOG.add}
236 .endif
237 .if ${MK_AUTOFS} != "no"
238         ${_+_}cd ${.CURDIR}/autofs; ${MAKE} install
239 .endif
240 .if ${MK_BLUETOOTH} != "no"
241         ${_+_}cd ${.CURDIR}/bluetooth; ${MAKE} install
242 .endif
243 .if ${MK_CASPER} != "no"
244         ${_+_}cd ${.CURDIR}/casper; ${MAKE} install
245 .endif
246         ${_+_}cd ${.CURDIR}/defaults; ${MAKE} install
247         ${_+_}cd ${.CURDIR}/devd; ${MAKE} install
248 .if ${MK_DMAGENT} != "no"
249         ${_+_}cd ${.CURDIR}/dma; ${MAKE} install
250 .endif
251         ${_+_}cd ${.CURDIR}/gss; ${MAKE} install
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 ${DESTDIR}/$$d || mkdir -p ${DESTDIR}/$$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}/usr/share/man; \
388         for mandir in man*; do \
389                 ${INSTALL_SYMLINK} ../$$mandir \
390                     ${DESTDIR}/usr/share/man/en.ISO8859-1/; \
391                 ${INSTALL_SYMLINK} ../$$mandir \
392                     ${DESTDIR}/usr/share/man/en.UTF-8/; \
393         done
394 .if ${MK_OPENSSL} != "no"
395         cd ${DESTDIR}/usr/share/openssl/man; \
396         for mandir in man*; do \
397                 ${INSTALL_SYMLINK} ../$$mandir \
398                     ${DESTDIR}/usr/share/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}/usr/share/man/$$1"; \
404                 if [ "${MK_OPENSSL}" != "no" ]; then \
405                         ${INSTALL_SYMLINK} "$$2" \
406                             "${DESTDIR}/usr/share/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}/usr/share/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}/usr/share/examples/etc
423         ${_+_}cd ${.CURDIR}/defaults; ${MAKE} install \
424             DESTDIR=${DESTDIR}/usr/share/examples
425
426 .include <bsd.prog.mk>