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