xref: /freebsd/etc/Makefile (revision ee7b0571c2c18bdec848ed2044223cc88db29bd8)
1#	from: @(#)Makefile	5.11 (Berkeley) 5/21/91
2# $FreeBSD$
3
4.include <src.opts.mk>
5
6.if ${MK_SENDMAIL} != "no"
7SUBDIR=	sendmail
8.endif
9
10.if ${MK_TESTS} != "no"
11SUBDIR+=tests
12.endif
13
14BIN1=	crontab \
15	devd.conf \
16	devfs.conf \
17	ddb.conf \
18	dhclient.conf \
19	disktab \
20	fbtab \
21	ftpusers \
22	gettytab \
23	group \
24	hosts \
25	hosts.allow \
26	hosts.equiv \
27	inetd.conf \
28	libalias.conf \
29	libmap.conf \
30	login.access \
31	login.conf \
32	mac.conf \
33	motd \
34	netconfig \
35	network.subr \
36	networks \
37	newsyslog.conf \
38	nsswitch.conf \
39	phones \
40	profile \
41	protocols \
42	rc \
43	rc.bsdextended \
44	rc.firewall \
45	rc.initdiskless \
46	rc.sendmail \
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_BSNMP} != "no"
90BIN1+= snmpd.config
91.endif
92
93.if ${MK_FREEBSD_UPDATE} != "no"
94BIN1+= freebsd-update.conf
95.endif
96
97.if ${MK_LOCATE} != "no"
98BIN1+=	${.CURDIR}/../usr.bin/locate/locate/locate.rc
99.endif
100
101.if ${MK_LPR} != "no"
102BIN1+=	hosts.lpd printcap
103.endif
104
105.if ${MK_MAIL} != "no"
106BIN1+=	${.CURDIR}/../usr.bin/mail/misc/mail.rc
107.endif
108
109.if ${MK_NTP} != "no"
110BIN1+=	ntp.conf
111.endif
112
113.if ${MK_OPENSSH} != "no"
114SSH=	${.CURDIR}/../crypto/openssh/ssh_config \
115	${.CURDIR}/../crypto/openssh/sshd_config \
116	${.CURDIR}/../crypto/openssh/moduli
117.endif
118.if ${MK_OPENSSL} != "no"
119SSL=	${.CURDIR}/../crypto/openssl/apps/openssl.cnf
120.endif
121
122.if ${MK_NS_CACHING} != "no"
123BIN1+= nscd.conf
124.endif
125
126.if ${MK_PORTSNAP} != "no"
127BIN1+= portsnap.conf
128.endif
129
130.if ${MK_PF} != "no"
131BIN1+= pf.os
132.endif
133
134.if ${MK_TCSH} != "no"
135BIN1+= csh.cshrc csh.login csh.logout
136.endif
137
138.if ${MK_WIRELESS} != "no"
139BIN1+= regdomain.xml
140.endif
141
142# -rwxr-xr-x root:wheel, for the new cron root:wheel
143BIN2=	netstart pccard_ether rc.suspend rc.resume
144
145MTREE=	BSD.include.dist BSD.root.dist BSD.usr.dist BSD.var.dist
146.if ${MK_TESTS} != "no"
147MTREE+=	BSD.tests.dist
148.endif
149.if ${MK_SENDMAIL} != "no"
150MTREE+=	BSD.sendmail.dist
151.endif
152.if ${MK_DEBUG_FILES} != "no"
153MTREE+=	BSD.debug.dist
154.endif
155
156PPPCNF=	ppp.conf
157
158.if ${MK_SENDMAIL} == "no"
159ETCMAIL=mailer.conf aliases
160.else
161ETCMAIL=Makefile README mailer.conf access.sample virtusertable.sample \
162	mailertable.sample aliases
163.endif
164
165# Special top level files for FreeBSD
166FREEBSD=COPYRIGHT
167
168# Sanitize DESTDIR
169DESTDIR:=	${DESTDIR:C://*:/:g}
170
171afterinstall:
172.if ${MK_MAN} != "no"
173	${_+_}cd ${.CURDIR}/../share/man; ${MAKE} makedb
174.endif
175
176distribute:
177	# Avoid installing tests here; "make distribution" will do this and
178	# correctly place them in the right location.
179	${_+_}cd ${.CURDIR} ; ${MAKE} MK_TESTS=no install \
180	    DESTDIR=${DISTDIR}/${DISTRIBUTION}
181	${_+_}cd ${.CURDIR} ; ${MAKE} distribution DESTDIR=${DISTDIR}/${DISTRIBUTION}
182
183.include <bsd.endian.mk>
184.if ${TARGET_ENDIANNESS} == "1234"
185CAP_MKDB_ENDIAN?= -l
186PWD_MKDB_ENDIAN?= -L
187.elif ${TARGET_ENDIANNESS} == "4321"
188CAP_MKDB_ENDIAN?= -b
189PWD_MKDB_ENDIAN?= -B
190.else
191CAP_MKDB_ENDIAN?=
192PWD_MKDB_ENDIAN?=
193.endif
194
195.if defined(NO_ROOT)
196METALOG.add?=	cat -l >> ${METALOG}
197.endif
198
199distribution:
200.if !defined(DESTDIR)
201	@echo "set DESTDIR before running \"make ${.TARGET}\""
202	@false
203.endif
204	cd ${.CURDIR}; \
205	    ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
206		${BIN1} ${DESTDIR}/etc; \
207	    cap_mkdb ${CAP_MKDB_ENDIAN} ${DESTDIR}/etc/login.conf; \
208	    ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 755 \
209		${BIN2} ${DESTDIR}/etc; \
210	    ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 \
211		master.passwd nsmb.conf opieaccess ${DESTDIR}/etc;
212.if ${MK_AT} == "no"
213	sed -i "" -e 's;.*/usr/libexec/atrun;#&;' ${DESTDIR}/etc/crontab
214.endif
215.if ${MK_TCSH} == "no"
216	sed -i "" -e 's;/bin/csh;/bin/sh;' ${DESTDIR}/etc/master.passwd
217.endif
218	pwd_mkdb ${PWD_MKDB_ENDIAN} -i -p -d ${DESTDIR}/etc \
219	    ${DESTDIR}/etc/master.passwd
220.if defined(NO_ROOT)
221	( \
222		echo "./etc/login.conf.db type=file mode=0644 uname=root gname=wheel"; \
223		echo "./etc/passwd type=file mode=0644 uname=root gname=wheel"; \
224		echo "./etc/pwd.db type=file mode=0644 uname=root gname=wheel"; \
225		echo "./etc/spwd.db type=file mode=0600 uname=root gname=wheel"; \
226	) | ${METALOG.add}
227.endif
228.if ${MK_BLUETOOTH} != "no"
229	${_+_}cd ${.CURDIR}/bluetooth; ${MAKE} install
230.endif
231.if ${MK_CASPER} != "no"
232	${_+_}cd ${.CURDIR}/casper; ${MAKE} install
233.endif
234	${_+_}cd ${.CURDIR}/defaults; ${MAKE} install
235	${_+_}cd ${.CURDIR}/devd; ${MAKE} install
236.if ${MK_DMAGENT} != "no"
237	${_+_}cd ${.CURDIR}/dma; ${MAKE} install
238.endif
239	${_+_}cd ${.CURDIR}/gss; ${MAKE} install
240	${_+_}cd ${.CURDIR}/periodic; ${MAKE} install
241	${_+_}cd ${.CURDIR}/pkg; ${MAKE} install
242	${_+_}cd ${.CURDIR}/rc.d; ${MAKE} install
243	${_+_}cd ${.CURDIR}/../share/termcap; ${MAKE} etc-termcap
244	${_+_}cd ${.CURDIR}/../usr.sbin/rmt; ${MAKE} etc-rmt
245	${_+_}cd ${.CURDIR}/pam.d; ${MAKE} install
246	cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 0444 \
247	    ${BSM_ETC_OPEN_FILES} ${BSM_ETC_DIR}
248	cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 0600 \
249	    ${BSM_ETC_RESTRICTED_FILES} ${BSM_ETC_DIR}
250	cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 0500 \
251	    ${BSM_ETC_EXEC_FILES} ${BSM_ETC_DIR}
252.if ${MK_UNBOUND} != "no"
253	if [ ! -e ${DESTDIR}/etc/unbound ]; then \
254		${INSTALL_SYMLINK} ../var/unbound ${DESTDIR}/etc/unbound; \
255	fi
256.endif
257.if ${MK_SENDMAIL} != "no"
258	${_+_}cd ${.CURDIR}/sendmail; ${MAKE} distribution
259.endif
260.if ${MK_OPENSSH} != "no"
261	cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
262	    ${SSH} ${DESTDIR}/etc/ssh
263.endif
264.if ${MK_OPENSSL} != "no"
265	cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
266	    ${SSL} ${DESTDIR}/etc/ssl
267.endif
268.if ${MK_KERBEROS} != "no"
269	cd ${.CURDIR}/root; \
270	    ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
271		dot.k5login ${DESTDIR}/root/.k5login;
272.endif
273	cd ${.CURDIR}/root; \
274	    ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
275		dot.profile ${DESTDIR}/root/.profile; \
276	    rm -f ${DESTDIR}/.profile; \
277	    ln ${DESTDIR}/root/.profile ${DESTDIR}/.profile
278.if ${MK_TCSH} != "no"
279	cd ${.CURDIR}/root; \
280	    ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
281		dot.cshrc ${DESTDIR}/root/.cshrc; \
282	    ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
283		dot.login ${DESTDIR}/root/.login; \
284	    rm -f ${DESTDIR}/.cshrc; \
285	    ln ${DESTDIR}/root/.cshrc ${DESTDIR}/.cshrc
286.endif
287	cd ${.CURDIR}/mtree; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
288	    ${MTREE} ${DESTDIR}/etc/mtree
289.if ${MK_PPP} != "no"
290	cd ${.CURDIR}/ppp; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 \
291	    ${PPPCNF} ${DESTDIR}/etc/ppp
292.endif
293.if ${MK_MAIL} != "no"
294	cd ${.CURDIR}/mail; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
295	    ${ETCMAIL} ${DESTDIR}/etc/mail
296	if [ -d ${DESTDIR}/etc/mail -a -f ${DESTDIR}/etc/mail/aliases -a \
297	      ! -f ${DESTDIR}/etc/aliases ]; then \
298		ln -s mail/aliases ${DESTDIR}/etc/aliases; \
299	fi
300.endif
301	${INSTALL} -o ${BINOWN} -g operator -m 664 /dev/null \
302	    ${DESTDIR}/etc/dumpdates
303	${INSTALL} -o nobody -g ${BINGRP} -m 644 /dev/null \
304	    ${DESTDIR}/var/db/locate.database
305	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 ${.CURDIR}/minfree \
306	    ${DESTDIR}/var/crash
307	cd ${.CURDIR}/..; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
308		${FREEBSD} ${DESTDIR}/
309.if ${MK_BOOT} != "no"
310.if exists(${.CURDIR}/../sys/${MACHINE}/conf/GENERIC.hints)
311	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
312	    ${.CURDIR}/../sys/${MACHINE}/conf/GENERIC.hints \
313	    ${DESTDIR}/boot/device.hints
314.endif
315.endif
316.if ${MK_NIS} == "no"
317	sed -i "" -e 's/.*_compat:/# &/' -e 's/compat$$/files/' \
318		${DESTDIR}/etc/nsswitch.conf
319.endif
320
321MTREE_CMD?=	mtree
322
323.if ${MK_INSTALL_AS_USER} != "no" && ${_uid} != 0
324MTREE_FILTER= sed -e 's,\([gu]\)name=,\1id=,g' \
325	-e 's,\(uid=\)[^ ]* ,\1${_uid} ,' \
326	-e 's,\(gid=\)[^ ]* ,\1${_gid} ,' \
327	-e 's,\(uid=\)[^ ]*$$,\1${_uid},' \
328	-e 's,\(gid=\)[^ ]*$$,\1${_gid},'
329.else
330MTREE_FILTER= cat
331.endif
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		/usr
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		${ECHO} ${MTREE_CMD} -deU ${MTREE_FOLLOWS_SYMLINKS} \
361		    -f $$m -p $$d; \
362		${MTREE_FILTER} $$m | \
363		${MTREE_CMD} -deU ${MTREE_FOLLOWS_SYMLINKS} -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		${ECHO} "${MTREE_CMD:N-W} -C -f $$m -K uname,gname | " \
375		    "sed s#^\.#.$$d# | ${METALOG.add}" ; \
376		${MTREE_FILTER} $$m | \
377		${MTREE_CMD:N-W} -C -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