xref: /freebsd/etc/Makefile (revision 5e497231273fbe5e786d080f140dd66c44fedde8)
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=	auto_master \
18	crontab \
19	devd.conf \
20	devfs.conf \
21	ddb.conf \
22	dhclient.conf \
23	disktab \
24	fbtab \
25	ftpusers \
26	gettytab \
27	group \
28	hosts \
29	hosts.allow \
30	hosts.equiv \
31	inetd.conf \
32	libalias.conf \
33	libmap.conf \
34	login.access \
35	login.conf \
36	mac.conf \
37	motd \
38	netconfig \
39	network.subr \
40	networks \
41	newsyslog.conf \
42	nsswitch.conf \
43	phones \
44	profile \
45	protocols \
46	rc \
47	rc.bsdextended \
48	rc.firewall \
49	rc.initdiskless \
50	rc.sendmail \
51	rc.shutdown \
52	rc.subr \
53	remote \
54	rpc \
55	services \
56	shells \
57	sysctl.conf \
58	syslog.conf \
59	termcap.small
60
61.if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "powerpc64"
62BIN1+=	libmap32.conf
63.endif
64
65.if exists(${.CURDIR}/etc.${MACHINE}/ttys)
66BIN1+=	etc.${MACHINE}/ttys
67.elif exists(${.CURDIR}/etc.${MACHINE_ARCH}/ttys)
68BIN1+=	etc.${MACHINE_ARCH}/ttys
69.elif exists(${.CURDIR}/etc.${MACHINE_CPUARCH}/ttys)
70BIN1+=	etc.${MACHINE_CPUARCH}/ttys
71.else
72.error etc.MACHINE/ttys missing
73.endif
74
75OPENBSMDIR=			${.CURDIR}/../contrib/openbsm
76BSM_ETC_OPEN_FILES=		${OPENBSMDIR}/etc/audit_class \
77				${OPENBSMDIR}/etc/audit_event
78BSM_ETC_RESTRICTED_FILES=	${OPENBSMDIR}/etc/audit_control \
79				${OPENBSMDIR}/etc/audit_user
80BSM_ETC_EXEC_FILES=		${OPENBSMDIR}/etc/audit_warn
81BSM_ETC_DIR=			${DESTDIR}/etc/security
82
83# NB: keep these sorted by MK_* knobs
84
85.if ${MK_AMD} != "no"
86BIN1+= amd.map
87.endif
88
89.if ${MK_APM} != "no"
90BIN1+= apmd.conf
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_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		${TESTSBASE}
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		test -d $$d || mkdir -p $$d; \
356		${ECHO} ${MTREE_CMD} -deU ${MTREE_FOLLOWS_SYMLINKS} \
357		    -f $$m -p $$d; \
358		${MTREE_CMD} -deU ${MTREE_FOLLOWS_SYMLINKS} -f $$m -p $$d; \
359	done; true
360.if defined(NO_ROOT)
361	@set ${MTREES}; \
362	while test $$# -ge 2; do \
363		m=${.CURDIR}/$$1; \
364		shift; \
365		d=$$1; \
366		test "$$d" == "/" && d=""; \
367		d=${DISTBASE}$$d; \
368		shift; \
369		test -d $$d || mkdir -p $$d; \
370		${ECHO} "${MTREE_CMD:N-W} -C -f $$m -K uname,gname | " \
371		    "sed s#^\.#.$$d# | ${METALOG.add}" ; \
372		${MTREE_CMD:N-W} -C -f $$m -K uname,gname | sed s#^\.#.$$d# | \
373		    ${METALOG.add} ; \
374	done; true
375.endif
376	${INSTALL_SYMLINK} usr/src/sys ${DESTDIR}/sys
377	cd ${DESTDIR}/usr/share/man; \
378	for mandir in man*; do \
379		${INSTALL_SYMLINK} ../$$mandir \
380		    ${DESTDIR}/usr/share/man/en.ISO8859-1/; \
381		${INSTALL_SYMLINK} ../$$mandir \
382		    ${DESTDIR}/usr/share/man/en.UTF-8/; \
383	done
384	cd ${DESTDIR}/usr/share/openssl/man; \
385	for mandir in man*; do \
386		${INSTALL_SYMLINK} ../$$mandir \
387		    ${DESTDIR}/usr/share/openssl/man/en.ISO8859-1/; \
388	done
389	set - `grep "^[a-zA-Z]" ${.CURDIR}/man.alias`; \
390	while [ $$# -gt 0 ] ; do \
391		${INSTALL_SYMLINK} "$$2" "${DESTDIR}/usr/share/man/$$1"; \
392		${INSTALL_SYMLINK} "$$2" \
393		    "${DESTDIR}/usr/share/openssl/man/$$1"; \
394		shift; shift; \
395	done
396	set - `grep "^[a-zA-Z]" ${.CURDIR}/nls.alias`; \
397	while [ $$# -gt 0 ] ; do \
398		${INSTALL_SYMLINK} "$$2" "${DESTDIR}/usr/share/nls/$$1"; \
399		shift; shift; \
400	done
401
402etc-examples:
403	cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
404	    ${BIN1} ${BIN2} nsmb.conf opieaccess \
405	    ${DESTDIR}/usr/share/examples/etc
406	${_+_}cd ${.CURDIR}/defaults; ${MAKE} install \
407	    DESTDIR=${DESTDIR}/usr/share/examples
408
409.include <bsd.prog.mk>
410