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