xref: /freebsd/etc/Makefile (revision e052c69ab2406029ae4ca4e327f366fd5bbe7b03)
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	gettytab \
22	group \
23	hosts \
24	hosts.allow \
25	hosts.equiv \
26	libalias.conf \
27	libmap.conf \
28	login.access \
29	login.conf \
30	mac.conf \
31	motd \
32	netconfig \
33	network.subr \
34	networks \
35	newsyslog.conf \
36	nsswitch.conf \
37	phones \
38	profile \
39	protocols \
40	rc \
41	rc.bsdextended \
42	rc.firewall \
43	rc.initdiskless \
44	rc.shutdown \
45	rc.subr \
46	remote \
47	rpc \
48	services \
49	shells \
50	sysctl.conf \
51	syslog.conf \
52	termcap.small
53
54.if exists(${.CURDIR}/etc.${MACHINE}/ttys)
55BIN1+=	etc.${MACHINE}/ttys
56.elif exists(${.CURDIR}/etc.${MACHINE_ARCH}/ttys)
57BIN1+=	etc.${MACHINE_ARCH}/ttys
58.elif exists(${.CURDIR}/etc.${MACHINE_CPUARCH}/ttys)
59BIN1+=	etc.${MACHINE_CPUARCH}/ttys
60.else
61.error etc.MACHINE/ttys missing
62.endif
63
64OPENBSMDIR=			${.CURDIR}/../contrib/openbsm
65BSM_ETC_OPEN_FILES=		${OPENBSMDIR}/etc/audit_class \
66				${OPENBSMDIR}/etc/audit_event
67BSM_ETC_RESTRICTED_FILES=	${OPENBSMDIR}/etc/audit_control \
68				${OPENBSMDIR}/etc/audit_user
69BSM_ETC_EXEC_FILES=		${OPENBSMDIR}/etc/audit_warn
70BSM_ETC_DIR=			${DESTDIR}/etc/security
71
72# NB: keep these sorted by MK_* knobs
73
74.if ${MK_AMD} != "no"
75BIN1+= amd.map
76.endif
77
78.if ${MK_APM} != "no"
79BIN1+= apmd.conf
80.endif
81
82.if ${MK_AUTOFS} != "no"
83BIN1+= auto_master
84.endif
85
86.if ${MK_BSNMP} != "no"
87BIN1+= snmpd.config
88.endif
89
90.if ${MK_FREEBSD_UPDATE} != "no"
91BIN1+= freebsd-update.conf
92.endif
93
94.if ${MK_FTP} != "no"
95BIN1+= ftpusers
96.endif
97
98.if ${MK_INETD} != "no"
99BIN1+= inetd.conf
100.endif
101
102.if ${MK_LOCATE} != "no"
103BIN1+=	${.CURDIR}/../usr.bin/locate/locate/locate.rc
104.endif
105
106.if ${MK_LIB32} != "no"
107BIN1+=	libmap32.conf
108.endif
109
110.if ${MK_LPR} != "no"
111BIN1+=	hosts.lpd printcap
112.endif
113
114.if ${MK_MAIL} != "no"
115BIN1+=	${.CURDIR}/../usr.bin/mail/misc/mail.rc
116.endif
117
118.if ${MK_NTP} != "no"
119BIN1+=	ntp.conf
120.endif
121
122.if ${MK_OPENSSH} != "no"
123SSH=	${.CURDIR}/../crypto/openssh/ssh_config \
124	${.CURDIR}/../crypto/openssh/sshd_config \
125	${.CURDIR}/../crypto/openssh/moduli
126.endif
127.if ${MK_OPENSSL} != "no"
128SSL=	${.CURDIR}/../crypto/openssl/apps/openssl.cnf
129.endif
130
131.if ${MK_NS_CACHING} != "no"
132BIN1+= nscd.conf
133.endif
134
135.if ${MK_PORTSNAP} != "no"
136BIN1+= portsnap.conf
137.endif
138
139.if ${MK_PF} != "no"
140BIN1+= pf.os
141.endif
142
143.if ${MK_SENDMAIL} != "no"
144BIN1+=	rc.sendmail
145.endif
146
147.if ${MK_TCSH} != "no"
148BIN1+= csh.cshrc csh.login csh.logout
149.endif
150
151.if ${MK_WIRELESS} != "no"
152BIN1+= regdomain.xml
153.endif
154
155# -rwxr-xr-x root:wheel, for the new cron root:wheel
156BIN2=	netstart pccard_ether rc.suspend rc.resume
157
158MTREE=	BSD.include.dist BSD.root.dist BSD.usr.dist BSD.var.dist
159.if ${MK_TESTS} != "no"
160MTREE+=	BSD.tests.dist
161.endif
162.if ${MK_SENDMAIL} != "no"
163MTREE+=	BSD.sendmail.dist
164.endif
165.if ${MK_DEBUG_FILES} != "no"
166MTREE+=	BSD.debug.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	${_+_}cd ${.CURDIR}/pkg; ${MAKE} install
258	${_+_}cd ${.CURDIR}/rc.d; ${MAKE} install
259	${_+_}cd ${.CURDIR}/../share/termcap; ${MAKE} etc-termcap
260	${_+_}cd ${.CURDIR}/../usr.sbin/rmt; ${MAKE} etc-rmt
261	${_+_}cd ${.CURDIR}/pam.d; ${MAKE} install
262	cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 0444 \
263	    ${BSM_ETC_OPEN_FILES} ${BSM_ETC_DIR}
264	cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 0600 \
265	    ${BSM_ETC_RESTRICTED_FILES} ${BSM_ETC_DIR}
266	cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 0500 \
267	    ${BSM_ETC_EXEC_FILES} ${BSM_ETC_DIR}
268.if ${MK_UNBOUND} != "no"
269	if [ ! -e ${DESTDIR}/etc/unbound ]; then \
270		${INSTALL_SYMLINK} ../var/unbound ${DESTDIR}/etc/unbound; \
271	fi
272.endif
273.if ${MK_SENDMAIL} != "no"
274	${_+_}cd ${.CURDIR}/sendmail; ${MAKE} distribution
275.endif
276.if ${MK_OPENSSH} != "no"
277	cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
278	    ${SSH} ${DESTDIR}/etc/ssh
279.endif
280.if ${MK_OPENSSL} != "no"
281	cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
282	    ${SSL} ${DESTDIR}/etc/ssl
283.endif
284.if ${MK_KERBEROS} != "no"
285	cd ${.CURDIR}/root; \
286	    ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
287		dot.k5login ${DESTDIR}/root/.k5login;
288.endif
289	cd ${.CURDIR}/root; \
290	    ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
291		dot.profile ${DESTDIR}/root/.profile; \
292	    rm -f ${DESTDIR}/.profile; \
293	    ln ${DESTDIR}/root/.profile ${DESTDIR}/.profile
294.if ${MK_TCSH} != "no"
295	cd ${.CURDIR}/root; \
296	    ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
297		dot.cshrc ${DESTDIR}/root/.cshrc; \
298	    ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
299		dot.login ${DESTDIR}/root/.login; \
300	    rm -f ${DESTDIR}/.cshrc; \
301	    ln ${DESTDIR}/root/.cshrc ${DESTDIR}/.cshrc
302.endif
303	cd ${.CURDIR}/mtree; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
304	    ${MTREE} ${DESTDIR}/etc/mtree
305.if ${MK_PPP} != "no"
306	cd ${.CURDIR}/ppp; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 \
307	    ${PPPCNF} ${DESTDIR}/etc/ppp
308.endif
309.if ${MK_MAIL} != "no"
310	cd ${.CURDIR}/mail; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
311	    ${ETCMAIL} ${DESTDIR}/etc/mail
312	if [ -d ${DESTDIR}/etc/mail -a -f ${DESTDIR}/etc/mail/aliases -a \
313	      ! -f ${DESTDIR}/etc/aliases ]; then \
314		ln -s mail/aliases ${DESTDIR}/etc/aliases; \
315	fi
316.endif
317	${INSTALL} -o ${BINOWN} -g operator -m 664 /dev/null \
318	    ${DESTDIR}/etc/dumpdates
319	${INSTALL} -o nobody -g ${BINGRP} -m 644 /dev/null \
320	    ${DESTDIR}/var/db/locate.database
321	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 ${.CURDIR}/minfree \
322	    ${DESTDIR}/var/crash
323	cd ${.CURDIR}/..; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
324		${FREEBSD} ${DESTDIR}/
325.if ${MK_BOOT} != "no"
326.if exists(${.CURDIR}/../sys/${MACHINE}/conf/GENERIC.hints)
327	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
328	    ${.CURDIR}/../sys/${MACHINE}/conf/GENERIC.hints \
329	    ${DESTDIR}/boot/device.hints
330.endif
331.endif
332.if ${MK_NIS} == "no"
333	sed -i "" -e 's/.*_compat:/# &/' -e 's/compat$$/files/' \
334		${DESTDIR}/etc/nsswitch.conf
335.endif
336
337MTREE_CMD?=	mtree
338
339MTREES=		mtree/BSD.root.dist		/		\
340		mtree/BSD.var.dist		/var		\
341		mtree/BSD.usr.dist		/usr		\
342		mtree/BSD.include.dist		/usr/include
343.if ${MK_DEBUG_FILES} != "no"
344MTREES+=	mtree/BSD.debug.dist		/usr/lib
345.endif
346.if ${MK_GROFF} != "no"
347MTREES+=	mtree/BSD.groff.dist		/usr
348.endif
349.if ${MK_TESTS} != "no"
350MTREES+=	mtree/BSD.tests.dist		/usr
351.endif
352.if ${MK_SENDMAIL} != "no"
353MTREES+=	mtree/BSD.sendmail.dist		/
354.endif
355.for mtree in ${LOCAL_MTREE}
356MTREES+=	../${mtree}			/
357.endfor
358
359distrib-dirs: ${MTREES:N/*}
360	@set ${MTREES}; \
361	while test $$# -ge 2; do \
362		m=${.CURDIR}/$$1; \
363		shift; \
364		d=${DESTDIR}$$1; \
365		shift; \
366		${ECHO} ${MTREE_CMD} -deU ${MTREE_FOLLOWS_SYMLINKS} \
367		    -f $$m -p $$d; \
368		${MTREE_CMD} -deU ${MTREE_FOLLOWS_SYMLINKS} -f $$m -p $$d; \
369	done; true
370.if defined(NO_ROOT)
371	@set ${MTREES}; \
372	while test $$# -ge 2; do \
373		m=${.CURDIR}/$$1; \
374		shift; \
375		d=$$1; \
376		test "$$d" == "/" && d=""; \
377		d=${DISTBASE}$$d; \
378		shift; \
379		${ECHO} "${MTREE_CMD:N-W} -C -f $$m -K uname,gname | " \
380		    "sed s#^\.#.$$d# | ${METALOG.add}" ; \
381		${MTREE_CMD:N-W} -C -f $$m -K uname,gname | sed s#^\.#.$$d# | \
382		    ${METALOG.add} ; \
383	done; true
384.endif
385	${INSTALL_SYMLINK} usr/src/sys ${DESTDIR}/sys
386	cd ${DESTDIR}/usr/share/man; \
387	for mandir in man*; do \
388		${INSTALL_SYMLINK} ../$$mandir \
389		    ${DESTDIR}/usr/share/man/en.ISO8859-1/; \
390		${INSTALL_SYMLINK} ../$$mandir \
391		    ${DESTDIR}/usr/share/man/en.UTF-8/; \
392	done
393.if ${MK_OPENSSL} != "no"
394	cd ${DESTDIR}/usr/share/openssl/man; \
395	for mandir in man*; do \
396		${INSTALL_SYMLINK} ../$$mandir \
397		    ${DESTDIR}/usr/share/openssl/man/en.ISO8859-1/; \
398	done
399.endif
400	set - `grep "^[a-zA-Z]" ${.CURDIR}/man.alias`; \
401	while [ $$# -gt 0 ] ; do \
402		${INSTALL_SYMLINK} "$$2" "${DESTDIR}/usr/share/man/$$1"; \
403		if [ "${MK_OPENSSL}" != "no" ]; then \
404			${INSTALL_SYMLINK} "$$2" \
405			    "${DESTDIR}/usr/share/openssl/man/$$1"; \
406		fi; \
407		shift; shift; \
408	done
409.if ${MK_NLS} != "no"
410	set - `grep "^[a-zA-Z]" ${.CURDIR}/nls.alias`; \
411	while [ $$# -gt 0 ] ; do \
412		${INSTALL_SYMLINK} "$$2" "${DESTDIR}/usr/share/nls/$$1"; \
413		shift; shift; \
414	done
415.endif
416
417etc-examples:
418	cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
419	    ${BIN1} ${BIN2} nsmb.conf opieaccess \
420	    ${DESTDIR}/usr/share/examples/etc
421	${_+_}cd ${.CURDIR}/defaults; ${MAKE} install \
422	    DESTDIR=${DESTDIR}/usr/share/examples
423
424.include <bsd.prog.mk>
425