xref: /freebsd/etc/Makefile (revision 57de838fe7abf608bbec5b1d331a5e7452546866)
1#	from: @(#)Makefile	5.11 (Berkeley) 5/21/91
2# $FreeBSD$
3
4.include <src.opts.mk>
5
6SUBDIR=	\
7	newsyslog.conf.d
8
9.if ${MK_SENDMAIL} != "no"
10SUBDIR+=sendmail
11.endif
12
13.if ${MK_TESTS} != "no"
14SUBDIR+=tests
15.endif
16
17BIN1=	crontab \
18	devd.conf \
19	devfs.conf \
20	ddb.conf \
21	dhclient.conf \
22	disktab \
23	fbtab \
24	gettytab \
25	group \
26	hosts \
27	hosts.allow \
28	hosts.equiv \
29	libalias.conf \
30	libmap.conf \
31	login.access \
32	login.conf \
33	mac.conf \
34	motd \
35	netconfig \
36	network.subr \
37	networks \
38	newsyslog.conf \
39	nsswitch.conf \
40	phones \
41	profile \
42	protocols \
43	rc \
44	rc.initdiskless \
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_IPFW} != "no"
104BIN1+=	rc.firewall
105.endif
106
107.if ${MK_LOCATE} != "no"
108BIN1+=	${.CURDIR}/../usr.bin/locate/locate/locate.rc
109.endif
110
111.if ${MK_LIB32} != "no"
112BIN1+=	libmap32.conf
113.endif
114
115.if ${MK_LPR} != "no"
116BIN1+=	hosts.lpd printcap
117.endif
118
119.if ${MK_MAC_SUPPORT} != "no"
120BIN1+=	rc.bsdextended
121.endif
122
123.if ${MK_MAIL} != "no"
124BIN1+=	${.CURDIR}/../usr.bin/mail/misc/mail.rc
125.endif
126
127.if ${MK_NTP} != "no"
128BIN1+=	ntp.conf
129.endif
130
131.if ${MK_OPENSSH} != "no"
132SSH=	${.CURDIR}/../crypto/openssh/ssh_config \
133	${.CURDIR}/../crypto/openssh/sshd_config \
134	${.CURDIR}/../crypto/openssh/moduli
135.endif
136.if ${MK_OPENSSL} != "no"
137SSL=	${.CURDIR}/../crypto/openssl/apps/openssl.cnf
138.endif
139
140.if ${MK_NS_CACHING} != "no"
141BIN1+= nscd.conf
142.endif
143
144.if ${MK_PORTSNAP} != "no"
145BIN1+= portsnap.conf
146.endif
147
148.if ${MK_PF} != "no"
149BIN1+= pf.os
150.endif
151
152.if ${MK_SENDMAIL} != "no"
153BIN1+=	rc.sendmail
154.endif
155
156.if ${MK_TCSH} != "no"
157BIN1+= csh.cshrc csh.login csh.logout
158.endif
159
160.if ${MK_WIRELESS} != "no"
161BIN1+= regdomain.xml
162.endif
163
164# -rwxr-xr-x root:wheel, for the new cron root:wheel
165BIN2=	netstart pccard_ether rc.suspend rc.resume
166
167MTREE=	BSD.include.dist BSD.root.dist BSD.usr.dist BSD.var.dist
168.if ${MK_TESTS} != "no"
169MTREE+=	BSD.tests.dist
170.endif
171.if ${MK_SENDMAIL} != "no"
172MTREE+=	BSD.sendmail.dist
173.endif
174.if ${MK_DEBUG_FILES} != "no"
175MTREE+=	BSD.debug.dist
176.endif
177
178PPPCNF=	ppp.conf
179
180.if ${MK_SENDMAIL} == "no"
181ETCMAIL=mailer.conf aliases
182.else
183ETCMAIL=Makefile README mailer.conf access.sample virtusertable.sample \
184	mailertable.sample aliases
185.endif
186
187# Special top level files for FreeBSD
188FREEBSD=COPYRIGHT
189
190# Sanitize DESTDIR
191DESTDIR:=	${DESTDIR:C://*:/:g}
192
193afterinstall:
194.if ${MK_MAN} != "no"
195	${_+_}cd ${.CURDIR}/../share/man; ${MAKE} makedb
196.endif
197
198distribute:
199	# Avoid installing tests here; "make distribution" will do this and
200	# correctly place them in the right location.
201	${_+_}cd ${.CURDIR} ; ${MAKE} MK_TESTS=no install \
202	    DESTDIR=${DISTDIR}/${DISTRIBUTION}
203	${_+_}cd ${.CURDIR} ; ${MAKE} distribution DESTDIR=${DISTDIR}/${DISTRIBUTION}
204
205.include <bsd.endian.mk>
206.if ${TARGET_ENDIANNESS} == "1234"
207CAP_MKDB_ENDIAN?= -l
208PWD_MKDB_ENDIAN?= -L
209.elif ${TARGET_ENDIANNESS} == "4321"
210CAP_MKDB_ENDIAN?= -b
211PWD_MKDB_ENDIAN?= -B
212.else
213CAP_MKDB_ENDIAN?=
214PWD_MKDB_ENDIAN?=
215.endif
216
217.if defined(NO_ROOT)
218METALOG.add?=	cat -l >> ${METALOG}
219.endif
220
221distribution:
222.if !defined(DESTDIR)
223	@echo "set DESTDIR before running \"make ${.TARGET}\""
224	@false
225.endif
226	cd ${.CURDIR}; \
227	    ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
228		${BIN1} ${DESTDIR}/etc; \
229	    cap_mkdb ${CAP_MKDB_ENDIAN} ${DESTDIR}/etc/login.conf; \
230	    ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 755 \
231		${BIN2} ${DESTDIR}/etc; \
232	    ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 \
233		master.passwd nsmb.conf opieaccess ${DESTDIR}/etc;
234.if ${MK_AT} == "no"
235	sed -i "" -e 's;.*/usr/libexec/atrun;#&;' ${DESTDIR}/etc/crontab
236.endif
237.if ${MK_TCSH} == "no"
238	sed -i "" -e 's;/bin/csh;/bin/sh;' ${DESTDIR}/etc/master.passwd
239.endif
240	pwd_mkdb ${PWD_MKDB_ENDIAN} -i -p -d ${DESTDIR}/etc \
241	    ${DESTDIR}/etc/master.passwd
242.if defined(NO_ROOT)
243	( \
244		echo "./etc/login.conf.db type=file mode=0644 uname=root gname=wheel"; \
245		echo "./etc/passwd type=file mode=0644 uname=root gname=wheel"; \
246		echo "./etc/pwd.db type=file mode=0644 uname=root gname=wheel"; \
247		echo "./etc/spwd.db type=file mode=0600 uname=root gname=wheel"; \
248	) | ${METALOG.add}
249.endif
250.if ${MK_AUTOFS} != "no"
251	${_+_}cd ${.CURDIR}/autofs; ${MAKE} install
252.endif
253.if ${MK_BLUETOOTH} != "no"
254	${_+_}cd ${.CURDIR}/bluetooth; ${MAKE} install
255.endif
256.if ${MK_CASPER} != "no"
257	${_+_}cd ${.CURDIR}/casper; ${MAKE} install
258.endif
259	${_+_}cd ${.CURDIR}/defaults; ${MAKE} install
260	${_+_}cd ${.CURDIR}/devd; ${MAKE} install
261.if ${MK_DMAGENT} != "no"
262	${_+_}cd ${.CURDIR}/dma; ${MAKE} install
263.endif
264.if ${MK_GSSAPI} != "no"
265	${_+_}cd ${.CURDIR}/gss; ${MAKE} install
266.endif
267	${_+_}cd ${.CURDIR}/periodic; ${MAKE} install
268.if ${MK_PKGBOOTSTRAP} != "no"
269	${_+_}cd ${.CURDIR}/pkg; ${MAKE} install
270.endif
271	${_+_}cd ${.CURDIR}/rc.d; ${MAKE} install
272	${_+_}cd ${.CURDIR}/../share/termcap; ${MAKE} etc-termcap
273	${_+_}cd ${.CURDIR}/../usr.sbin/rmt; ${MAKE} etc-rmt
274	${_+_}cd ${.CURDIR}/pam.d; ${MAKE} install
275.if ${MK_AUDIT} != "no"
276	cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 0444 \
277	    ${BSM_ETC_OPEN_FILES} ${BSM_ETC_DIR}
278	cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 0600 \
279	    ${BSM_ETC_RESTRICTED_FILES} ${BSM_ETC_DIR}
280	cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 0500 \
281	    ${BSM_ETC_EXEC_FILES} ${BSM_ETC_DIR}
282.endif
283.if ${MK_UNBOUND} != "no"
284	if [ ! -e ${DESTDIR}/etc/unbound ]; then \
285		${INSTALL_SYMLINK} ../var/unbound ${DESTDIR}/etc/unbound; \
286	fi
287.endif
288.if ${MK_SENDMAIL} != "no"
289	${_+_}cd ${.CURDIR}/sendmail; ${MAKE} distribution
290.endif
291.if ${MK_OPENSSH} != "no"
292	cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
293	    ${SSH} ${DESTDIR}/etc/ssh
294.endif
295.if ${MK_OPENSSL} != "no"
296	cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
297	    ${SSL} ${DESTDIR}/etc/ssl
298.endif
299.if ${MK_KERBEROS} != "no"
300	cd ${.CURDIR}/root; \
301	    ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
302		dot.k5login ${DESTDIR}/root/.k5login;
303.endif
304	cd ${.CURDIR}/root; \
305	    ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
306		dot.profile ${DESTDIR}/root/.profile; \
307	    rm -f ${DESTDIR}/.profile; \
308	    ln ${DESTDIR}/root/.profile ${DESTDIR}/.profile
309.if ${MK_TCSH} != "no"
310	cd ${.CURDIR}/root; \
311	    ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
312		dot.cshrc ${DESTDIR}/root/.cshrc; \
313	    ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
314		dot.login ${DESTDIR}/root/.login; \
315	    rm -f ${DESTDIR}/.cshrc; \
316	    ln ${DESTDIR}/root/.cshrc ${DESTDIR}/.cshrc
317.endif
318	cd ${.CURDIR}/mtree; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
319	    ${MTREE} ${DESTDIR}/etc/mtree
320.if ${MK_PPP} != "no"
321	cd ${.CURDIR}/ppp; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 \
322	    ${PPPCNF} ${DESTDIR}/etc/ppp
323.endif
324.if ${MK_MAIL} != "no"
325	cd ${.CURDIR}/mail; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
326	    ${ETCMAIL} ${DESTDIR}/etc/mail
327	if [ -d ${DESTDIR}/etc/mail -a -f ${DESTDIR}/etc/mail/aliases -a \
328	      ! -f ${DESTDIR}/etc/aliases ]; then \
329		ln -s mail/aliases ${DESTDIR}/etc/aliases; \
330	fi
331.endif
332	${INSTALL} -o ${BINOWN} -g operator -m 664 /dev/null \
333	    ${DESTDIR}/etc/dumpdates
334.if ${MK_LOCATE} != "no"
335	${INSTALL} -o nobody -g ${BINGRP} -m 644 /dev/null \
336	    ${DESTDIR}/var/db/locate.database
337.endif
338	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 ${.CURDIR}/minfree \
339	    ${DESTDIR}/var/crash
340	cd ${.CURDIR}/..; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
341		${FREEBSD} ${DESTDIR}/
342.if ${MK_BOOT} != "no"
343.if exists(${.CURDIR}/../sys/${MACHINE}/conf/GENERIC.hints)
344	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
345	    ${.CURDIR}/../sys/${MACHINE}/conf/GENERIC.hints \
346	    ${DESTDIR}/boot/device.hints
347.endif
348.endif
349.if ${MK_NIS} == "no"
350	sed -i "" -e 's/.*_compat:/# &/' -e 's/compat$$/files/' \
351		${DESTDIR}/etc/nsswitch.conf
352.endif
353
354MTREE_CMD?=	mtree
355
356MTREES=		mtree/BSD.root.dist		/		\
357		mtree/BSD.var.dist		/var		\
358		mtree/BSD.usr.dist		/usr		\
359		mtree/BSD.include.dist		/usr/include
360.if ${MK_DEBUG_FILES} != "no"
361MTREES+=	mtree/BSD.debug.dist		/usr/lib
362.endif
363.if ${MK_GROFF} != "no"
364MTREES+=	mtree/BSD.groff.dist		/usr
365.endif
366.if ${MK_TESTS} != "no"
367MTREES+=	mtree/BSD.tests.dist		${TESTSBASE}
368.endif
369.if ${MK_SENDMAIL} != "no"
370MTREES+=	mtree/BSD.sendmail.dist		/
371.endif
372.for mtree in ${LOCAL_MTREE}
373MTREES+=	../${mtree}			/
374.endfor
375
376distrib-dirs: ${MTREES:N/*}
377	@set ${MTREES}; \
378	while test $$# -ge 2; do \
379		m=${.CURDIR}/$$1; \
380		shift; \
381		d=${DESTDIR}$$1; \
382		shift; \
383		test -d $$d || mkdir -p $$d; \
384		${ECHO} ${MTREE_CMD} -deU ${MTREE_FOLLOWS_SYMLINKS} \
385		    -f $$m -p $$d; \
386		${MTREE_CMD} -deU ${MTREE_FOLLOWS_SYMLINKS} -f $$m -p $$d; \
387	done; true
388.if defined(NO_ROOT)
389	@set ${MTREES}; \
390	while test $$# -ge 2; do \
391		m=${.CURDIR}/$$1; \
392		shift; \
393		d=$$1; \
394		test "$$d" == "/" && d=""; \
395		d=${DISTBASE}$$d; \
396		shift; \
397		test -d $$d || mkdir -p $$d; \
398		${ECHO} "${MTREE_CMD:N-W} -C -f $$m -K uname,gname | " \
399		    "sed s#^\.#.$$d# | ${METALOG.add}" ; \
400		${MTREE_CMD:N-W} -C -f $$m -K uname,gname | sed s#^\.#.$$d# | \
401		    ${METALOG.add} ; \
402	done; true
403.endif
404	${INSTALL_SYMLINK} usr/src/sys ${DESTDIR}/sys
405.if ${MK_MAN} != "no"
406	cd ${DESTDIR}/usr/share/man; \
407	for mandir in man*; do \
408		${INSTALL_SYMLINK} ../$$mandir \
409		    ${DESTDIR}/usr/share/man/en.ISO8859-1/; \
410		${INSTALL_SYMLINK} ../$$mandir \
411		    ${DESTDIR}/usr/share/man/en.UTF-8/; \
412	done
413.if ${MK_OPENSSL} != "no"
414	cd ${DESTDIR}/usr/share/openssl/man; \
415	for mandir in man*; do \
416		${INSTALL_SYMLINK} ../$$mandir \
417		    ${DESTDIR}/usr/share/openssl/man/en.ISO8859-1/; \
418	done
419.endif
420	set - `grep "^[a-zA-Z]" ${.CURDIR}/man.alias`; \
421	while [ $$# -gt 0 ] ; do \
422		${INSTALL_SYMLINK} "$$2" "${DESTDIR}/usr/share/man/$$1"; \
423		if [ "${MK_OPENSSL}" != "no" ]; then \
424			${INSTALL_SYMLINK} "$$2" \
425			    "${DESTDIR}/usr/share/openssl/man/$$1"; \
426		fi; \
427		shift; shift; \
428	done
429.endif
430.if ${MK_NLS} != "no"
431	set - `grep "^[a-zA-Z]" ${.CURDIR}/nls.alias`; \
432	while [ $$# -gt 0 ] ; do \
433		${INSTALL_SYMLINK} "$$2" "${DESTDIR}/usr/share/nls/$$1"; \
434		shift; shift; \
435	done
436.endif
437
438etc-examples:
439	cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
440	    ${BIN1} ${BIN2} nsmb.conf opieaccess \
441	    ${DESTDIR}/usr/share/examples/etc
442	${_+_}cd ${.CURDIR}/defaults; ${MAKE} install \
443	    DESTDIR=${DESTDIR}/usr/share/examples
444
445.include <bsd.prog.mk>
446