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