]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - etc/Makefile
Update to ELF Tool Chain r3475
[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 SUBDIR= \
11         newsyslog.conf.d
12
13 .if ${MK_SENDMAIL} != "no"
14 SUBDIR+=sendmail
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_FREEBSD_UPDATE} != "no"
90 BIN1+= freebsd-update.conf
91 .endif
92
93 .if ${MK_FTP} != "no"
94 BIN1+= ftpusers
95 .endif
96
97 .if ${MK_INETD} != "no"
98 BIN1+= inetd.conf
99 .endif
100
101 .if ${MK_LOCATE} != "no"
102 BIN1+=  ${.CURDIR}/../usr.bin/locate/locate/locate.rc
103 .endif
104
105 .if ${MK_LPR} != "no"
106 BIN1+=  hosts.lpd printcap
107 .endif
108
109 .if ${MK_MAIL} != "no"
110 BIN1+=  ${.CURDIR}/../usr.bin/mail/misc/mail.rc
111 .endif
112
113 .if ${MK_NTP} != "no"
114 BIN1+=  ntp.conf
115 .endif
116
117 .if ${MK_OPENSSH} != "no"
118 SSH=    ${.CURDIR}/../crypto/openssh/ssh_config \
119         ${.CURDIR}/../crypto/openssh/sshd_config \
120         ${.CURDIR}/../crypto/openssh/moduli
121 .endif
122 .if ${MK_OPENSSL} != "no"
123 SSL=    ${.CURDIR}/../crypto/openssl/apps/openssl.cnf
124 .endif
125
126 .if ${MK_NS_CACHING} != "no"
127 BIN1+= nscd.conf
128 .endif
129
130 .if ${MK_PORTSNAP} != "no"
131 BIN1+= portsnap.conf
132 .endif
133
134 .if ${MK_PF} != "no"
135 BIN1+= pf.os
136 .endif
137
138 .if ${MK_SENDMAIL} != "no"
139 BIN1+=  rc.sendmail
140 .endif
141
142 .if ${MK_TCSH} != "no"
143 BIN1+= csh.cshrc csh.login csh.logout
144 .endif
145
146 .if ${MK_WIRELESS} != "no"
147 BIN1+= regdomain.xml
148 .endif
149
150 # -rwxr-xr-x root:wheel, for the new cron root:wheel
151 BIN2=   netstart pccard_ether rc.suspend rc.resume
152
153 MTREE=  BSD.debug.dist BSD.include.dist BSD.root.dist BSD.usr.dist BSD.var.dist
154 .if ${MK_LIB32} != "no"
155 MTREE+= BSD.lib32.dist
156 .endif
157 .if ${MK_LIBSOFT} != "no"
158 MTREE+= BSD.libsoft.dist
159 .endif
160 .if ${MK_TESTS} != "no"
161 MTREE+= BSD.tests.dist
162 .endif
163 .if ${MK_SENDMAIL} != "no"
164 MTREE+= BSD.sendmail.dist
165 .endif
166
167 PPPCNF= ppp.conf
168
169 .if ${MK_SENDMAIL} == "no"
170 ETCMAIL=mailer.conf aliases
171 .else
172 ETCMAIL=Makefile README mailer.conf access.sample virtusertable.sample \
173         mailertable.sample aliases
174 .endif
175
176 # Special top level files for FreeBSD
177 FREEBSD=COPYRIGHT
178
179 # Sanitize DESTDIR
180 DESTDIR:=       ${DESTDIR:C://*:/:g}
181
182 afterinstall:
183 .if ${MK_MAN} != "no"
184         ${_+_}cd ${.CURDIR}/../share/man; ${MAKE} makedb
185 .endif
186
187 distribute:
188         # Avoid installing tests here; "make distribution" will do this and
189         # correctly place them in the right location.
190         ${_+_}cd ${.CURDIR} ; ${MAKE} MK_TESTS=no install \
191             DESTDIR=${DISTDIR}/${DISTRIBUTION}
192         ${_+_}cd ${.CURDIR} ; ${MAKE} distribution DESTDIR=${DISTDIR}/${DISTRIBUTION}
193
194 .include <bsd.endian.mk>
195 .if ${TARGET_ENDIANNESS} == "1234"
196 CAP_MKDB_ENDIAN?= -l
197 .elif ${TARGET_ENDIANNESS} == "4321"
198 CAP_MKDB_ENDIAN?= -b
199 .else
200 CAP_MKDB_ENDIAN?=
201 .endif
202
203 .if defined(NO_ROOT)
204 METALOG.add?=   cat -l >> ${METALOG}
205 .endif
206
207 distribution:
208 .if !defined(DESTDIR)
209         @echo "set DESTDIR before running \"make ${.TARGET}\""
210         @false
211 .endif
212         cd ${.CURDIR}; \
213             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
214                 ${BIN1} ${DESTDIR}/etc; \
215             cap_mkdb ${CAP_MKDB_ENDIAN} ${DESTDIR}/etc/login.conf; \
216             services_mkdb ${CAP_MKDB_ENDIAN} -q -o ${DESTDIR}/var/db/services.db \
217                 ${DESTDIR}/etc/services; \
218             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 755 \
219                 ${BIN2} ${DESTDIR}/etc; \
220             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 \
221                 master.passwd nsmb.conf opieaccess ${DESTDIR}/etc;
222 .if ${MK_BSNMP} != "no"
223         cd ${.CURDIR}; \
224             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 \
225                 snmpd.config ${DESTDIR}/etc;
226 .endif
227 .if ${MK_AT} == "no"
228         sed -i "" -e 's;.*/usr/libexec/atrun;#&;' ${DESTDIR}/etc/crontab
229 .endif
230 .if ${MK_TCSH} == "no"
231         sed -i "" -e 's;/bin/csh;/bin/sh;' ${DESTDIR}/etc/master.passwd
232 .endif
233         pwd_mkdb -i -p -d ${DESTDIR}/etc ${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 .if ${MK_CASPER} != "no"
249         ${_+_}cd ${.CURDIR}/casper; ${MAKE} install
250 .endif
251         ${_+_}cd ${.CURDIR}/defaults; ${MAKE} install
252         ${_+_}cd ${.CURDIR}/devd; ${MAKE} install
253         ${_+_}cd ${.CURDIR}/gss; ${MAKE} install
254 .if ${MK_NTP} != "no"
255         ${_+_}cd ${.CURDIR}/ntp; ${MAKE} install
256 .endif
257         ${_+_}cd ${.CURDIR}/periodic; ${MAKE} install
258 .if ${MK_PKGBOOTSTRAP} != "no"
259         ${_+_}cd ${.CURDIR}/pkg; ${MAKE} install
260 .endif
261         ${_+_}cd ${.CURDIR}/rc.d; ${MAKE} install
262         ${_+_}cd ${.CURDIR}/../share/termcap; ${MAKE} etc-termcap
263         ${_+_}cd ${.CURDIR}/../usr.sbin/rmt; ${MAKE} etc-rmt
264         ${_+_}cd ${.CURDIR}/pam.d; ${MAKE} install
265         cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 0444 \
266             ${BSM_ETC_OPEN_FILES} ${BSM_ETC_DIR}
267         cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 0600 \
268             ${BSM_ETC_RESTRICTED_FILES} ${BSM_ETC_DIR}
269         cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 0500 \
270             ${BSM_ETC_EXEC_FILES} ${BSM_ETC_DIR}
271 .if ${MK_UNBOUND} != "no"
272         if [ ! -e ${DESTDIR}/etc/unbound ]; then \
273                 ${INSTALL_SYMLINK} ../var/unbound ${DESTDIR}/etc/unbound; \
274         fi
275 .endif
276 .if ${MK_SENDMAIL} != "no"
277         ${_+_}cd ${.CURDIR}/sendmail; ${MAKE} distribution
278 .endif
279 .if ${MK_OPENSSH} != "no"
280         cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
281             ${SSH} ${DESTDIR}/etc/ssh
282 .endif
283 .if ${MK_OPENSSL} != "no"
284         cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
285             ${SSL} ${DESTDIR}/etc/ssl
286 .endif
287 .if ${MK_KERBEROS} != "no"
288         cd ${.CURDIR}/root; \
289             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
290                 dot.k5login ${DESTDIR}/root/.k5login;
291 .endif
292         cd ${.CURDIR}/root; \
293             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
294                 dot.profile ${DESTDIR}/root/.profile; \
295             rm -f ${DESTDIR}/.profile; \
296             ln ${DESTDIR}/root/.profile ${DESTDIR}/.profile
297 .if ${MK_TCSH} != "no"
298         cd ${.CURDIR}/root; \
299             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
300                 dot.cshrc ${DESTDIR}/root/.cshrc; \
301             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
302                 dot.login ${DESTDIR}/root/.login; \
303             rm -f ${DESTDIR}/.cshrc; \
304             ln ${DESTDIR}/root/.cshrc ${DESTDIR}/.cshrc
305 .endif
306         cd ${.CURDIR}/mtree; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
307             ${MTREE} ${DESTDIR}/etc/mtree
308 .if ${MK_MAIL} != "no"
309         cd ${.CURDIR}/mail; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
310             ${ETCMAIL} ${DESTDIR}/etc/mail
311         if [ -d ${DESTDIR}/etc/mail -a -f ${DESTDIR}/etc/mail/aliases -a \
312               ! -f ${DESTDIR}/etc/aliases ]; then \
313                 ln -s mail/aliases ${DESTDIR}/etc/aliases; \
314         fi
315 .endif
316         ${INSTALL} -o ${BINOWN} -g operator -m 664 /dev/null \
317             ${DESTDIR}/etc/dumpdates
318 .if ${MK_LOCATE} != "no"
319         ${INSTALL} -o nobody -g ${BINGRP} -m 644 /dev/null \
320             ${DESTDIR}/var/db/locate.database
321 .endif
322         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 ${.CURDIR}/minfree \
323             ${DESTDIR}/var/crash
324         cd ${.CURDIR}/..; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
325                 ${FREEBSD} ${DESTDIR}/
326 .if ${MK_BOOT} != "no"
327 .if exists(${.CURDIR}/../sys/${MACHINE}/conf/GENERIC.hints)
328         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
329             ${.CURDIR}/../sys/${MACHINE}/conf/GENERIC.hints \
330             ${DESTDIR}/boot/device.hints
331 .endif
332 .endif
333 .if ${MK_NIS} == "no"
334         sed -i "" -e 's/.*_compat:/# &/' -e 's/compat$$/files/' \
335                 ${DESTDIR}/etc/nsswitch.conf
336 .endif
337
338 MTREE_CMD?=     mtree
339
340 .if ${MK_INSTALL_AS_USER} == "yes" && ${_uid} != 0
341 MTREE_FILTER= sed -e 's,\([gu]\)name=,\1id=,g' \
342         -e 's,\(uid=\)[^ ]* ,\1${_uid} ,' \
343         -e 's,\(gid=\)[^ ]* ,\1${_gid} ,' \
344         -e 's,\(uid=\)[^ ]*$$,\1${_uid},' \
345         -e 's,\(gid=\)[^ ]*$$,\1${_gid},' 
346 .else
347 MTREE_FILTER= cat
348 .if !defined(NO_FSCHG)
349 MTREE_FSCHG=    -i
350 .endif
351 .endif
352
353 MTREES=         mtree/BSD.root.dist             /               \
354                 mtree/BSD.var.dist              /var            \
355                 mtree/BSD.usr.dist              /usr            \
356                 mtree/BSD.include.dist          /usr/include    \
357                 mtree/BSD.debug.dist            /usr/lib
358 .if ${MK_GROFF} != "no"
359 MTREES+=        mtree/BSD.groff.dist            /usr
360 .endif
361 .if ${MK_LIB32} != "no"
362 MTREES+=        mtree/BSD.lib32.dist            /usr
363 MTREES+=        mtree/BSD.lib32.dist            /usr/lib/debug/usr
364 .endif
365 .if ${MK_LIBSOFT} != "no"
366 MTREES+=        mtree/BSD.libsoft.dist          /usr
367 MTREES+=        mtree/BSD.libsoft.dist          /usr/lib/debug/usr
368 .endif
369 .if ${MK_TESTS} != "no"
370 MTREES+=        mtree/BSD.tests.dist            ${TESTSBASE}
371 MTREES+=        mtree/BSD.tests.dist            /usr/lib/debug/${TESTSBASE}
372 .endif
373 .if ${MK_SENDMAIL} != "no"
374 MTREES+=        mtree/BSD.sendmail.dist         /
375 .endif
376 .for mtree in ${LOCAL_MTREE}
377 MTREES+=        ../${mtree}                     /
378 .endfor
379
380 # Clean up some directories that where mistakenly created as files that
381 # should not have been as part of the nvi update in r281994.
382 # This should be removed after 11.0-RELEASE.
383 DISTRIB_CLEANUP_SHARE_FILES=    ${SHAREDIR}/doc/usd/10.exref ${SHAREDIR}/doc/usd/11.edit
384 DISTRIB_CLEANUP_SHARE_FILES+=   ${SHAREDIR}/doc/usd/12.vi ${SHAREDIR}/doc/usd/13.viref
385 distrib-cleanup: .PHONY
386         for file in ${DISTRIB_CLEANUP_SHARE_FILES}; do \
387                 if [ -f ${DESTDIR}/$${file} ]; then \
388                         rm -f ${DESTDIR}/$${file}; \
389                 fi; \
390         done
391
392 distrib-dirs: ${MTREES:N/*} distrib-cleanup .PHONY
393         @set ${MTREES}; \
394         while test $$# -ge 2; do \
395                 m=${.CURDIR}/$$1; \
396                 shift; \
397                 d=${DESTDIR}$$1; \
398                 shift; \
399                 test -d $$d || mkdir -p $$d; \
400                 ${ECHO} ${MTREE_CMD} -deU ${MTREE_FSCHG} \
401                     ${MTREE_FOLLOWS_SYMLINKS} -f $$m -p $$d; \
402                 ${MTREE_FILTER} $$m | \
403                 ${MTREE_CMD} -deU ${MTREE_FSCHG} ${MTREE_FOLLOWS_SYMLINKS} \
404                     -p $$d; \
405         done; true
406 .if defined(NO_ROOT)
407         @set ${MTREES}; \
408         while test $$# -ge 2; do \
409                 m=${.CURDIR}/$$1; \
410                 shift; \
411                 d=$$1; \
412                 test "$$d" == "/" && d=""; \
413                 d=${DISTBASE}$$d; \
414                 shift; \
415                 test -d ${DESTDIR}/$$d || mkdir -p ${DESTDIR}/$$d; \
416                 ${ECHO} "${MTREE_CMD:N-W} -C -f $$m -K uname,gname | " \
417                     "sed s#^\.#.$$d# | ${METALOG.add}" ; \
418                 ${MTREE_FILTER} $$m | \
419                 ${MTREE_CMD:N-W} -C -K uname,gname | sed s#^\.#.$$d# | \
420                     ${METALOG.add} ; \
421         done; true
422 .endif
423         ${INSTALL_SYMLINK} usr/src/sys ${DESTDIR}/sys
424 .if ${MK_MAN} != "no"
425         cd ${DESTDIR}${SHAREDIR}/man; \
426         for mandir in man*; do \
427                 ${INSTALL_SYMLINK} ../$$mandir \
428                     ${DESTDIR}${SHAREDIR}/man/en.ISO8859-1/; \
429                 ${INSTALL_SYMLINK} ../$$mandir \
430                     ${DESTDIR}${SHAREDIR}/man/en.UTF-8/; \
431         done
432 .if ${MK_OPENSSL} != "no"
433         cd ${DESTDIR}${SHAREDIR}/openssl/man; \
434         for mandir in man*; do \
435                 ${INSTALL_SYMLINK} ../$$mandir \
436                     ${DESTDIR}${SHAREDIR}/openssl/man/en.ISO8859-1/; \
437         done
438 .endif
439         set - `grep "^[a-zA-Z]" ${.CURDIR}/man.alias`; \
440         while [ $$# -gt 0 ] ; do \
441                 ${INSTALL_SYMLINK} "$$2" "${DESTDIR}${SHAREDIR}/man/$$1"; \
442                 if [ "${MK_OPENSSL}" != "no" ]; then \
443                         ${INSTALL_SYMLINK} "$$2" \
444                             "${DESTDIR}${SHAREDIR}/openssl/man/$$1"; \
445                 fi; \
446                 shift; shift; \
447         done
448 .endif
449 .if ${MK_NLS} != "no"
450         set - `grep "^[a-zA-Z]" ${.CURDIR}/nls.alias`; \
451         while [ $$# -gt 0 ] ; do \
452                 ${INSTALL_SYMLINK} "$$2" "${DESTDIR}${SHAREDIR}/nls/$$1"; \
453                 shift; shift; \
454         done
455 .endif
456
457 etc-examples-install: ${META_DEPS}
458         cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
459             ${BIN1} ${BIN2} nsmb.conf opieaccess \
460             ${DESTDIR}${SHAREDIR}/examples/etc
461
462 etc-examples: etc-examples-install
463         ${_+_}cd ${.CURDIR}/defaults; \
464             ${MAKE} ${${MK_STAGING} == "yes":?all:install} \
465             DESTDIR=${DESTDIR}${SHAREDIR}/examples
466
467 .include <bsd.prog.mk>