xref: /freebsd/etc/Makefile (revision 05bc3dd6c00f584ef8a49f8a91eb6adc70d19cd1)
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=	auto_master \
15	crontab \
16	devd.conf \
17	devfs.conf \
18	ddb.conf \
19	dhclient.conf \
20	disktab \
21	fbtab \
22	ftpusers \
23	gettytab \
24	group \
25	hosts \
26	hosts.allow \
27	hosts.equiv \
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_INETD} != "no"
98BIN1+= inetd.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} MK_TESTS=no 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.if ${MK_CASPER} != "no"
237	${_+_}cd ${.CURDIR}/casper; ${MAKE} install
238.endif
239	${_+_}cd ${.CURDIR}/defaults; ${MAKE} install
240	${_+_}cd ${.CURDIR}/devd; ${MAKE} install
241.if ${MK_DMAGENT} != "no"
242	${_+_}cd ${.CURDIR}/dma; ${MAKE} install
243.endif
244	${_+_}cd ${.CURDIR}/gss; ${MAKE} install
245	${_+_}cd ${.CURDIR}/periodic; ${MAKE} install
246	${_+_}cd ${.CURDIR}/pkg; ${MAKE} install
247	${_+_}cd ${.CURDIR}/rc.d; ${MAKE} install
248	${_+_}cd ${.CURDIR}/../share/termcap; ${MAKE} etc-termcap
249	${_+_}cd ${.CURDIR}/../usr.sbin/rmt; ${MAKE} etc-rmt
250	${_+_}cd ${.CURDIR}/pam.d; ${MAKE} install
251	cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 0444 \
252	    ${BSM_ETC_OPEN_FILES} ${BSM_ETC_DIR}
253	cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 0600 \
254	    ${BSM_ETC_RESTRICTED_FILES} ${BSM_ETC_DIR}
255	cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 0500 \
256	    ${BSM_ETC_EXEC_FILES} ${BSM_ETC_DIR}
257.if ${MK_UNBOUND} != "no"
258	if [ ! -e ${DESTDIR}/etc/unbound ]; then \
259		${INSTALL_SYMLINK} ../var/unbound ${DESTDIR}/etc/unbound; \
260	fi
261.endif
262.if ${MK_SENDMAIL} != "no"
263	${_+_}cd ${.CURDIR}/sendmail; ${MAKE} distribution
264.endif
265.if ${MK_OPENSSH} != "no"
266	cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
267	    ${SSH} ${DESTDIR}/etc/ssh
268.endif
269.if ${MK_OPENSSL} != "no"
270	cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
271	    ${SSL} ${DESTDIR}/etc/ssl
272.endif
273.if ${MK_KERBEROS} != "no"
274	cd ${.CURDIR}/root; \
275	    ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
276		dot.k5login ${DESTDIR}/root/.k5login;
277.endif
278	cd ${.CURDIR}/root; \
279	    ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
280		dot.profile ${DESTDIR}/root/.profile; \
281	    rm -f ${DESTDIR}/.profile; \
282	    ln ${DESTDIR}/root/.profile ${DESTDIR}/.profile
283.if ${MK_TCSH} != "no"
284	cd ${.CURDIR}/root; \
285	    ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
286		dot.cshrc ${DESTDIR}/root/.cshrc; \
287	    ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
288		dot.login ${DESTDIR}/root/.login; \
289	    rm -f ${DESTDIR}/.cshrc; \
290	    ln ${DESTDIR}/root/.cshrc ${DESTDIR}/.cshrc
291.endif
292	cd ${.CURDIR}/mtree; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
293	    ${MTREE} ${DESTDIR}/etc/mtree
294.if ${MK_PPP} != "no"
295	cd ${.CURDIR}/ppp; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 \
296	    ${PPPCNF} ${DESTDIR}/etc/ppp
297.endif
298.if ${MK_MAIL} != "no"
299	cd ${.CURDIR}/mail; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
300	    ${ETCMAIL} ${DESTDIR}/etc/mail
301	if [ -d ${DESTDIR}/etc/mail -a -f ${DESTDIR}/etc/mail/aliases -a \
302	      ! -f ${DESTDIR}/etc/aliases ]; then \
303		ln -s mail/aliases ${DESTDIR}/etc/aliases; \
304	fi
305.endif
306	${INSTALL} -o ${BINOWN} -g operator -m 664 /dev/null \
307	    ${DESTDIR}/etc/dumpdates
308	${INSTALL} -o nobody -g ${BINGRP} -m 644 /dev/null \
309	    ${DESTDIR}/var/db/locate.database
310	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 ${.CURDIR}/minfree \
311	    ${DESTDIR}/var/crash
312	cd ${.CURDIR}/..; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
313		${FREEBSD} ${DESTDIR}/
314.if ${MK_BOOT} != "no"
315.if exists(${.CURDIR}/../sys/${MACHINE}/conf/GENERIC.hints)
316	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
317	    ${.CURDIR}/../sys/${MACHINE}/conf/GENERIC.hints \
318	    ${DESTDIR}/boot/device.hints
319.endif
320.endif
321.if ${MK_NIS} == "no"
322	sed -i "" -e 's/.*_compat:/# &/' -e 's/compat$$/files/' \
323		${DESTDIR}/etc/nsswitch.conf
324.endif
325
326MTREE_CMD?=	mtree
327
328MTREES=		mtree/BSD.root.dist		/		\
329		mtree/BSD.var.dist		/var		\
330		mtree/BSD.usr.dist		/usr		\
331		mtree/BSD.include.dist		/usr/include
332.if ${MK_DEBUG_FILES} != "no"
333MTREES+=	mtree/BSD.debug.dist		/usr/lib
334.endif
335.if ${MK_GROFF} != "no"
336MTREES+=	mtree/BSD.groff.dist		/usr
337.endif
338.if ${MK_TESTS} != "no"
339MTREES+=	mtree/BSD.tests.dist		/usr
340.endif
341.if ${MK_SENDMAIL} != "no"
342MTREES+=	mtree/BSD.sendmail.dist		/
343.endif
344.for mtree in ${LOCAL_MTREE}
345MTREES+=	../${mtree}			/
346.endfor
347
348distrib-dirs: ${MTREES:N/*}
349	@set ${MTREES}; \
350	while test $$# -ge 2; do \
351		m=${.CURDIR}/$$1; \
352		shift; \
353		d=${DESTDIR}$$1; \
354		shift; \
355		${ECHO} ${MTREE_CMD} -deU ${MTREE_FOLLOWS_SYMLINKS} \
356		    -f $$m -p $$d; \
357		${MTREE_CMD} -deU ${MTREE_FOLLOWS_SYMLINKS} -f $$m -p $$d; \
358	done; true
359.if defined(NO_ROOT)
360	@set ${MTREES}; \
361	while test $$# -ge 2; do \
362		m=${.CURDIR}/$$1; \
363		shift; \
364		d=$$1; \
365		test "$$d" == "/" && d=""; \
366		d=${DISTBASE}$$d; \
367		shift; \
368		${ECHO} "${MTREE_CMD:N-W} -C -f $$m -K uname,gname | " \
369		    "sed s#^\.#.$$d# | ${METALOG.add}" ; \
370		${MTREE_CMD:N-W} -C -f $$m -K uname,gname | sed s#^\.#.$$d# | \
371		    ${METALOG.add} ; \
372	done; true
373.endif
374	${INSTALL_SYMLINK} usr/src/sys ${DESTDIR}/sys
375	cd ${DESTDIR}/usr/share/man; \
376	for mandir in man*; do \
377		${INSTALL_SYMLINK} ../$$mandir \
378		    ${DESTDIR}/usr/share/man/en.ISO8859-1/; \
379		${INSTALL_SYMLINK} ../$$mandir \
380		    ${DESTDIR}/usr/share/man/en.UTF-8/; \
381	done
382.if ${MK_OPENSSL} != "no"
383	cd ${DESTDIR}/usr/share/openssl/man; \
384	for mandir in man*; do \
385		${INSTALL_SYMLINK} ../$$mandir \
386		    ${DESTDIR}/usr/share/openssl/man/en.ISO8859-1/; \
387	done
388.endif
389	set - `grep "^[a-zA-Z]" ${.CURDIR}/man.alias`; \
390	while [ $$# -gt 0 ] ; do \
391		${INSTALL_SYMLINK} "$$2" "${DESTDIR}/usr/share/man/$$1"; \
392		if [ "${MK_OPENSSL}" != "no" ]; then \
393			${INSTALL_SYMLINK} "$$2" \
394			    "${DESTDIR}/usr/share/openssl/man/$$1"; \
395		fi; \
396		shift; shift; \
397	done
398.if ${MK_NLS} != "no"
399	set - `grep "^[a-zA-Z]" ${.CURDIR}/nls.alias`; \
400	while [ $$# -gt 0 ] ; do \
401		${INSTALL_SYMLINK} "$$2" "${DESTDIR}/usr/share/nls/$$1"; \
402		shift; shift; \
403	done
404.endif
405
406etc-examples:
407	cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
408	    ${BIN1} ${BIN2} nsmb.conf opieaccess \
409	    ${DESTDIR}/usr/share/examples/etc
410	${_+_}cd ${.CURDIR}/defaults; ${MAKE} install \
411	    DESTDIR=${DESTDIR}/usr/share/examples
412
413.include <bsd.prog.mk>
414