Makefile revision 283846
1#	from: @(#)Makefile	5.11 (Berkeley) 5/21/91
2# $FreeBSD: stable/10/etc/Makefile 283846 2015-05-31 22:39:48Z ngie $
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.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.if ${MK_DEBUG_FILES} != "no"
165MTREE+=	BSD.debug.dist
166.endif
167
168PPPCNF=	ppp.conf
169
170.if ${MK_SENDMAIL} == "no"
171ETCMAIL=mailer.conf aliases
172.else
173ETCMAIL=Makefile README mailer.conf access.sample virtusertable.sample \
174	mailertable.sample aliases
175.endif
176
177# Special top level files for FreeBSD
178FREEBSD=COPYRIGHT
179
180# Sanitize DESTDIR
181DESTDIR:=	${DESTDIR:C://*:/:g}
182
183afterinstall:
184.if ${MK_MAN} != "no"
185	${_+_}cd ${.CURDIR}/../share/man; ${MAKE} makedb
186.endif
187
188distribute:
189	# Avoid installing tests here; "make distribution" will do this and
190	# correctly place them in the right location.
191	${_+_}cd ${.CURDIR} ; ${MAKE} -DNO_TESTS install \
192	    DESTDIR=${DISTDIR}/${DISTRIBUTION}
193	${_+_}cd ${.CURDIR} ; ${MAKE} distribution DESTDIR=${DISTDIR}/${DISTRIBUTION}
194
195.include <bsd.endian.mk>
196.if ${TARGET_ENDIANNESS} == "1234"
197CAP_MKDB_ENDIAN?= -l
198PWD_MKDB_ENDIAN?= -L
199.elif ${TARGET_ENDIANNESS} == "4321"
200CAP_MKDB_ENDIAN?= -b
201PWD_MKDB_ENDIAN?= -B
202.else
203CAP_MKDB_ENDIAN?=
204PWD_MKDB_ENDIAN?=
205.endif
206
207.if defined(NO_ROOT)
208METALOG.add?=	cat -l >> ${METALOG}
209.endif
210
211distribution:
212.if !defined(DESTDIR)
213	@echo "set DESTDIR before running \"make ${.TARGET}\""
214	@false
215.endif
216	cd ${.CURDIR}; \
217	    ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
218		${BIN1} ${DESTDIR}/etc; \
219	    cap_mkdb ${CAP_MKDB_ENDIAN} ${DESTDIR}/etc/login.conf; \
220	    ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 755 \
221		${BIN2} ${DESTDIR}/etc; \
222	    ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 \
223		master.passwd nsmb.conf opieaccess ${DESTDIR}/etc;
224.if ${MK_AT} == "no"
225	sed -i "" -e 's;.*/usr/libexec/atrun;#&;' ${DESTDIR}/etc/crontab
226.endif
227.if ${MK_TCSH} == "no"
228	sed -i "" -e 's;/bin/csh;/bin/sh;' ${DESTDIR}/etc/master.passwd
229.endif
230	pwd_mkdb ${PWD_MKDB_ENDIAN} -i -p -d ${DESTDIR}/etc \
231	    ${DESTDIR}/etc/master.passwd
232.if defined(NO_ROOT)
233	( \
234		echo "./etc/login.conf.db type=file mode=0644 uname=root gname=wheel"; \
235		echo "./etc/passwd type=file mode=0644 uname=root gname=wheel"; \
236		echo "./etc/pwd.db type=file mode=0644 uname=root gname=wheel"; \
237		echo "./etc/spwd.db type=file mode=0600 uname=root gname=wheel"; \
238	) | ${METALOG.add}
239.endif
240.if ${MK_AUTOFS} != "no"
241	${_+_}cd ${.CURDIR}/autofs; ${MAKE} install
242.endif
243.if ${MK_BLUETOOTH} != "no"
244	${_+_}cd ${.CURDIR}/bluetooth; ${MAKE} install
245.endif
246	${_+_}cd ${.CURDIR}/defaults; ${MAKE} install
247	${_+_}cd ${.CURDIR}/devd; ${MAKE} install
248	${_+_}cd ${.CURDIR}/gss; ${MAKE} install
249	${_+_}cd ${.CURDIR}/periodic; ${MAKE} install
250.if ${MK_PKGBOOTSTRAP} != "no"
251	${_+_}cd ${.CURDIR}/pkg; ${MAKE} install
252.endif
253	${_+_}cd ${.CURDIR}/rc.d; ${MAKE} install
254	${_+_}cd ${.CURDIR}/../share/termcap; ${MAKE} etc-termcap
255	${_+_}cd ${.CURDIR}/../usr.sbin/rmt; ${MAKE} etc-rmt
256	${_+_}cd ${.CURDIR}/pam.d; ${MAKE} install
257	cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 0444 \
258	    ${BSM_ETC_OPEN_FILES} ${BSM_ETC_DIR}
259	cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 0600 \
260	    ${BSM_ETC_RESTRICTED_FILES} ${BSM_ETC_DIR}
261	cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 0500 \
262	    ${BSM_ETC_EXEC_FILES} ${BSM_ETC_DIR}
263.if ${MK_UNBOUND} != "no"
264	if [ ! -e ${DESTDIR}/etc/unbound ]; then \
265		${INSTALL_SYMLINK} ../var/unbound ${DESTDIR}/etc/unbound; \
266	fi
267.endif
268.if ${MK_SENDMAIL} != "no"
269	${_+_}cd ${.CURDIR}/sendmail; ${MAKE} distribution
270.endif
271.if ${MK_OPENSSH} != "no"
272	cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
273	    ${SSH} ${DESTDIR}/etc/ssh
274.endif
275.if ${MK_OPENSSL} != "no"
276	cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
277	    ${SSL} ${DESTDIR}/etc/ssl
278.endif
279.if ${MK_KERBEROS} != "no"
280	cd ${.CURDIR}/root; \
281	    ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
282		dot.k5login ${DESTDIR}/root/.k5login;
283.endif
284	cd ${.CURDIR}/root; \
285	    ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
286		dot.profile ${DESTDIR}/root/.profile; \
287	    rm -f ${DESTDIR}/.profile; \
288	    ln ${DESTDIR}/root/.profile ${DESTDIR}/.profile
289.if ${MK_TCSH} != "no"
290	cd ${.CURDIR}/root; \
291	    ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
292		dot.cshrc ${DESTDIR}/root/.cshrc; \
293	    ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
294		dot.login ${DESTDIR}/root/.login; \
295	    rm -f ${DESTDIR}/.cshrc; \
296	    ln ${DESTDIR}/root/.cshrc ${DESTDIR}/.cshrc
297.endif
298	cd ${.CURDIR}/mtree; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
299	    ${MTREE} ${DESTDIR}/etc/mtree
300.if ${MK_PPP} != "no"
301	cd ${.CURDIR}/ppp; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 \
302	    ${PPPCNF} ${DESTDIR}/etc/ppp
303.endif
304.if ${MK_MAIL} != "no"
305	cd ${.CURDIR}/mail; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
306	    ${ETCMAIL} ${DESTDIR}/etc/mail
307	if [ -d ${DESTDIR}/etc/mail -a -f ${DESTDIR}/etc/mail/aliases -a \
308	      ! -f ${DESTDIR}/etc/aliases ]; then \
309		ln -s mail/aliases ${DESTDIR}/etc/aliases; \
310	fi
311.endif
312	${INSTALL} -o ${BINOWN} -g operator -m 664 /dev/null \
313	    ${DESTDIR}/etc/dumpdates
314.if ${MK_LOCATE} != "no"
315	${INSTALL} -o nobody -g ${BINGRP} -m 644 /dev/null \
316	    ${DESTDIR}/var/db/locate.database
317.endif
318	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 ${.CURDIR}/minfree \
319	    ${DESTDIR}/var/crash
320	cd ${.CURDIR}/..; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
321		${FREEBSD} ${DESTDIR}/
322.if ${MK_BOOT} != "no"
323.if exists(${.CURDIR}/../sys/${MACHINE}/conf/GENERIC.hints)
324	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
325	    ${.CURDIR}/../sys/${MACHINE}/conf/GENERIC.hints \
326	    ${DESTDIR}/boot/device.hints
327.endif
328.endif
329.if ${MK_NIS} == "no"
330	sed -i "" -e 's/.*_compat:/# &/' -e 's/compat$$/files/' \
331		${DESTDIR}/etc/nsswitch.conf
332.endif
333
334MTREE_CMD?=	mtree
335
336MTREES=		mtree/BSD.root.dist		/		\
337		mtree/BSD.var.dist		/var		\
338		mtree/BSD.usr.dist		/usr		\
339		mtree/BSD.include.dist		/usr/include
340.if ${MK_DEBUG_FILES} != "no"
341MTREES+=	mtree/BSD.debug.dist		/usr/lib
342.endif
343.if ${MK_GROFF} != "no"
344MTREES+=	mtree/BSD.groff.dist		/usr
345.endif
346.if ${MK_TESTS} != "no"
347MTREES+=	mtree/BSD.tests.dist		${TESTSBASE}
348.endif
349.if ${MK_SENDMAIL} != "no"
350MTREES+=	mtree/BSD.sendmail.dist		/
351.endif
352.for mtree in ${LOCAL_MTREE}
353MTREES+=	../${mtree}			/
354.endfor
355
356distrib-dirs: ${MTREES:N/*}
357	@set ${MTREES}; \
358	while test $$# -ge 2; do \
359		m=${.CURDIR}/$$1; \
360		shift; \
361		d=${DESTDIR}$$1; \
362		shift; \
363		test -d $$d || mkdir -p $$d; \
364		${ECHO} ${MTREE_CMD} -deU ${MTREE_FOLLOWS_SYMLINKS} \
365		    -f $$m -p $$d; \
366		${MTREE_CMD} -deU ${MTREE_FOLLOWS_SYMLINKS} -f $$m -p $$d; \
367	done; true
368.if defined(NO_ROOT)
369	@set ${MTREES}; \
370	while test $$# -ge 2; do \
371		m=${.CURDIR}/$$1; \
372		shift; \
373		d=$$1; \
374		test "$$d" == "/" && d=""; \
375		d=${DISTBASE}$$d; \
376		shift; \
377		test -d $$d || mkdir -p $$d; \
378		${ECHO} "${MTREE_CMD:N-W} -C -f $$m -K uname,gname | " \
379		    "sed s#^\.#.$$d# | ${METALOG.add}" ; \
380		${MTREE_CMD:N-W} -C -f $$m -K uname,gname | sed s#^\.#.$$d# | \
381		    ${METALOG.add} ; \
382	done; true
383.endif
384	${INSTALL_SYMLINK} usr/src/sys ${DESTDIR}/sys
385.if ${MK_MAN} != "no"
386	cd ${DESTDIR}/usr/share/man; \
387	for mandir in man*; do \
388		${INSTALL_SYMLINK} ../$$mandir \
389		    ${DESTDIR}/usr/share/man/en.ISO8859-1/; \
390		${INSTALL_SYMLINK} ../$$mandir \
391		    ${DESTDIR}/usr/share/man/en.UTF-8/; \
392	done
393.if ${MK_OPENSSL} != "no"
394	cd ${DESTDIR}/usr/share/openssl/man; \
395	for mandir in man*; do \
396		${INSTALL_SYMLINK} ../$$mandir \
397		    ${DESTDIR}/usr/share/openssl/man/en.ISO8859-1/; \
398	done
399.endif
400	set - `grep "^[a-zA-Z]" ${.CURDIR}/man.alias`; \
401	while [ $$# -gt 0 ] ; do \
402		${INSTALL_SYMLINK} "$$2" "${DESTDIR}/usr/share/man/$$1"; \
403		if [ "${MK_OPENSSL}" != "no" ]; then \
404			${INSTALL_SYMLINK} "$$2" \
405			    "${DESTDIR}/usr/share/openssl/man/$$1"; \
406		fi; \
407		shift; shift; \
408	done
409.endif
410.if ${MK_NLS} != "no"
411	set - `grep "^[a-zA-Z]" ${.CURDIR}/nls.alias`; \
412	while [ $$# -gt 0 ] ; do \
413		${INSTALL_SYMLINK} "$$2" "${DESTDIR}/usr/share/nls/$$1"; \
414		shift; shift; \
415	done
416.endif
417
418etc-examples:
419	cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
420	    ${BIN1} ${BIN2} nsmb.conf opieaccess \
421	    ${DESTDIR}/usr/share/examples/etc
422	${_+_}cd ${.CURDIR}/defaults; ${MAKE} install \
423	    DESTDIR=${DESTDIR}/usr/share/examples
424
425.include <bsd.prog.mk>
426