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