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