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