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