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