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