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