Makefile revision 245571
176861Skris#	from: @(#)Makefile	5.11 (Berkeley) 5/21/91
276861Skris# $FreeBSD: head/etc/Makefile 245571 2013-01-17 20:21:30Z brooks $
376861Skris
476861Skris.include <bsd.own.mk>
576861Skris
676861Skris.if ${MK_SENDMAIL} != "no"
776861SkrisSUBDIR=	sendmail
876861Skris.endif
9233052Sdim
1096316SobrienBIN1=	crontab \
11240468Sbrooks	devd.conf \
12240468Sbrooks	devfs.conf \
13189801Srdivacky	ddb.conf \
14233052Sdim	dhclient.conf \
15189801Srdivacky	disktab \
16220863Sdim	fbtab \
17233052Sdim	ftpusers \
18220863Sdim	gettytab \
19233052Sdim	group \
20220863Sdim	hosts \
21233052Sdim	hosts.allow \
22220863Sdim	hosts.equiv \
23233052Sdim	inetd.conf \
24233052Sdim	libalias.conf \
25233052Sdim	login.access \
26233052Sdim	login.conf \
27220863Sdim	mac.conf \
28161214Sdes	motd \
29233052Sdim	netconfig \
30233052Sdim	network.subr \
31233052Sdim	networks \
32233052Sdim	newsyslog.conf \
33240468Sbrooks	nsswitch.conf \
34240468Sbrooks	phones \
35233052Sdim	profile \
36233052Sdim	protocols \
37233052Sdim	rc \
38233052Sdim	rc.bsdextended \
39233052Sdim	rc.firewall \
40233052Sdim	rc.initdiskless \
41233052Sdim	rc.sendmail \
42233052Sdim	rc.shutdown \
43233052Sdim	rc.subr \
44233052Sdim	remote \
45233052Sdim	rpc \
46233052Sdim	services \
47233052Sdim	shells \
48240468Sbrooks	sysctl.conf \
49240468Sbrooks	syslog.conf \
50233052Sdim	termcap.small
51233052Sdim
52233052Sdim.if exists(${.CURDIR}/etc.${MACHINE}/ttys)
5394332SobrienBIN1+=	etc.${MACHINE}/ttys
54233052Sdim.elif exists(${.CURDIR}/etc.${MACHINE_ARCH}/ttys)
55233052SdimBIN1+=	etc.${MACHINE_ARCH}/ttys
56233052Sdim.elif exists(${.CURDIR}/etc.${MACHINE_CPUARCH}/ttys)
57249657SedBIN1+=	etc.${MACHINE_CPUARCH}/ttys
58249657Sed.else
59249657Sed.error etc.MACHINE/ttys missing
60249657Sed.endif
61233052Sdim
62233052SdimOPENBSMDIR=			${.CURDIR}/../contrib/openbsm
6388936SdwmaloneBSM_ETC_OPEN_FILES=		${OPENBSMDIR}/etc/audit_class \
6488936Sdwmalone				${OPENBSMDIR}/etc/audit_event
65233052SdimBSM_ETC_RESTRICTED_FILES=	${OPENBSMDIR}/etc/audit_control \
66233052Sdim				${OPENBSMDIR}/etc/audit_user
67233052SdimBSM_ETC_EXEC_FILES=		${OPENBSMDIR}/etc/audit_warn
68228546SdimBSM_ETC_DIR=			${DESTDIR}/etc/security
69228546Sdim
70240468Sbrooks# NB: keep these sorted by MK_* knobs
71234353Sdim
72279793Sdim.if ${MK_AMD} != "no"
73279793SdimBIN1+= amd.map
74279793Sdim.endif
75279793Sdim
76234353Sdim.if ${MK_APM} != "no"
77233052SdimBIN1+= apmd.conf
78233052Sdim.endif
79259158Sdim
80233052Sdim.if ${MK_BSNMP} != "no"
81233052SdimBIN1+= snmpd.config
82246880Sdim.endif
83233052Sdim
84233052Sdim.if ${MK_FREEBSD_UPDATE} != "no"
85233052SdimBIN1+= freebsd-update.conf
86233052Sdim.endif
87233052Sdim
88233052Sdim.if ${MK_LOCATE} != "no"
89233052SdimBIN1+=	${.CURDIR}/../usr.bin/locate/locate/locate.rc
90233052Sdim.endif
91233052Sdim
9276861Skris.if ${MK_LPR} != "no"
93233052SdimBIN1+=	hosts.lpd printcap
94233052Sdim.endif
95233052Sdim
96233052Sdim.if ${MK_MAIL} != "no"
97233052SdimBIN1+=	${.CURDIR}/../usr.bin/mail/misc/mail.rc
98233052Sdim.endif
99233052Sdim
100240468Sbrooks.if ${MK_NTP} != "no"
101234353SdimBIN1+=	ntp.conf
102234353Sdim.endif
103234353Sdim
104234353Sdim.if ${MK_OPENSSH} != "no"
105240468SbrooksSSH=	${.CURDIR}/../crypto/openssh/ssh_config \
106240468Sbrooks	${.CURDIR}/../crypto/openssh/sshd_config \
107233052Sdim	${.CURDIR}/../crypto/openssh/moduli
108233052Sdim.endif
109233052Sdim.if ${MK_OPENSSL} != "no"
110233052SdimSSL=	${.CURDIR}/../crypto/openssl/apps/openssl.cnf
111240468Sbrooks.endif
112233052Sdim
113233052Sdim.if ${MK_NS_CACHING} != "no"
114233052SdimBIN1+= nscd.conf
11576861Skris.endif
116163971Sjb
117233052Sdim.if ${MK_PORTSNAP} != "no"
118233052SdimBIN1+= portsnap.conf
119163971Sjb.endif
120260096Sdim
121260096Sdim.if ${MK_PF} != "no"
122233052SdimBIN1+= pf.os
123234353Sdim.endif
124233052Sdim
125234353Sdim.if ${MK_TCSH} != "no"
126263763SdimBIN1+= csh.cshrc csh.login csh.logout
127263763Sdim.endif
128263763Sdim
129263763Sdim.if ${MK_WIRELESS} != "no"
130262459SdimBIN1+= regdomain.xml
131262459Sdim.endif
132262459Sdim
133262459Sdim# -rwxr-xr-x root:wheel, for the new cron root:wheel
134262459SdimBIN2=	netstart pccard_ether rc.suspend rc.resume
135262459Sdim
136260096SdimMTREE=	BSD.include.dist BSD.root.dist BSD.usr.dist BSD.var.dist
137260096Sdim.if ${MK_SENDMAIL} != "no"
138260096SdimMTREE+=	BSD.sendmail.dist
139260495Sdim.endif
140260096Sdim.if ${MK_BIND} != "no"
141260096SdimMTREE+=	BIND.chroot.dist
142233052Sdim.if ${MK_BIND_LIBS} != "no"
143260096SdimMTREE+=	BIND.include.dist
144232263Sdim.endif
145220863Sdim.endif
146220863Sdim
147180012SruPPPCNF=	ppp.conf
148233052Sdim
149233052Sdim.if ${MK_SENDMAIL} == "no"
150233052SdimETCMAIL=mailer.conf aliases
151180012Sru.else
152294974SsmhETCMAIL=Makefile README mailer.conf access.sample virtusertable.sample \
153294974Ssmh	mailertable.sample aliases
154294974Ssmh.endif
155241298Smarcel
156241298Smarcel# Special top level files for FreeBSD
157241298SmarcelFREEBSD=COPYRIGHT
158241298Smarcel
159241298Smarcelafterinstall:
160241298Smarcel.if ${MK_MAN} != "no"
161241298Smarcel	${_+_}cd ${.CURDIR}/../share/man; ${MAKE} makedb
162262964Sache.endif
163241298Smarcel
164262964Sachedistribute:
165241298Smarcel	${_+_}cd ${.CURDIR} ; ${MAKE} install DESTDIR=${DISTDIR}/${DISTRIBUTION}
166241298Smarcel	${_+_}cd ${.CURDIR} ; ${MAKE} distribution DESTDIR=${DISTDIR}/${DISTRIBUTION}
167241298Smarcel
168262964Sache.include <bsd.endian.mk>
169262964Sache.if ${TARGET_ENDIANNESS} == "1234"
170262964SacheCAP_MKDB_ENDIAN?= -l
171262964SachePWD_MKDB_ENDIAN?= -L
172241298Smarcel.elif ${TARGET_ENDIANNESS} == "4321"
173241298SmarcelCAP_MKDB_ENDIAN?= -b
174PWD_MKDB_ENDIAN?= -B
175.else
176CAP_MKDB_ENDIAN?=
177PWD_MKDB_ENDIAN?=
178.endif
179
180distribution:
181.if !defined(DESTDIR)
182	@echo "set DESTDIR before running \"make ${.TARGET}\""
183	@false
184.endif
185	cd ${.CURDIR}; \
186	    ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
187		${BIN1} ${DESTDIR}/etc; \
188	    cap_mkdb ${CAP_MKDB_ENDIAN} ${DESTDIR}/etc/login.conf; \
189	    ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 755 \
190		${BIN2} ${DESTDIR}/etc; \
191	    ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 \
192		master.passwd nsmb.conf opieaccess ${DESTDIR}/etc;
193.if ${MK_AT} == "no"
194	sed -i "" -e 's;.*/usr/libexec/atrun;#&;' ${DESTDIR}/etc/crontab
195.endif
196.if ${MK_TCSH} == "no"
197	sed -i "" -e 's;/bin/csh;/bin/sh;' ${DESTDIR}/etc/master.passwd
198.endif
199	pwd_mkdb ${PWD_MKDB_ENDIAN} -i -p -d ${DESTDIR}/etc \
200	    ${DESTDIR}/etc/master.passwd
201.if ${MK_ATF} != "no"
202	${_+_}cd ${.CURDIR}/atf; ${MAKE} install
203.endif
204.if ${MK_BLUETOOTH} != "no"
205	${_+_}cd ${.CURDIR}/bluetooth; ${MAKE} install
206.endif
207	${_+_}cd ${.CURDIR}/defaults; ${MAKE} install
208	${_+_}cd ${.CURDIR}/devd; ${MAKE} install
209	${_+_}cd ${.CURDIR}/gss; ${MAKE} install
210	${_+_}cd ${.CURDIR}/periodic; ${MAKE} install
211	${_+_}cd ${.CURDIR}/rc.d; ${MAKE} install
212	${_+_}cd ${.CURDIR}/../gnu/usr.bin/send-pr; ${MAKE} etc-gnats-freefall
213	${_+_}cd ${.CURDIR}/../share/termcap; ${MAKE} etc-termcap
214	${_+_}cd ${.CURDIR}/../usr.sbin/rmt; ${MAKE} etc-rmt
215	${_+_}cd ${.CURDIR}/pam.d; ${MAKE} install
216	cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 0444 \
217	    ${BSM_ETC_OPEN_FILES} ${BSM_ETC_DIR}
218	cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 0600 \
219	    ${BSM_ETC_RESTRICTED_FILES} ${BSM_ETC_DIR}
220	cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 0500 \
221	    ${BSM_ETC_EXEC_FILES} ${BSM_ETC_DIR}
222.if ${MK_BIND_MTREE} != "no"
223	if [ ! -e ${DESTDIR}/etc/namedb ]; then \
224		ln -s ../var/named/etc/namedb ${DESTDIR}/etc/namedb; \
225	fi
226.endif
227.if ${MK_BIND_ETC} != "no"
228	${_+_}cd ${.CURDIR}/namedb; ${MAKE} install
229.endif
230.if ${MK_SENDMAIL} != "no"
231	${_+_}cd ${.CURDIR}/sendmail; ${MAKE} distribution
232.endif
233.if ${MK_OPENSSH} != "no"
234	cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
235	    ${SSH} ${DESTDIR}/etc/ssh
236.endif
237.if ${MK_OPENSSL} != "no"
238	cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
239	    ${SSL} ${DESTDIR}/etc/ssl
240.endif
241.if ${MK_KERBEROS} != "no"
242	cd ${.CURDIR}/root; \
243	    ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
244		dot.k5login ${DESTDIR}/root/.k5login;
245.endif
246	cd ${.CURDIR}/root; \
247	    ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
248		dot.profile ${DESTDIR}/root/.profile; \
249	    rm -f ${DESTDIR}/.profile; \
250	    ln ${DESTDIR}/root/.profile ${DESTDIR}/.profile
251.if ${MK_TCSH} != "no"
252	cd ${.CURDIR}/root; \
253	    ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
254		dot.cshrc ${DESTDIR}/root/.cshrc; \
255	    ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
256		dot.login ${DESTDIR}/root/.login; \
257	    rm -f ${DESTDIR}/.cshrc; \
258	    ln ${DESTDIR}/root/.cshrc ${DESTDIR}/.cshrc
259.endif
260	cd ${.CURDIR}/mtree; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
261	    ${MTREE} ${DESTDIR}/etc/mtree
262.if ${MK_PPP} != "no"
263	cd ${.CURDIR}/ppp; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 \
264	    ${PPPCNF} ${DESTDIR}/etc/ppp
265.endif
266.if ${MK_MAIL} != "no"
267	cd ${.CURDIR}/mail; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
268	    ${ETCMAIL} ${DESTDIR}/etc/mail
269	if [ -d ${DESTDIR}/etc/mail -a -f ${DESTDIR}/etc/mail/aliases -a \
270	      ! -f ${DESTDIR}/etc/aliases ]; then \
271		ln -s mail/aliases ${DESTDIR}/etc/aliases; \
272	fi
273.endif
274	${INSTALL} -o ${BINOWN} -g operator -m 664 /dev/null \
275	    ${DESTDIR}/etc/dumpdates
276	${INSTALL} -o nobody -g ${BINGRP} -m 644 /dev/null \
277	    ${DESTDIR}/var/db/locate.database
278	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 ${.CURDIR}/minfree \
279	    ${DESTDIR}/var/crash
280	cd ${.CURDIR}/..; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
281		${FREEBSD} ${DESTDIR}/
282.if ${MK_BOOT} != "no"
283.if exists(${.CURDIR}/../sys/${MACHINE}/conf/GENERIC.hints)
284	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
285	    ${.CURDIR}/../sys/${MACHINE}/conf/GENERIC.hints \
286	    ${DESTDIR}/boot/device.hints
287.endif
288.endif
289.if ${MK_NIS} == "no"
290	sed -i "" -e 's/.*_compat:/# &/' -e 's/compat$$/files/' \
291		${DESTDIR}/etc/nsswitch.conf
292.endif
293
294MTREE_CMD?=	mtree
295
296MTREES=		mtree/BSD.root.dist		/		\
297		mtree/BSD.var.dist		/var		\
298		mtree/BSD.usr.dist		/usr		\
299		mtree/BSD.include.dist		/usr/include
300.if ${MK_BIND_LIBS} != "no"
301MTREES+=	mtree/BIND.include.dist		/usr/include
302.endif
303.if ${MK_BIND_MTREE} != "no"
304MTREES+=	mtree/BIND.chroot.dist		/var/named
305.endif
306.if ${MK_GROFF} != "no"
307MTREES+=	mtree/BSD.groff.dist		/usr
308.endif
309.if ${MK_SENDMAIL} != "no"
310MTREES+=	mtree/BSD.sendmail.dist		/
311.endif
312.for mtree in ${LOCAL_MTREE}
313MTREES+=	../${mtree}			/
314.endfor
315
316distrib-dirs:
317	@set ${MTREES}; \
318	while test $$# -ge 2; do \
319		m=${.CURDIR}/$$1; \
320		shift; \
321		d=${DESTDIR}$$1; \
322		shift; \
323		${ECHO} ${MTREE_CMD} -deU ${MTREE_FOLLOWS_SYMLINKS} \
324		    -f $$m -p $$d; \
325		${MTREE_CMD} -deU ${MTREE_FOLLOWS_SYMLINKS} -f $$m -p $$d; \
326	done; true
327	ln -sf usr/src/sys ${DESTDIR}/sys
328	cd ${DESTDIR}/usr/share/man; \
329	for mandir in man*; do \
330		ln -sf ../$$mandir ${DESTDIR}/usr/share/man/en.ISO8859-1/; \
331		ln -sf ../$$mandir ${DESTDIR}/usr/share/man/en.UTF-8/; \
332	done
333	cd ${DESTDIR}/usr/share/openssl/man; \
334	for mandir in man*; do \
335		ln -sf ../$$mandir \
336		    ${DESTDIR}/usr/share/openssl/man/en.ISO8859-1/; \
337	done
338	set - `grep "^[a-zA-Z]" ${.CURDIR}/man.alias`; \
339	while [ $$# -gt 0 ] ; do \
340		ln -sf "$$2" "${DESTDIR}/usr/share/man/$$1"; \
341		ln -sf "$$2" "${DESTDIR}/usr/share/openssl/man/$$1"; \
342		shift; shift; \
343	done
344	set - `grep "^[a-zA-Z]" ${.CURDIR}/nls.alias`; \
345	while [ $$# -gt 0 ] ; do \
346		ln -sf "$$2" "${DESTDIR}/usr/share/nls/$$1"; \
347		shift; shift; \
348	done
349
350etc-examples:
351	cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
352	    ${BIN1} ${BIN2} nsmb.conf opieaccess \
353	    ${DESTDIR}/usr/share/examples/etc
354	${_+_}cd ${.CURDIR}/defaults; ${MAKE} install \
355	    DESTDIR=${DESTDIR}/usr/share/examples
356
357.include <bsd.prog.mk>
358