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