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