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