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