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