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