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