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