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