]> CyberLeo.Net >> Repos - FreeBSD/stable/9.git/blob - etc/Makefile
MFC r363988:
[FreeBSD/stable/9.git] / etc / Makefile
1 #       from: @(#)Makefile      5.11 (Berkeley) 5/21/91
2 # $FreeBSD$
3
4 .include <bsd.own.mk>
5
6 SUBDIR= \
7         newsyslog.conf.d
8
9 .if ${MK_SENDMAIL} != "no"
10 SUBDIR+=sendmail
11 .endif
12
13 BIN1=   crontab \
14         devd.conf \
15         devfs.conf \
16         ddb.conf \
17         dhclient.conf \
18         disktab \
19         fbtab \
20         gettytab \
21         group \
22         hosts \
23         hosts.allow \
24         hosts.equiv \
25         libalias.conf \
26         libmap.conf \
27         login.access \
28         login.conf \
29         mac.conf \
30         motd \
31         netconfig \
32         network.subr \
33         networks \
34         newsyslog.conf \
35         nsswitch.conf \
36         phones \
37         profile \
38         protocols \
39         rc \
40         rc.bsdextended \
41         rc.firewall \
42         rc.initdiskless \
43         rc.shutdown \
44         rc.subr \
45         remote \
46         rpc \
47         services \
48         shells \
49         sysctl.conf \
50         syslog.conf \
51         termcap.small \
52
53 .if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "powerpc64"
54 BIN1+=  libmap32.conf
55 .endif
56
57 .if exists(${.CURDIR}/etc.${MACHINE}/ttys)
58 BIN1+=  etc.${MACHINE}/ttys
59 .elif exists(${.CURDIR}/etc.${MACHINE_ARCH}/ttys)
60 BIN1+=  etc.${MACHINE_ARCH}/ttys
61 .elif exists(${.CURDIR}/etc.${MACHINE_CPUARCH}/ttys)
62 BIN1+=  etc.${MACHINE_CPUARCH}/ttys
63 .else
64 .error etc.MACHINE/ttys missing
65 .endif
66
67 OPENBSMDIR=                     ${.CURDIR}/../contrib/openbsm
68 BSM_ETC_OPEN_FILES=             ${OPENBSMDIR}/etc/audit_class \
69                                 ${OPENBSMDIR}/etc/audit_event
70 BSM_ETC_RESTRICTED_FILES=       ${OPENBSMDIR}/etc/audit_control \
71                                 ${OPENBSMDIR}/etc/audit_user
72 BSM_ETC_EXEC_FILES=             ${OPENBSMDIR}/etc/audit_warn
73 BSM_ETC_DIR=                    ${DESTDIR}/etc/security
74
75 # NB: keep these sorted by MK_* knobs
76
77 .if ${MK_AMD} != "no"
78 BIN1+= amd.map
79 .endif
80
81 .if ${MK_APM} != "no"
82 BIN1+= apmd.conf
83 .endif
84
85 .if ${MK_FREEBSD_UPDATE} != "no"
86 BIN1+= freebsd-update.conf
87 .endif
88
89 .if ${MK_FTP} != "no"
90 BIN1+= ftpusers
91 .endif
92
93 .if ${MK_INETD} != "no"
94 BIN1+= inetd.conf
95 .endif
96
97 .if ${MK_LOCATE} != "no"
98 BIN1+=  ${.CURDIR}/../usr.bin/locate/locate/locate.rc
99 .endif
100
101 .if ${MK_LPR} != "no"
102 BIN1+=  hosts.lpd printcap
103 .endif
104
105 .if ${MK_MAIL} != "no"
106 BIN1+=  ${.CURDIR}/../usr.bin/mail/misc/mail.rc
107 .endif
108
109 .if ${MK_NTP} != "no"
110 BIN1+=  ntp.conf
111 .endif
112
113 .if ${MK_OPENSSH} != "no"
114 SSH=    ${.CURDIR}/../crypto/openssh/ssh_config \
115         ${.CURDIR}/../crypto/openssh/sshd_config \
116         ${.CURDIR}/../crypto/openssh/moduli
117 .endif
118 .if ${MK_OPENSSL} != "no"
119 SSL=    ${.CURDIR}/../crypto/openssl/apps/openssl.cnf
120 .endif
121
122 .if ${MK_NS_CACHING} != "no"
123 BIN1+= nscd.conf
124 .endif
125
126 .if ${MK_PORTSNAP} != "no"
127 BIN1+= portsnap.conf
128 .endif
129
130 .if ${MK_PF} != "no"
131 BIN1+= pf.os
132 .endif
133
134 .if ${MK_SENDMAIL} != "no"
135 BIN1+=  rc.sendmail
136 .endif
137
138 .if ${MK_TCSH} != "no"
139 BIN1+= csh.cshrc csh.login csh.logout
140 .endif
141
142 .if ${MK_WIRELESS} != "no"
143 BIN1+= regdomain.xml
144 .endif
145
146 # -rwxr-xr-x root:wheel, for the new cron root:wheel
147 BIN2=   netstart pccard_ether rc.suspend rc.resume
148
149 MTREE=  BSD.include.dist BSD.root.dist BSD.usr.dist BSD.var.dist
150 .if ${MK_SENDMAIL} != "no"
151 MTREE+= BSD.sendmail.dist
152 .endif
153 .if ${MK_BIND} != "no"
154 MTREE+= BIND.chroot.dist
155 .if ${MK_BIND_LIBS} != "no"
156 MTREE+= BIND.include.dist
157 .endif
158 .endif
159 .if ${MK_DEBUG_FILES} != "no"
160 MTREE+= BSD.debug.dist
161 .endif
162
163 PPPCNF= ppp.conf
164
165 .if ${MK_SENDMAIL} == "no"
166 ETCMAIL=mailer.conf aliases
167 .else
168 ETCMAIL=Makefile README mailer.conf access.sample virtusertable.sample \
169         mailertable.sample aliases
170 .endif
171
172 # Special top level files for FreeBSD
173 FREEBSD=COPYRIGHT
174
175 # Sanitize DESTDIR
176 DESTDIR:=       ${DESTDIR:C://*:/:g}
177
178 afterinstall:
179 .if ${MK_MAN} != "no"
180         ${_+_}cd ${.CURDIR}/../share/man; ${MAKE} makedb
181 .endif
182
183 distribute:
184         ${_+_}cd ${.CURDIR} ; ${MAKE} install DESTDIR=${DISTDIR}/${DISTRIBUTION}
185         ${_+_}cd ${.CURDIR} ; ${MAKE} distribution DESTDIR=${DISTDIR}/${DISTRIBUTION}
186
187 .include <bsd.endian.mk>
188 .if ${TARGET_ENDIANNESS} == "1234"
189 CAP_MKDB_ENDIAN?= -l
190 PWD_MKDB_ENDIAN?= -L
191 .elif ${TARGET_ENDIANNESS} == "4321"
192 CAP_MKDB_ENDIAN?= -b
193 PWD_MKDB_ENDIAN?= -B
194 .else
195 CAP_MKDB_ENDIAN?=
196 PWD_MKDB_ENDIAN?=
197 .endif
198
199 .if defined(NO_ROOT)
200 METALOG.add?=   cat -l >> ${METALOG}
201 .endif
202
203 distribution:
204 .if !defined(DESTDIR)
205         @echo "set DESTDIR before running \"make ${.TARGET}\""
206         @false
207 .endif
208         cd ${.CURDIR}; \
209             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
210                 ${BIN1} ${DESTDIR}/etc; \
211             cap_mkdb ${CAP_MKDB_ENDIAN} ${DESTDIR}/etc/login.conf; \
212             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 755 \
213                 ${BIN2} ${DESTDIR}/etc; \
214             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 \
215                 master.passwd nsmb.conf opieaccess ${DESTDIR}/etc;
216 .if ${MK_BSNMP} != "no"
217         cd ${.CURDIR}; \
218             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 \
219                 snmpd.config ${DESTDIR}/etc;
220 .endif
221 .if ${MK_AT} == "no"
222         sed -i "" -e 's;.*/usr/libexec/atrun;#&;' ${DESTDIR}/etc/crontab
223 .endif
224 .if ${MK_TCSH} == "no"
225         sed -i "" -e 's;/bin/csh;/bin/sh;' ${DESTDIR}/etc/master.passwd
226 .endif
227         pwd_mkdb ${PWD_MKDB_ENDIAN} -i -p -d ${DESTDIR}/etc \
228             ${DESTDIR}/etc/master.passwd
229 .if defined(NO_ROOT)
230         ( \
231                 echo "./etc/login.conf.db type=file mode=0644 uname=root gname=wheel"; \
232                 echo "./etc/passwd type=file mode=0644 uname=root gname=wheel"; \
233                 echo "./etc/pwd.db type=file mode=0644 uname=root gname=wheel"; \
234                 echo "./etc/spwd.db type=file mode=0600 uname=root gname=wheel"; \
235         ) | ${METALOG.add}
236 .endif
237 .if ${MK_BLUETOOTH} != "no"
238         ${_+_}cd ${.CURDIR}/bluetooth; ${MAKE} install
239 .endif
240         ${_+_}cd ${.CURDIR}/defaults; ${MAKE} install
241         ${_+_}cd ${.CURDIR}/devd; ${MAKE} install
242         ${_+_}cd ${.CURDIR}/gss; ${MAKE} install
243 .if ${MK_NTP} != "no"
244         ${_+_}cd ${.CURDIR}/ntp; ${MAKE} install
245 .endif
246         ${_+_}cd ${.CURDIR}/periodic; ${MAKE} install
247 .if ${MK_PKGBOOTSTRAP} != "no"
248         ${_+_}cd ${.CURDIR}/pkg; ${MAKE} install
249 .endif
250         ${_+_}cd ${.CURDIR}/rc.d; ${MAKE} install
251         ${_+_}cd ${.CURDIR}/../share/termcap; ${MAKE} etc-termcap
252         ${_+_}cd ${.CURDIR}/../usr.sbin/rmt; ${MAKE} etc-rmt
253         ${_+_}cd ${.CURDIR}/pam.d; ${MAKE} install
254         cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 0444 \
255             ${BSM_ETC_OPEN_FILES} ${BSM_ETC_DIR}
256         cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 0600 \
257             ${BSM_ETC_RESTRICTED_FILES} ${BSM_ETC_DIR}
258         cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 0500 \
259             ${BSM_ETC_EXEC_FILES} ${BSM_ETC_DIR}
260 .if ${MK_BIND_MTREE} != "no"
261         if [ ! -e ${DESTDIR}/etc/namedb ]; then \
262                 ln -s ../var/named/etc/namedb ${DESTDIR}/etc/namedb; \
263         fi
264 .endif
265 .if ${MK_BIND_ETC} != "no"
266         ${_+_}cd ${.CURDIR}/namedb; ${MAKE} install
267 .endif
268 .if ${MK_SENDMAIL} != "no"
269         ${_+_}cd ${.CURDIR}/sendmail; ${MAKE} distribution
270 .endif
271 .if ${MK_OPENSSH} != "no"
272         cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
273             ${SSH} ${DESTDIR}/etc/ssh
274 .endif
275 .if ${MK_OPENSSL} != "no"
276         cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
277             ${SSL} ${DESTDIR}/etc/ssl
278 .endif
279 .if ${MK_KERBEROS} != "no"
280         cd ${.CURDIR}/root; \
281             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
282                 dot.k5login ${DESTDIR}/root/.k5login;
283 .endif
284         cd ${.CURDIR}/root; \
285             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
286                 dot.profile ${DESTDIR}/root/.profile; \
287             rm -f ${DESTDIR}/.profile; \
288             ln ${DESTDIR}/root/.profile ${DESTDIR}/.profile
289 .if ${MK_TCSH} != "no"
290         cd ${.CURDIR}/root; \
291             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
292                 dot.cshrc ${DESTDIR}/root/.cshrc; \
293             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
294                 dot.login ${DESTDIR}/root/.login; \
295             rm -f ${DESTDIR}/.cshrc; \
296             ln ${DESTDIR}/root/.cshrc ${DESTDIR}/.cshrc
297 .endif
298         cd ${.CURDIR}/mtree; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
299             ${MTREE} ${DESTDIR}/etc/mtree
300 .if ${MK_PPP} != "no"
301         cd ${.CURDIR}/ppp; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 \
302             ${PPPCNF} ${DESTDIR}/etc/ppp
303 .endif
304 .if ${MK_MAIL} != "no"
305         cd ${.CURDIR}/mail; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
306             ${ETCMAIL} ${DESTDIR}/etc/mail
307         if [ -d ${DESTDIR}/etc/mail -a -f ${DESTDIR}/etc/mail/aliases -a \
308               ! -f ${DESTDIR}/etc/aliases ]; then \
309                 ln -s mail/aliases ${DESTDIR}/etc/aliases; \
310         fi
311 .endif
312         ${INSTALL} -o ${BINOWN} -g operator -m 664 /dev/null \
313             ${DESTDIR}/etc/dumpdates
314 .if ${MK_LOCATE} != "no"
315         ${INSTALL} -o nobody -g ${BINGRP} -m 644 /dev/null \
316             ${DESTDIR}/var/db/locate.database
317 .endif
318         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 ${.CURDIR}/minfree \
319             ${DESTDIR}/var/crash
320         cd ${.CURDIR}/..; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
321                 ${FREEBSD} ${DESTDIR}/
322 .if ${MK_BOOT} != "no"
323 .if exists(${.CURDIR}/../sys/${MACHINE}/conf/GENERIC.hints)
324         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
325             ${.CURDIR}/../sys/${MACHINE}/conf/GENERIC.hints \
326             ${DESTDIR}/boot/device.hints
327 .endif
328 .endif
329 .if ${MK_NIS} == "no"
330         sed -i "" -e 's/.*_compat:/# &/' -e 's/compat$$/files/' \
331                 ${DESTDIR}/etc/nsswitch.conf
332 .endif
333
334 MTREE_CMD?=     mtree
335
336 MTREES=         mtree/BSD.root.dist             /               \
337                 mtree/BSD.var.dist              /var            \
338                 mtree/BSD.usr.dist              /usr            \
339                 mtree/BSD.include.dist          /usr/include
340 .if ${MK_DEBUG_FILES} != "no"
341 MTREES+=        mtree/BSD.debug.dist            /usr/lib
342 .endif
343 .if ${MK_BIND_LIBS} != "no"
344 MTREES+=        mtree/BIND.include.dist         /usr/include
345 .endif
346 .if ${MK_BIND_MTREE} != "no"
347 MTREES+=        mtree/BIND.chroot.dist          /var/named
348 .endif
349 .if ${MK_GROFF} != "no"
350 MTREES+=        mtree/BSD.groff.dist            /usr
351 .endif
352 .if ${MK_SENDMAIL} != "no"
353 MTREES+=        mtree/BSD.sendmail.dist         /
354 .endif
355 .for mtree in ${LOCAL_MTREE}
356 MTREES+=        ../${mtree}                     /
357 .endfor
358
359 distrib-dirs: ${MTREES:N/*}
360         @set ${MTREES}; \
361         while test $$# -ge 2; do \
362                 m=${.CURDIR}/$$1; \
363                 shift; \
364                 d=${DESTDIR}$$1; \
365                 shift; \
366                 ${ECHO} ${MTREE_CMD} -deU ${MTREE_FOLLOWS_SYMLINKS} \
367                     -f $$m -p $$d; \
368                 ${MTREE_CMD} -deU ${MTREE_FOLLOWS_SYMLINKS} -f $$m -p $$d; \
369         done; true
370 .if defined(NO_ROOT)
371         @set ${MTREES}; \
372         while test $$# -ge 2; do \
373                 m=${.CURDIR}/$$1; \
374                 shift; \
375                 d=$$1; \
376                 test "$$d" == "/" && d=""; \
377                 d=${DISTBASE}$$d; \
378                 shift; \
379                 ${ECHO} "${MTREE_CMD:N-W} -C -f $$m -K uname,gname | " \
380                     "sed s#^\.#.$$d# | ${METALOG.add}" ; \
381                 ${MTREE_CMD:N-W} -C -f $$m -K uname,gname | sed s#^\.#.$$d# | \
382                     ${METALOG.add} ; \
383         done; true
384 .endif
385         ${INSTALL_SYMLINK} usr/src/sys ${DESTDIR}/sys
386 .if ${MK_MAN} != "no"
387         cd ${DESTDIR}/usr/share/man; \
388         for mandir in man*; do \
389                 ${INSTALL_SYMLINK} ../$$mandir \
390                     ${DESTDIR}/usr/share/man/en.ISO8859-1/; \
391                 ${INSTALL_SYMLINK} ../$$mandir \
392                     ${DESTDIR}/usr/share/man/en.UTF-8/; \
393         done
394 .if ${MK_OPENSSL} != "no"
395         cd ${DESTDIR}/usr/share/openssl/man; \
396         for mandir in man*; do \
397                 ${INSTALL_SYMLINK} ../$$mandir \
398                     ${DESTDIR}/usr/share/openssl/man/en.ISO8859-1/; \
399         done
400 .endif
401         set - `grep "^[a-zA-Z]" ${.CURDIR}/man.alias`; \
402         while [ $$# -gt 0 ] ; do \
403                 ${INSTALL_SYMLINK} "$$2" "${DESTDIR}/usr/share/man/$$1"; \
404                 if [ "${MK_OPENSSL}" != "no" ]; then \
405                         ${INSTALL_SYMLINK} "$$2" \
406                             "${DESTDIR}/usr/share/openssl/man/$$1"; \
407                 fi; \
408                 shift; shift; \
409         done
410 .endif
411 .if ${MK_NLS} != "no"
412         set - `grep "^[a-zA-Z]" ${.CURDIR}/nls.alias`; \
413         while [ $$# -gt 0 ] ; do \
414                 ${INSTALL_SYMLINK} "$$2" "${DESTDIR}/usr/share/nls/$$1"; \
415                 shift; shift; \
416         done
417 .endif
418
419 etc-examples:
420         cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
421             ${BIN1} ${BIN2} nsmb.conf opieaccess \
422             ${DESTDIR}/usr/share/examples/etc
423         ${_+_}cd ${.CURDIR}/defaults; ${MAKE} install \
424             DESTDIR=${DESTDIR}/usr/share/examples
425
426 .include <bsd.prog.mk>