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