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