]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - etc/Makefile
MFV r338866: 9700 ZFS resilvered mirror does not balance reads
[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
11 .if ${MK_SENDMAIL} != "no"
12 SUBDIR+=sendmail
13 .endif
14
15 BIN1=   \
16         group \
17         hosts.allow \
18         login.access \
19         rc.bsdextended \
20         rc.firewall \
21         termcap.small
22
23 # NB: keep these sorted by MK_* knobs
24
25 .if ${MK_SENDMAIL} != "no"
26 BIN1+=  rc.sendmail
27 .endif
28
29 .if ${MK_SENDMAIL} == "no"
30 ETCMAIL=mailer.conf aliases
31 .else
32 ETCMAIL=Makefile README mailer.conf access.sample virtusertable.sample \
33         mailertable.sample aliases
34 .endif
35
36 # Special top level files for FreeBSD
37 FREEBSD=COPYRIGHT
38
39 # Sanitize DESTDIR
40 DESTDIR:=       ${DESTDIR:C://*:/:g}
41
42 afterinstall:
43 .if ${MK_MAN} != "no"
44         ${_+_}cd ${SRCTOP}/share/man; ${MAKE} makedb
45 .endif
46
47 distribute:
48         # Avoid installing tests here; "make distribution" will do this and
49         # correctly place them in the right location.
50         ${_+_}cd ${.CURDIR} ; ${MAKE} MK_TESTS=no install \
51             DESTDIR=${DISTDIR}/${DISTRIBUTION}
52         ${_+_}cd ${.CURDIR} ; ${MAKE} distribution DESTDIR=${DISTDIR}/${DISTRIBUTION}
53
54 .include <bsd.endian.mk>
55
56 .if defined(NO_ROOT)
57 METALOG.add?=   cat -l >> ${METALOG}
58 .endif
59
60 distribution:
61 .if !defined(DESTDIR)
62         @echo "set DESTDIR before running \"make ${.TARGET}\""
63         @false
64 .endif
65         cd ${.CURDIR}; \
66             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
67                 ${BIN1} ${DESTDIR}/etc; \
68             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 \
69                 master.passwd ${DESTDIR}/etc;
70
71 .if ${MK_TCSH} == "no"
72         sed -i "" -e 's;/bin/csh;/bin/sh;' ${DESTDIR}/etc/master.passwd
73 .endif
74         pwd_mkdb -i -p -d ${DESTDIR}/etc ${DESTDIR}/etc/master.passwd
75 .if defined(NO_ROOT)
76         ( \
77                 echo "./etc/passwd type=file mode=0644 uname=root gname=wheel"; \
78                 echo "./etc/pwd.db type=file mode=0644 uname=root gname=wheel"; \
79                 echo "./etc/spwd.db type=file mode=0600 uname=root gname=wheel"; \
80         ) | ${METALOG.add}
81 .endif
82         ${_+_}cd ${.CURDIR}/gss; ${MAKE} install
83         ${_+_}cd ${.CURDIR}/mtree; ${MAKE} install
84         ${_+_}cd ${SRCTOP}/share/termcap; ${MAKE} etc-termcap
85         ${_+_}cd ${SRCTOP}/usr.sbin/rmt; ${MAKE} etc-rmt
86 .if ${MK_UNBOUND} != "no"
87         if [ ! -e ${DESTDIR}/etc/unbound ]; then \
88                 ${INSTALL_SYMLINK} ../var/unbound ${DESTDIR}/etc/unbound; \
89         fi
90 .endif
91 .if ${MK_SENDMAIL} != "no"
92         ${_+_}cd ${.CURDIR}/sendmail; ${MAKE} distribution
93 .endif
94 .if ${MK_KERBEROS} != "no"
95         cd ${.CURDIR}/root; \
96             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
97                 dot.k5login ${DESTDIR}/root/.k5login;
98 .endif
99
100 .if ${MK_MAIL} != "no"
101         cd ${.CURDIR}/mail; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
102             ${ETCMAIL} ${DESTDIR}/etc/mail
103         if [ -d ${DESTDIR}/etc/mail -a -f ${DESTDIR}/etc/mail/aliases -a \
104               ! -f ${DESTDIR}/etc/aliases ]; then \
105                 ${INSTALL_SYMLINK} mail/aliases ${DESTDIR}/etc/aliases; \
106         fi
107 .endif
108 .if ${MK_LOCATE} != "no"
109         ${INSTALL} -o nobody -g ${BINGRP} -m 644 /dev/null \
110             ${DESTDIR}/var/db/locate.database
111 .endif
112         cd ${.CURDIR}/..; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
113                 ${FREEBSD} ${DESTDIR}/
114 .if ${MK_BOOT} != "no"
115 .if exists(${SRCTOP}/sys/${MACHINE}/conf/GENERIC.hints)
116         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
117             ${SRCTOP}/sys/${MACHINE}/conf/GENERIC.hints \
118             ${DESTDIR}/boot/device.hints
119 .endif
120 .endif
121
122 MTREE_CMD?=     mtree
123
124 MTREES=         mtree/BSD.root.dist             /               \
125                 mtree/BSD.var.dist              /var            \
126                 mtree/BSD.usr.dist              /usr            \
127                 mtree/BSD.include.dist          /usr/include    \
128                 mtree/BSD.debug.dist            /usr/lib
129 .if ${MK_LIB32} != "no"
130 MTREES+=        mtree/BSD.lib32.dist            /usr
131 MTREES+=        mtree/BSD.lib32.dist            /usr/lib/debug/usr
132 .endif
133 .if ${MK_LIBSOFT} != "no"
134 MTREES+=        mtree/BSD.libsoft.dist          /usr
135 MTREES+=        mtree/BSD.libsoft.dist          /usr/lib/debug/usr
136 .endif
137 .if ${MK_TESTS} != "no"
138 MTREES+=        mtree/BSD.tests.dist            ${TESTSBASE}
139 MTREES+=        mtree/BSD.tests.dist            /usr/lib/debug/${TESTSBASE}
140 .endif
141 .if ${MK_SENDMAIL} != "no"
142 MTREES+=        mtree/BSD.sendmail.dist         /
143 .endif
144 .for mtree in ${LOCAL_MTREE}
145 MTREES+=        ../${mtree}                     /
146 .endfor
147
148 # Clean up some directories that where mistakenly created as files that
149 # should not have been as part of the nvi update in r281994.
150 # This should be removed after 11.0-RELEASE.
151 DISTRIB_CLEANUP_SHARE_FILES=    ${SHAREDIR}/doc/usd/10.exref ${SHAREDIR}/doc/usd/11.edit
152 DISTRIB_CLEANUP_SHARE_FILES+=   ${SHAREDIR}/doc/usd/12.vi ${SHAREDIR}/doc/usd/13.viref
153 distrib-cleanup: .PHONY
154         for file in ${DISTRIB_CLEANUP_SHARE_FILES}; do \
155                 if [ -f ${DESTDIR}/$${file} ]; then \
156                         rm -f ${DESTDIR}/$${file}; \
157                 fi; \
158         done
159
160 distrib-dirs: ${MTREES:N/*} distrib-cleanup .PHONY
161         @set ${MTREES}; \
162         while test $$# -ge 2; do \
163                 m=${.CURDIR}/$$1; \
164                 shift; \
165                 d=${DESTDIR}$$1; \
166                 shift; \
167                 test -d $$d || mkdir -p $$d; \
168                 ${ECHO} ${MTREE_CMD} -deU ${MTREE_FSCHG} \
169                     ${MTREE_FOLLOWS_SYMLINKS} -f $$m -p $$d; \
170                 ${MTREE_FILTER} $$m | \
171                 ${MTREE_CMD} -deU ${MTREE_FSCHG} ${MTREE_FOLLOWS_SYMLINKS} \
172                     -p $$d; \
173         done; true
174 .if defined(NO_ROOT)
175         @set ${MTREES}; \
176         while test $$# -ge 2; do \
177                 m=${.CURDIR}/$$1; \
178                 shift; \
179                 d=$$1; \
180                 test "$$d" == "/" && d=""; \
181                 d=${DISTBASE}$$d; \
182                 shift; \
183                 test -d ${DESTDIR}/$$d || mkdir -p ${DESTDIR}/$$d; \
184                 ${ECHO} "${MTREE_CMD:N-W} -C -f $$m -K all | " \
185                     "sed s#^\.#.$$d# | ${METALOG.add}" ; \
186                 ${MTREE_FILTER} $$m | \
187                 ${MTREE_CMD:N-W} -C -K all | sed s#^\.#.$$d# | \
188                     ${METALOG.add} ; \
189         done; true
190 .endif
191 .if ${MK_NLS} != "no"
192         set - `grep "^[a-zA-Z]" ${.CURDIR}/nls.alias`; \
193         while [ $$# -gt 0 ] ; do \
194                 ${INSTALL_SYMLINK} "$$2" "${DESTDIR}${SHAREDIR}/nls/$$1"; \
195                 shift; shift; \
196         done
197 .endif
198
199 etc-examples: ${META_DEPS}
200         cd ${.CURDIR}; ${INSTALL} ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 \
201             ${BIN1} ${BIN2} \
202             ${DESTDIR}${SHAREDIR}/examples/etc
203
204 .include <bsd.prog.mk>
205
206 .if ${MK_INSTALL_AS_USER} == "yes" && ${_uid} != 0
207 MTREE_FILTER= sed -e 's,\([gu]\)name=,\1id=,g' \
208         -e 's,\(uid=\)[^ ]* ,\1${_uid} ,' \
209         -e 's,\(gid=\)[^ ]* ,\1${_gid} ,' \
210         -e 's,\(uid=\)[^ ]*$$,\1${_uid},' \
211         -e 's,\(gid=\)[^ ]*$$,\1${_gid},'
212 .else
213 MTREE_FILTER= cat
214 .if !defined(NO_FSCHG)
215 MTREE_FSCHG=    -i
216 .endif
217 .endif