Makefile revision 255413
1877Sache#	from: @(#)Makefile	5.11 (Berkeley) 5/21/91
276588Sjoerg# $FreeBSD: head/etc/Makefile 255413 2013-09-09 06:02:30Z des $
31019Sache
4877Sache.include <bsd.own.mk>
51019Sache
61019Sache.if ${MK_SENDMAIL} != "no"
71019SacheSUBDIR=	sendmail
81019Sache.endif
91019Sache
101019SacheBIN1=	crontab \
111019Sache	devd.conf \
121019Sache	devfs.conf \
13877Sache	ddb.conf \
142838Sdg	dhclient.conf \
152838Sdg	disktab \
162838Sdg	fbtab \
172838Sdg	ftpusers \
182838Sdg	gettytab \
192838Sdg	group \
202838Sdg	hosts \
212838Sdg	hosts.allow \
222838Sdg	hosts.equiv \
232838Sdg	inetd.conf \
242838Sdg	libalias.conf \
252838Sdg	libmap.conf \
261817Sdg	login.access \
2750477Speter	login.conf \
28877Sache	mac.conf \
29877Sache	motd \
3018444Sbde	netconfig \
3118444Sbde	network.subr \
32877Sache	networks \
3355205Speter	newsyslog.conf \
34877Sache	nsswitch.conf \
3518444Sbde	phones \
3618444Sbde	profile \
37877Sache	protocols \
38877Sache	rc \
39877Sache	rc.bsdextended \
40877Sache	rc.firewall \
41877Sache	rc.initdiskless \
42877Sache	rc.sendmail \
43877Sache	rc.shutdown \
44877Sache	rc.subr \
45877Sache	remote \
46877Sache	rpc \
47877Sache	services \
48877Sache	shells \
49877Sache	sysctl.conf \
50877Sache	syslog.conf \
5113765Smpp	termcap.small
52877Sache
53877Sache.if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "powerpc64"
54877SacheBIN1+=	libmap32.conf
55877Sache.endif
56877Sache
57877Sache.if exists(${.CURDIR}/etc.${MACHINE}/ttys)
58877SacheBIN1+=	etc.${MACHINE}/ttys
59877Sache.elif exists(${.CURDIR}/etc.${MACHINE_ARCH}/ttys)
60877SacheBIN1+=	etc.${MACHINE_ARCH}/ttys
61877Sache.elif exists(${.CURDIR}/etc.${MACHINE_CPUARCH}/ttys)
62877SacheBIN1+=	etc.${MACHINE_CPUARCH}/ttys
63877Sache.else
64877Sache.error etc.MACHINE/ttys missing
65877Sache.endif
66877Sache
67877SacheOPENBSMDIR=			${.CURDIR}/../contrib/openbsm
68877SacheBSM_ETC_OPEN_FILES=		${OPENBSMDIR}/etc/audit_class \
69877Sache				${OPENBSMDIR}/etc/audit_event
70877SacheBSM_ETC_RESTRICTED_FILES=	${OPENBSMDIR}/etc/audit_control \
71877Sache				${OPENBSMDIR}/etc/audit_user
72877SacheBSM_ETC_EXEC_FILES=		${OPENBSMDIR}/etc/audit_warn
73877SacheBSM_ETC_DIR=			${DESTDIR}/etc/security
74877Sache
75877Sache# NB: keep these sorted by MK_* knobs
76877Sache
77877Sache.if ${MK_AMD} != "no"
78877SacheBIN1+= amd.map
79877Sache.endif
80877Sache
81877Sache.if ${MK_APM} != "no"
82877SacheBIN1+= apmd.conf
83877Sache.endif
84877Sache
85877Sache.if ${MK_BSNMP} != "no"
86877SacheBIN1+= snmpd.config
87877Sache.endif
88877Sache
89877Sache.if ${MK_FREEBSD_UPDATE} != "no"
90877SacheBIN1+= freebsd-update.conf
91877Sache.endif
92877Sache
93877Sache.if ${MK_LOCATE} != "no"
94877SacheBIN1+=	${.CURDIR}/../usr.bin/locate/locate/locate.rc
95877Sache.endif
96891Sache
97891Sache.if ${MK_LPR} != "no"
98877SacheBIN1+=	hosts.lpd printcap
99877Sache.endif
10076588Sjoerg
10176588Sjoerg.if ${MK_MAIL} != "no"
10276588SjoergBIN1+=	${.CURDIR}/../usr.bin/mail/misc/mail.rc
10376588Sjoerg.endif
104877Sache
105877Sache.if ${MK_NTP} != "no"
1062838SdgBIN1+=	ntp.conf
107877Sache.endif
1082838Sdg
1092838Sdg.if ${MK_OPENSSH} != "no"
1102838SdgSSH=	${.CURDIR}/../crypto/openssh/ssh_config \
1114009Sjoerg	${.CURDIR}/../crypto/openssh/sshd_config \
1124009Sjoerg	${.CURDIR}/../crypto/openssh/moduli
11376588Sjoerg.endif
1142838Sdg.if ${MK_OPENSSL} != "no"
1153095SjoergSSL=	${.CURDIR}/../crypto/openssl/apps/openssl.cnf
11676588Sjoerg.endif
11776588Sjoerg
11876588Sjoerg.if ${MK_NS_CACHING} != "no"
11976588SjoergBIN1+= nscd.conf
12076588Sjoerg.endif
12176588Sjoerg
12276588Sjoerg.if ${MK_PORTSNAP} != "no"
12376588SjoergBIN1+= portsnap.conf
12476588Sjoerg.endif
12576588Sjoerg
12676588Sjoerg.if ${MK_PF} != "no"
12776588SjoergBIN1+= pf.os
1283095Sjoerg.endif
1293095Sjoerg
1303095Sjoerg.if ${MK_TCSH} != "no"
1313095SjoergBIN1+= csh.cshrc csh.login csh.logout
1323095Sjoerg.endif
1333095Sjoerg
1343095Sjoerg.if ${MK_WIRELESS} != "no"
1353095SjoergBIN1+= regdomain.xml
1363095Sjoerg.endif
1373095Sjoerg
1383095Sjoerg# -rwxr-xr-x root:wheel, for the new cron root:wheel
1393095SjoergBIN2=	netstart pccard_ether rc.suspend rc.resume
1403095Sjoerg
14118444SbdeMTREE=	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_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_BIND_LIBS} != "no"
327MTREES+=	mtree/BIND.include.dist		/usr/include
328.endif
329.if ${MK_BIND_MTREE} != "no"
330MTREES+=	mtree/BIND.chroot.dist		/var/named
331.endif
332.if ${MK_GROFF} != "no"
333MTREES+=	mtree/BSD.groff.dist		/usr
334.endif
335.if ${MK_SENDMAIL} != "no"
336MTREES+=	mtree/BSD.sendmail.dist		/
337.endif
338.for mtree in ${LOCAL_MTREE}
339MTREES+=	../${mtree}			/
340.endfor
341
342distrib-dirs: ${MTREES:N/*}
343	@set ${MTREES}; \
344	while test $$# -ge 2; do \
345		m=${.CURDIR}/$$1; \
346		shift; \
347		d=${DESTDIR}$$1; \
348		shift; \
349		${ECHO} ${MTREE_CMD} -deU ${MTREE_FOLLOWS_SYMLINKS} \
350		    -f $$m -p $$d; \
351		${MTREE_CMD} -deU ${MTREE_FOLLOWS_SYMLINKS} -f $$m -p $$d; \
352	done; true
353.if defined(NO_ROOT)
354	@set ${MTREES}; \
355	while test $$# -ge 2; do \
356		m=${.CURDIR}/$$1; \
357		shift; \
358		d=$$1; \
359		test "$$d" == "/" && d=""; \
360		d=${DISTBASE}$$d; \
361		shift; \
362		${ECHO} "${MTREE_CMD:N-W} -C -f $$m -K uname,gname | " \
363		    "sed s#^\.#.$$d# | ${METALOG.add}" ; \
364		${MTREE_CMD:N-W} -C -f $$m -K uname,gname | sed s#^\.#.$$d# | \
365		    ${METALOG.add} ; \
366	done; true
367.endif
368	${INSTALL_SYMLINK} usr/src/sys ${DESTDIR}/sys
369	cd ${DESTDIR}/usr/share/man; \
370	for mandir in man*; do \
371		${INSTALL_SYMLINK} ../$$mandir \
372		    ${DESTDIR}/usr/share/man/en.ISO8859-1/; \
373		${INSTALL_SYMLINK} ../$$mandir \
374		    ${DESTDIR}/usr/share/man/en.UTF-8/; \
375	done
376	cd ${DESTDIR}/usr/share/openssl/man; \
377	for mandir in man*; do \
378		${INSTALL_SYMLINK} ../$$mandir \
379		    ${DESTDIR}/usr/share/openssl/man/en.ISO8859-1/; \
380	done
381	set - `grep "^[a-zA-Z]" ${.CURDIR}/man.alias`; \
382	while [ $$# -gt 0 ] ; do \
383		${INSTALL_SYMLINK} "$$2" "${DESTDIR}/usr/share/man/$$1"; \
384		${INSTALL_SYMLINK} "$$2" \
385		    "${DESTDIR}/usr/share/openssl/man/$$1"; \
386		shift; shift; \
387	done
388	set - `grep "^[a-zA-Z]" ${.CURDIR}/nls.alias`; \
389	while [ $$# -gt 0 ] ; do \
390		${INSTALL_SYMLINK} "$$2" "${DESTDIR}/usr/share/nls/$$1"; \
391		shift; shift; \
392	done
393
394etc-examples:
395	cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
396	    ${BIN1} ${BIN2} nsmb.conf opieaccess \
397	    ${DESTDIR}/usr/share/examples/etc
398	${_+_}cd ${.CURDIR}/defaults; ${MAKE} install \
399	    DESTDIR=${DESTDIR}/usr/share/examples
400
401.include <bsd.prog.mk>
402