xref: /freebsd/etc/Makefile (revision 0572ccaa4543b0abef8ef81e384c1d04de9f3da1)
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	${_+_}cd ${.CURDIR} ; ${MAKE} install DESTDIR=${DISTDIR}/${DISTRIBUTION}
178	${_+_}cd ${.CURDIR} ; ${MAKE} distribution DESTDIR=${DISTDIR}/${DISTRIBUTION}
179
180.include <bsd.endian.mk>
181.if ${TARGET_ENDIANNESS} == "1234"
182CAP_MKDB_ENDIAN?= -l
183PWD_MKDB_ENDIAN?= -L
184.elif ${TARGET_ENDIANNESS} == "4321"
185CAP_MKDB_ENDIAN?= -b
186PWD_MKDB_ENDIAN?= -B
187.else
188CAP_MKDB_ENDIAN?=
189PWD_MKDB_ENDIAN?=
190.endif
191
192.if defined(NO_ROOT)
193METALOG.add?=	cat -l >> ${METALOG}
194.endif
195
196distribution:
197.if !defined(DESTDIR)
198	@echo "set DESTDIR before running \"make ${.TARGET}\""
199	@false
200.endif
201	cd ${.CURDIR}; \
202	    ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
203		${BIN1} ${DESTDIR}/etc; \
204	    cap_mkdb ${CAP_MKDB_ENDIAN} ${DESTDIR}/etc/login.conf; \
205	    ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 755 \
206		${BIN2} ${DESTDIR}/etc; \
207	    ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 \
208		master.passwd nsmb.conf opieaccess ${DESTDIR}/etc;
209.if ${MK_AT} == "no"
210	sed -i "" -e 's;.*/usr/libexec/atrun;#&;' ${DESTDIR}/etc/crontab
211.endif
212.if ${MK_TCSH} == "no"
213	sed -i "" -e 's;/bin/csh;/bin/sh;' ${DESTDIR}/etc/master.passwd
214.endif
215	pwd_mkdb ${PWD_MKDB_ENDIAN} -i -p -d ${DESTDIR}/etc \
216	    ${DESTDIR}/etc/master.passwd
217.if defined(NO_ROOT)
218	( \
219		echo "./etc/login.conf.db type=file mode=0644 uname=root gname=wheel"; \
220		echo "./etc/passwd type=file mode=0644 uname=root gname=wheel"; \
221		echo "./etc/pwd.db type=file mode=0644 uname=root gname=wheel"; \
222		echo "./etc/spwd.db type=file mode=0600 uname=root gname=wheel"; \
223	) | ${METALOG.add}
224.endif
225.if ${MK_BLUETOOTH} != "no"
226	${_+_}cd ${.CURDIR}/bluetooth; ${MAKE} install
227.endif
228.if ${MK_CASPER} != "no"
229	${_+_}cd ${.CURDIR}/casper; ${MAKE} install
230.endif
231	${_+_}cd ${.CURDIR}/defaults; ${MAKE} install
232	${_+_}cd ${.CURDIR}/devd; ${MAKE} install
233.if ${MK_DMAGENT} != "no"
234	${_+_}cd ${.CURDIR}/dma; ${MAKE} install
235.endif
236	${_+_}cd ${.CURDIR}/gss; ${MAKE} install
237	${_+_}cd ${.CURDIR}/periodic; ${MAKE} install
238	${_+_}cd ${.CURDIR}/pkg; ${MAKE} install
239	${_+_}cd ${.CURDIR}/rc.d; ${MAKE} install
240	${_+_}cd ${.CURDIR}/../gnu/usr.bin/send-pr; ${MAKE} etc-gnats-freefall
241	${_+_}cd ${.CURDIR}/../share/termcap; ${MAKE} etc-termcap
242	${_+_}cd ${.CURDIR}/../usr.sbin/rmt; ${MAKE} etc-rmt
243	${_+_}cd ${.CURDIR}/pam.d; ${MAKE} install
244	cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 0444 \
245	    ${BSM_ETC_OPEN_FILES} ${BSM_ETC_DIR}
246	cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 0600 \
247	    ${BSM_ETC_RESTRICTED_FILES} ${BSM_ETC_DIR}
248	cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 0500 \
249	    ${BSM_ETC_EXEC_FILES} ${BSM_ETC_DIR}
250.if ${MK_UNBOUND} != "no"
251	if [ ! -e ${DESTDIR}/etc/unbound ]; then \
252		${INSTALL_SYMLINK} ../var/unbound ${DESTDIR}/etc/unbound; \
253	fi
254.endif
255.if ${MK_SENDMAIL} != "no"
256	${_+_}cd ${.CURDIR}/sendmail; ${MAKE} distribution
257.endif
258.if ${MK_OPENSSH} != "no"
259	cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
260	    ${SSH} ${DESTDIR}/etc/ssh
261.endif
262.if ${MK_OPENSSL} != "no"
263	cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
264	    ${SSL} ${DESTDIR}/etc/ssl
265.endif
266.if ${MK_KERBEROS} != "no"
267	cd ${.CURDIR}/root; \
268	    ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
269		dot.k5login ${DESTDIR}/root/.k5login;
270.endif
271	cd ${.CURDIR}/root; \
272	    ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
273		dot.profile ${DESTDIR}/root/.profile; \
274	    rm -f ${DESTDIR}/.profile; \
275	    ln ${DESTDIR}/root/.profile ${DESTDIR}/.profile
276.if ${MK_TCSH} != "no"
277	cd ${.CURDIR}/root; \
278	    ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
279		dot.cshrc ${DESTDIR}/root/.cshrc; \
280	    ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
281		dot.login ${DESTDIR}/root/.login; \
282	    rm -f ${DESTDIR}/.cshrc; \
283	    ln ${DESTDIR}/root/.cshrc ${DESTDIR}/.cshrc
284.endif
285	cd ${.CURDIR}/mtree; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
286	    ${MTREE} ${DESTDIR}/etc/mtree
287.if ${MK_PPP} != "no"
288	cd ${.CURDIR}/ppp; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 \
289	    ${PPPCNF} ${DESTDIR}/etc/ppp
290.endif
291.if ${MK_MAIL} != "no"
292	cd ${.CURDIR}/mail; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
293	    ${ETCMAIL} ${DESTDIR}/etc/mail
294	if [ -d ${DESTDIR}/etc/mail -a -f ${DESTDIR}/etc/mail/aliases -a \
295	      ! -f ${DESTDIR}/etc/aliases ]; then \
296		ln -s mail/aliases ${DESTDIR}/etc/aliases; \
297	fi
298.endif
299	${INSTALL} -o ${BINOWN} -g operator -m 664 /dev/null \
300	    ${DESTDIR}/etc/dumpdates
301	${INSTALL} -o nobody -g ${BINGRP} -m 644 /dev/null \
302	    ${DESTDIR}/var/db/locate.database
303	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 ${.CURDIR}/minfree \
304	    ${DESTDIR}/var/crash
305	cd ${.CURDIR}/..; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
306		${FREEBSD} ${DESTDIR}/
307.if ${MK_BOOT} != "no"
308.if exists(${.CURDIR}/../sys/${MACHINE}/conf/GENERIC.hints)
309	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
310	    ${.CURDIR}/../sys/${MACHINE}/conf/GENERIC.hints \
311	    ${DESTDIR}/boot/device.hints
312.endif
313.endif
314.if ${MK_NIS} == "no"
315	sed -i "" -e 's/.*_compat:/# &/' -e 's/compat$$/files/' \
316		${DESTDIR}/etc/nsswitch.conf
317.endif
318
319MTREE_CMD?=	mtree
320
321MTREES=		mtree/BSD.root.dist		/		\
322		mtree/BSD.var.dist		/var		\
323		mtree/BSD.usr.dist		/usr		\
324		mtree/BSD.include.dist		/usr/include
325.if ${MK_DEBUG_FILES} != "no"
326MTREES+=	mtree/BSD.debug.dist		/usr/lib
327.endif
328.if ${MK_GROFF} != "no"
329MTREES+=	mtree/BSD.groff.dist		/usr
330.endif
331.if ${MK_TESTS} != "no"
332MTREES+=	mtree/BSD.tests.dist		/usr
333.endif
334.if ${MK_SENDMAIL} != "no"
335MTREES+=	mtree/BSD.sendmail.dist		/
336.endif
337.for mtree in ${LOCAL_MTREE}
338MTREES+=	../${mtree}			/
339.endfor
340
341distrib-dirs: ${MTREES:N/*}
342	@set ${MTREES}; \
343	while test $$# -ge 2; do \
344		m=${.CURDIR}/$$1; \
345		shift; \
346		d=${DESTDIR}$$1; \
347		shift; \
348		${ECHO} ${MTREE_CMD} -deU ${MTREE_FOLLOWS_SYMLINKS} \
349		    -f $$m -p $$d; \
350		${MTREE_CMD} -deU ${MTREE_FOLLOWS_SYMLINKS} -f $$m -p $$d; \
351	done; true
352.if defined(NO_ROOT)
353	@set ${MTREES}; \
354	while test $$# -ge 2; do \
355		m=${.CURDIR}/$$1; \
356		shift; \
357		d=$$1; \
358		test "$$d" == "/" && d=""; \
359		d=${DISTBASE}$$d; \
360		shift; \
361		${ECHO} "${MTREE_CMD:N-W} -C -f $$m -K uname,gname | " \
362		    "sed s#^\.#.$$d# | ${METALOG.add}" ; \
363		${MTREE_CMD:N-W} -C -f $$m -K uname,gname | sed s#^\.#.$$d# | \
364		    ${METALOG.add} ; \
365	done; true
366.endif
367	${INSTALL_SYMLINK} usr/src/sys ${DESTDIR}/sys
368	cd ${DESTDIR}/usr/share/man; \
369	for mandir in man*; do \
370		${INSTALL_SYMLINK} ../$$mandir \
371		    ${DESTDIR}/usr/share/man/en.ISO8859-1/; \
372		${INSTALL_SYMLINK} ../$$mandir \
373		    ${DESTDIR}/usr/share/man/en.UTF-8/; \
374	done
375	cd ${DESTDIR}/usr/share/openssl/man; \
376	for mandir in man*; do \
377		${INSTALL_SYMLINK} ../$$mandir \
378		    ${DESTDIR}/usr/share/openssl/man/en.ISO8859-1/; \
379	done
380	set - `grep "^[a-zA-Z]" ${.CURDIR}/man.alias`; \
381	while [ $$# -gt 0 ] ; do \
382		${INSTALL_SYMLINK} "$$2" "${DESTDIR}/usr/share/man/$$1"; \
383		${INSTALL_SYMLINK} "$$2" \
384		    "${DESTDIR}/usr/share/openssl/man/$$1"; \
385		shift; shift; \
386	done
387	set - `grep "^[a-zA-Z]" ${.CURDIR}/nls.alias`; \
388	while [ $$# -gt 0 ] ; do \
389		${INSTALL_SYMLINK} "$$2" "${DESTDIR}/usr/share/nls/$$1"; \
390		shift; shift; \
391	done
392
393etc-examples:
394	cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
395	    ${BIN1} ${BIN2} nsmb.conf opieaccess \
396	    ${DESTDIR}/usr/share/examples/etc
397	${_+_}cd ${.CURDIR}/defaults; ${MAKE} install \
398	    DESTDIR=${DESTDIR}/usr/share/examples
399
400.include <bsd.prog.mk>
401