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