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