Makefile revision 1.162
1#	$OpenBSD: Makefile,v 1.162 2002/05/16 15:00:48 millert Exp $
2
3TZDIR=		/usr/share/zoneinfo
4LOCALTIME=	US/Pacific
5
6NOOBJ=	oobj
7
8.if exists(etc.${MACHINE}/Makefile.inc)
9.include "etc.${MACHINE}/Makefile.inc"
10.endif
11
12# -rw-r--r--
13BINOWN= root
14BINGRP= wheel
15BIN1=	bootptab changelist ccd.conf csh.cshrc csh.login csh.logout \
16	daily dhcpd.conf dhcpd.interfaces dm.conf exports ftpusers \
17	ftpchroot gettytab group hosts hosts.lpd inetd.conf \
18	ksh.kshrc locate.rc man.conf monthly motd mrouted.conf \
19	myname netstart networks newsyslog.conf pf.conf nat.conf \
20	phones printcap protocols rbootd.conf rc rc.conf rc.local \
21	rc.securelevel rc.shutdown remote rpc security services \
22	shells syslog.conf weekly etc.${MACHINE}/disktab dhclient.conf \
23	mailer.conf
24
25.if (${MACHINE} == "alpha" || ${MACHINE} == "hppa" || \
26     ${MACHINE} == "i386" || ${MACHINE} == "macppc" || ${MACHINE} == "sparc64")
27BIN1+=	wsconsctl.conf
28.endif
29
30# -rw-rw-r--
31BIN2=	motd
32
33NAMEDB=	localhost.rev localhost.v6.rev localhost.zone root.cache
34PCS=	pcs750.bin
35WCS1=	wcs fppwcs poc poc1 poc2 fppoc
36WCS2=	fpevent fppwcs fppwcs_dual hdcwcs load_diags start_fpp wcs wcs_dual
37
38# Use NOGZIP on architectures where the gzip'ing would take too much time
39# (pmax or slower :-)).  This way you get only tar'ed snap files and you can
40# gzip them on a faster machine
41.ifndef NOGZIP
42GZIP?=		gzip
43GZIPFLAGS?=	-9
44GZIPEXT?=	.gz
45.else
46GZIP=		cat
47GZIPFLAGS=
48GZIPEXT=
49.endif
50
51all clean cleandir depend etc install lint:
52
53.ifndef DESTDIR
54distribution-etc-root-var distribution distrib-dirs release snapshot:
55	@echo setenv DESTDIR before doing that!
56	@false
57.else
58distribution-etc-root-var: distrib-dirs
59	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 ${BIN1} ${DESTDIR}/etc
60	cat etc.${MACHINE}/ttys ttys.pty > ${DESTDIR}/etc/ttys && \
61	    chown ${BINOWN} ${DESTDIR}/etc/ttys && \
62	    chgrp ${BINGRP} ${DESTDIR}/etc/ttys && \
63	    chmod 644 ${DESTDIR}/etc/ttys
64	cat sysctl.conf etc.${MACHINE}/sysctl.conf > ${DESTDIR}/etc/sysctl.conf && \
65	    chown ${BINOWN} ${DESTDIR}/etc/sysctl.conf && \
66	    chgrp ${BINGRP} ${DESTDIR}/etc/sysctl.conf && \
67	    chmod 644 ${DESTDIR}/etc/sysctl.conf
68	cat fbtab.head etc.${MACHINE}/fbtab fbtab.tail > ${DESTDIR}/etc/fbtab && \
69	    chown ${BINOWN} ${DESTDIR}/etc/fbtab && \
70	    chgrp ${BINGRP} ${DESTDIR}/etc/fbtab && \
71	    chmod 644 ${DESTDIR}/etc/fbtab
72	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 664 ${BIN2} ${DESTDIR}/etc
73	${INSTALL} -c -o root -g wheel -m 600 hosts.equiv ${DESTDIR}/etc
74	${INSTALL} -c -o root -g wheel -m 600 crontab ${DESTDIR}/var/cron/tabs/root
75	${INSTALL} -c -o root -g wheel -m 644 login.conf ${DESTDIR}/etc
76	${INSTALL} -c -o root -g wheel -m 600 master.passwd ${DESTDIR}/etc
77	pwd_mkdb -p -d ${DESTDIR}/etc /etc/master.passwd
78	${INSTALL} -c -o root -g wheel -m 644 moduli ${DESTDIR}/etc
79	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 555 \
80	     MAKEDEV.local etc.${MACHINE}/MAKEDEV ${DESTDIR}/dev
81	cd root; \
82		${INSTALL} -c -o root -g wheel -m 644 dot.cshrc \
83		    ${DESTDIR}/root/.cshrc; \
84		${INSTALL} -c -o root -g wheel -m 600 dot.klogin \
85		    ${DESTDIR}/root/.klogin; \
86		${INSTALL} -c -o root -g wheel -m 644 dot.login \
87		    ${DESTDIR}/root/.login; \
88		${INSTALL} -c -o root -g wheel -m 644 dot.profile \
89		    ${DESTDIR}/root/.profile; \
90		rm -f ${DESTDIR}/.cshrc ${DESTDIR}/.profile; \
91		ln ${DESTDIR}/root/.cshrc ${DESTDIR}/.cshrc; \
92		ln ${DESTDIR}/root/.profile ${DESTDIR}/.profile
93	cd skel; \
94		${INSTALL} -c -o root -g wheel -m 644 dot.cshrc \
95		    ${DESTDIR}/etc/skel/.cshrc; \
96		${INSTALL} -c -o root -g wheel -m 644 dot.login \
97		    ${DESTDIR}/etc/skel/.login; \
98		${INSTALL} -c -o root -g wheel -m 644 dot.mailrc \
99		    ${DESTDIR}/etc/skel/.mailrc; \
100		${INSTALL} -c -o root -g wheel -m 644 dot.profile \
101		    ${DESTDIR}/etc/skel/.profile; \
102		${INSTALL} -c -o root -g wheel -m 600 dot.rhosts \
103		    ${DESTDIR}/etc/skel/.rhosts
104	cd kerberosIV; \
105		${INSTALL} -c -o root -g wheel -m 644 README \
106		    ${DESTDIR}/etc/kerberosIV; \
107		${INSTALL} -c -o root -g wheel -m 644 krb.conf \
108		    ${DESTDIR}/etc/kerberosIV; \
109		${INSTALL} -c -o root -g wheel -m 644 krb.realms \
110		    ${DESTDIR}/etc/kerberosIV; \
111		${INSTALL} -c -o root -g wheel -m 644 krb.extra \
112		    ${DESTDIR}/etc/kerberosIV; \
113		${INSTALL} -c -o root -g wheel -m 644 krb.equiv \
114		    ${DESTDIR}/etc/kerberosIV
115	cd kerberosV; \
116		${INSTALL} -c -o root -g wheel -m 644 README \
117		    ${DESTDIR}/etc/kerberosV; \
118		${INSTALL} -c -o root -g wheel -m 644 krb5.conf.example \
119		    ${DESTDIR}/etc/kerberosV
120	cd amd; \
121		${INSTALL} -c -o root -g wheel -m 644 master.sample \
122		    ${DESTDIR}/etc/amd
123	cd mtree; \
124		${INSTALL} -c -o root -g wheel -m 600 special \
125		    ${DESTDIR}/etc/mtree; \
126		${INSTALL} -c -o root -g wheel -m 444 4.4BSD.dist \
127		    ${DESTDIR}/etc/mtree; \
128		${INSTALL} -c -o root -g wheel -m 444 BSD.local.dist \
129		    ${DESTDIR}/etc/mtree; \
130		${INSTALL} -c -o root -g wheel -m 444 BSD.x11.dist \
131		    ${DESTDIR}/etc/mtree
132	cd photuris; \
133		${INSTALL} -c -o root -g wheel -m 600 secrets.conf \
134		    ${DESTDIR}/etc/photuris; \
135		${INSTALL} -c -o root -g wheel -m 600 attributes.conf \
136		    ${DESTDIR}/etc/photuris; \
137		${INSTALL} -c -o root -g wheel -m 600 photuris.conf \
138		    ${DESTDIR}/etc/photuris; \
139		${INSTALL} -c -o root -g wheel -m 600 photuris.startup \
140		    ${DESTDIR}/etc/photuris
141	cd ppp; \
142		${INSTALL} -c -o root -g wheel -m 600 chap-secrets \
143		    ${DESTDIR}/etc/ppp; \
144		${INSTALL} -c -o root -g wheel -m 600 options \
145		    ${DESTDIR}/etc/ppp; \
146		${INSTALL} -c -o root -g wheel -m 600 options.leaf \
147		    ${DESTDIR}/etc/ppp; \
148		${INSTALL} -c -o root -g wheel -m 600 options.sample \
149		    ${DESTDIR}/etc/ppp; \
150		${INSTALL} -c -o root -g wheel -m 600 chatscript.sample \
151		    ${DESTDIR}/etc/ppp; \
152		${INSTALL} -c -o root -g wheel -m 600 pap-secrets \
153		    ${DESTDIR}/etc/ppp; \
154		${INSTALL} -c -o root -g wheel -m 600 ppp.conf.sample \
155		    ${DESTDIR}/etc/ppp; \
156		${INSTALL} -c -o root -g wheel -m 644 ppp.linkup.sample \
157		    ${DESTDIR}/etc/ppp; \
158		${INSTALL} -c -o root -g wheel -m 644 ppp.linkdown.sample \
159		    ${DESTDIR}/etc/ppp; \
160		${INSTALL} -c -o root -g wheel -m 644 ppp.secret.sample \
161		    ${DESTDIR}/etc/ppp
162	cd afs; \
163		${INSTALL} -c -o root -g wheel -m 644 afsd.conf \
164		    ${DESTDIR}/etc/afs; \
165		${INSTALL} -c -o root -g wheel -m 644 ThisCell \
166		    ${DESTDIR}/etc/afs; \
167		${INSTALL} -c -o root -g wheel -m 644 CellServDB \
168		    ${DESTDIR}/etc/afs; \
169		${INSTALL} -c -o root -g wheel -m 644 SuidCells \
170		    ${DESTDIR}/etc/afs; \
171		${INSTALL} -c -o root -g wheel -m 644 README \
172		    ${DESTDIR}/etc/afs
173	cd namedb; \
174	    ${INSTALL} -c -o root -g ${BINGRP} -m 644 named.boot \
175		${DESTDIR}/var/named; \
176	    ${INSTALL} -c -o named -g ${BINGRP} -m 644 ${NAMEDB} \
177		${DESTDIR}/var/named/namedb
178	/bin/rm -f ${DESTDIR}/etc/localtime
179	ln -s ${TZDIR}/${LOCALTIME} ${DESTDIR}/etc/localtime
180	/bin/rm -f ${DESTDIR}/etc/rmt
181	ln -s /usr/sbin/rmt ${DESTDIR}/etc/rmt
182	${INSTALL} -c -o root -g wheel -m 644 minfree \
183		${DESTDIR}/var/crash
184	${INSTALL} -c -o ${BINOWN} -g operator -m 664 /dev/null \
185		${DESTDIR}/etc/dumpdates
186	${INSTALL} -c -o root -g crontab -m 660 /dev/null \
187		${DESTDIR}/var/at/at.deny
188	${INSTALL} -c -o root -g wheel -m 600 /dev/null \
189		${DESTDIR}/var/cron/log
190	${INSTALL} -c -o root -g wheel -m 444 /dev/null \
191		${DESTDIR}/var/db/locate.database
192	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
193		${DESTDIR}/var/log/authlog
194	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
195		${DESTDIR}/var/log/daemon
196	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
197		${DESTDIR}/var/log/ftpd
198	${INSTALL} -c -o ${BINOWN} -g wheel -m 644 /dev/null \
199		${DESTDIR}/var/log/lastlog
200	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
201		${DESTDIR}/var/log/lpd-errs
202	${INSTALL} -c -o ${BINOWN} -g wheel -m 600 /dev/null \
203		${DESTDIR}/var/log/maillog
204	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
205		${DESTDIR}/var/log/messages
206	${INSTALL} -c -o ${BINOWN} -g wheel -m 600 /dev/null \
207		${DESTDIR}/var/log/secure
208	${INSTALL} -c -o ${BINOWN} -g wheel -m 644 /dev/null \
209		${DESTDIR}/var/log/wtmp
210	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
211		${DESTDIR}/var/log/xferlog
212	${INSTALL} -c -o daemon -g staff -m 664 /dev/null \
213		${DESTDIR}/var/msgs/bounds
214	${INSTALL} -c -o ${BINOWN} -g utmp -m 664 /dev/null \
215		${DESTDIR}/var/run/utmp
216.if ${MACHINE} == "vax"
217	uudecode -p etc.vax/${PCS}.uu > ${DESTDIR}/${PCS} && \
218	    chown ${BINOWN} ${DESTDIR}/${PCS} && \
219	    chgrp ${BINGRP} ${DESTDIR}/${PCS} && \
220	    chmod 644 ${DESTDIR}/${PCS}
221.endif
222	cd ../gnu/usr.sbin/sendmail/cf/cf && exec ${MAKE} distribution
223	cd ../usr.sbin/ypserv/ypinit && exec ${MAKE} distribution
224	cd ../usr.bin/ssh && exec ${MAKE} distribution
225	cd ../usr.sbin/httpd && exec ${MAKE} -f Makefile.bsd-wrapper distribution
226	cd ../lib/libssl && exec ${MAKE} -f Makefile.bsd-wrapper distribution
227	cd ../gnu/usr.bin/lynx && exec ${MAKE} -f Makefile.bsd-wrapper distribution
228	cd ../usr.bin/mail && exec ${MAKE} distribution
229	${INSTALL} -c -o root -g ${BINGRP} -m 644 aliases \
230	    ${DESTDIR}/etc/mail/aliases
231	/usr/libexec/sendmail/sendmail -C${DESTDIR}/etc/mail/sendmail.cf \
232	    -bi -O AliasFile=${DESTDIR}/etc/mail/aliases \
233	    -O DontBlameSendmail=mapinunsafedirpath
234	${INSTALL} -c -o root -g wheel -m 600 root/root.mail \
235		${DESTDIR}/var/mail/root
236	${INSTALL} -c -o root -g wheel -m 440 ../usr.bin/sudo/sudoers \
237		${DESTDIR}/etc/sudoers
238
239distribution:
240	exec ${SUDO} ${MAKE} distribution-etc-root-var
241	cd .. && exec ${SUDO} ${MAKE} install
242
243distrib-dirs:
244	if [ ! -d ${DESTDIR}/. ]; then \
245		${INSTALL} -d -o root -g wheel -m 755 ${DESTDIR}; \
246	fi
247	mtree -qdef mtree/4.4BSD.dist -p ${DESTDIR}/ -U
248	if [ ! -d ${DESTDIR}/usr/src ]; then \
249		${INSTALL} -d -o root -g wsrc -m 775 ${DESTDIR}/usr/src; \
250	fi
251	cd ${DESTDIR}/; rm -f sys; ln -s usr/src/sys sys
252
253.ifndef RELEASEDIR
254release:
255	@echo setenv RELEASEDIR before building a release.
256	@false
257.else
258release: distribution snap_pre snap_md
259	cd ${.CURDIR}/../distrib/notes && ${MAKE} && exec ${SUDO} ${MAKE} install
260	cd ${.CURDIR}/../distrib/sets && exec ${SUDO} sh maketars ${OSrev}
261	-cp ${DESTDIR}/snapshot/bsd* ${RELEASEDIR}
262	-cp ${DESTDIR}/snapshot/*boot* ${RELEASEDIR}
263	-cp ${DESTDIR}/snapshot/*BOOT* ${RELEASEDIR}
264	-cp ${DESTDIR}/snapshot/INSTALL.* ${RELEASEDIR}
265	-cp ${DESTDIR}/snapshot/*.fs ${DESTDIR}/snapshot/*.fs.gz ${RELEASEDIR}
266	-cd ${RELEASEDIR}; \
267		md5 bsd!(*.gz) *boot* *BOOT* INSTALL.* *.fs *.gz *.tgz > MD5
268	-cd ${RELEASEDIR}; \
269		cksum bsd!(*.gz) *boot* *BOOT* INSTALL.* *.fs *.gz *.tgz > CKSUM
270.if defined(MACHINE_HAS_TOOLS)
271	mkdir -p ${RELEASEDIR}/tools
272	cp ${DESTDIR}/snapshot/tools/* ${RELEASEDIR}/tools
273	cd ${RELEASEDIR} && md5 tools/* >>MD5
274	cd ${RELEASEDIR} && cksum tools/* >>CKSUM
275.endif
276	-cd ${RELEASEDIR} && sort -o MD5 MD5
277	-cd ${RELEASEDIR} && sort -o CKSUM -k 3 CKSUM
278.endif
279
280snapshot: distribution snap_pre snap_tar snap_md
281	cd ${DESTDIR}/snapshot && cksum * > CKSUMS
282	cd ${DESTDIR}/snapshot && md5 * > MD5
283
284snap_pre:
285	${SUDO} /bin/rm -rf ${DESTDIR}/snapshot
286	${SUDO} ${INSTALL} -d -o root -g wheel -m 755 ${DESTDIR}/snapshot
287
288snap_tar:
289	cd ${DESTDIR} && tar cf - bin \
290	    | ${GZIP} ${GZIPFLAGS} > snapshot/bin.tar${GZIPEXT}
291	cd ${DESTDIR} && tar cf - dev \
292	    | ${GZIP} ${GZIPFLAGS} > snapshot/dev.tar${GZIPEXT}
293	cd ${DESTDIR} && tar cf - .profile .cshrc altroot etc home mnt \
294	    root stand sys tmp | ${GZIP} ${GZIPFLAGS} \
295	    > snapshot/etc.tar${GZIPEXT}
296	cd ${DESTDIR} && tar cf - sbin \
297	    | ${GZIP} ${GZIPFLAGS} > snapshot/sbin.tar${GZIPEXT}
298	cd ${DESTDIR} && tar cf - usr/bin \
299	    | ${GZIP} ${GZIPFLAGS} > snapshot/usr.bin.tar${GZIPEXT}
300	cd ${DESTDIR} && tar cf - usr/games \
301	    | ${GZIP} ${GZIPFLAGS} > snapshot/usr.games.tar${GZIPEXT}
302	cd ${DESTDIR} && tar cf - usr/include \
303	    | ${GZIP} ${GZIPFLAGS} > snapshot/usr.include.tar${GZIPEXT}
304	cd ${DESTDIR} && tar cf - usr/lib \
305	    | ${GZIP} ${GZIPFLAGS} > snapshot/usr.lib.tar${GZIPEXT}
306	cd ${DESTDIR} && tar cf - usr/libexec \
307	    | ${GZIP} ${GZIPFLAGS} > snapshot/usr.libexec.tar${GZIPEXT}
308	cd ${DESTDIR} && tar cf - usr/mdec usr/libdata usr/lkm usr/local \
309	    usr/src usr/obj | ${GZIP} ${GZIPFLAGS} \
310	    > snapshot/usr.misc.tar${GZIPEXT}
311	cd ${DESTDIR} && tar cf - usr/sbin \
312	    | ${GZIP} ${GZIPFLAGS} > snapshot/usr.sbin.tar${GZIPEXT}
313	cd ${DESTDIR} && tar cf - usr/share \
314	    | ${GZIP} ${GZIPFLAGS} > snapshot/usr.share.tar${GZIPEXT}
315	cd ${DESTDIR} && tar cf - var \
316	    | ${GZIP} ${GZIPFLAGS} > snapshot/var.tar${GZIPEXT}
317	cd ../distrib/notes; ${MAKE}; ${MAKE} install
318
319snap_md:
320# nothing here -- look in the machine-dependent Makefile.inc
321
322.endif	# DESTDIR check
323
324MAKEDEVARCHS+= alpha
325MAKEDEVARCHS+= amiga
326MAKEDEVARCHS+= hp300
327MAKEDEVARCHS+= hppa
328MAKEDEVARCHS+= i386
329MAKEDEVARCHS+= mac68k
330MAKEDEVARCHS+= macppc
331MAKEDEVARCHS+= mvme68k
332MAKEDEVARCHS+= mvme88k
333#MAKEDEVARCHS+= mvmeppc
334MAKEDEVARCHS+= sparc
335MAKEDEVARCHS+= sparc64
336MAKEDEVARCHS+= sun3
337#MAKEDEVARCHS+= vax
338
339clean:
340	rm -f etc.${MACHINE}/MAKEDEV
341
342cleandir:
343	cd ${.CURDIR}; for m in ${MAKEDEVARCHS}; do \
344	    ${MAKE} MACHINE=$$m clean; done
345
346m4: etc.${M}/MAKEDEV
347
348etc.${M}/MAKEDEV: MAKEDEV.sub MAKEDEV.mi etc.${M}/MAKEDEV.md
349	echo "==> etc.${M}/MAKEDEV"
350	m4 -DMACHINE=${M} MAKEDEV.mi > etc.${M}/.MAKEDEV.tmp && \
351	    mv etc.${M}/.MAKEDEV.tmp etc.${M}/MAKEDEV || \
352	    rm etc.${M}/.MAKEDEV.tmp
353
354allarchs: MAKEDEV.sub MAKEDEV.mi
355	cd ${.CURDIR}; for m in ${MAKEDEVARCHS}; do \
356	    ${MAKE} M=$$m m4; done
357
358distrib:
359	cd ${.CURDIR}/../distrib && \
360	    ${MAKE} cleandir && ${MAKE} && exec ${SUDO} ${MAKE} install
361
362.PHONY: distribution-etc-root-var distribution distrib-dirs \
363	release snapshot allarchs snap_pre snap_tar snap_md m4
364.include <bsd.prog.mk>
365