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