Makefile revision 1.252
1#	$NetBSD: Makefile,v 1.252 2003/05/18 08:28:05 lukem Exp $
2#	from: @(#)Makefile	8.7 (Berkeley) 5/25/95
3
4# Environment variables without default values:
5#   DESTDIR must be set before anything in this file will work.
6#   RELEASEDIR is where the tarred up stuff for a snapshot or
7#	release will be placed.
8#
9# Environment variables with default values:
10#   LOCALTIME will set the default local time for the system you
11#	build; it determines what /etc/localtime is symlink'd to.
12#   KERNSRCDIR points to kernel source; it is set by default to ../sys,
13#	but can be overridden.
14#   KERNOBJDIR is the kernel build directory, it defaults to
15#	${KERNSRCDIR}/arch/${MACHINE}/compile, but can be overridden.
16#   KERNCONFDIR is where the configuration files for kernels are found;
17#	default is ${KERNSRCDIR}/arch/${MACHINE}/conf but can be overridden.
18#   UPDATE is normally undefined; if defined, don't do a 'make clean'
19#	before kernel compile
20#   NO_SENDMAIL is normally undefined; if defined, it will not do a
21#	`make distribution' in the sendmail config file source directory.
22#
23# Targets:
24#    distribution: makes a full NetBSD distribution in DESTDIR. If
25#	INSTALL_DONE is set, it will not do a `make install.'
26#	if DISTRIBUTION_DONE is set, it will not do anything.
27#    distrib-dirs: creates an empty NetBSD directory tree in DESTDIR.
28#	Called by distribution.
29#    snapshot: calls distribution, above, and then tars up the files
30#	into a release(7) format in RELEASEDIR/${MACHINE}.
31#	Any port-dependent stuff for this target is found in
32#	etc.${MACHINE}/Makefile.inc.
33#    release: a synonym for `snapshot'
34#
35
36# For NO_SENDMAIL, INSTPRIV, MKCRYPTO
37#
38.include <bsd.own.mk>
39
40# For KERNSRCDIR, KERNOBJDIR, ...
41#
42.include <bsd.kernobj.mk>
43
44# For TARGET_ENDIANNESS
45#
46.include <bsd.endian.mk>
47
48
49.MAKEOVERRIDES+=	USETOOLS
50
51TZDIR=		/usr/share/zoneinfo
52LOCALTIME?=	UTC
53PWD_MKDB?=	pwd_mkdb
54MAKESUMS=	CKSUM=${CKSUM:Q} sh ${NETBSDSRCDIR}/distrib/sets/makesums
55
56# Flags for creating ISO CDROM image
57# mkisofs is expected to be in $PATH, install via pkgsrc/sysutils/cdrecord
58# Note: At least mkisofs 2.0 should be used.
59#
60MKISOFS?=	mkisofs
61DISTRIBREV!=	sh ${KERNSRCDIR}/conf/osrelease.sh -s
62# ISO 9660 volume ID.  Note that this can only contain [A-Z0-9_].
63ISO_VOLID!=	echo NETBSD_${MACHINE}_${DISTRIBREV} | tr a-z A-Z
64MKISOFS_FLAGS+= -J -l \
65		-r -T -v \
66		-V ${ISO_VOLID} \
67		-P "The NetBSD Project" \
68		-m "${RELEASEDIR}/${MACHINE}/installation/cdrom"
69
70# MD Makefile.inc may append MD targets to BIN[123].  Make sure all
71# are empty, to preserve the old semantics of setting them below with "=".
72#
73BIN1=
74BIN2=
75BIN3=
76
77# Directories to build in ${RELEASEDIR}/${MACHINE}.
78# MD Makefile.inc files can add to this.
79# NOTE: Parent directories must be listed before subdirectories.
80#
81INSTALLATION_DIRS=	binary binary/sets binary/kernel installation
82
83.if exists(etc.${MACHINE}/Makefile.inc)
84.include "etc.${MACHINE}/Makefile.inc"
85.endif
86
87# -rw-r--r--
88BINOWN= root
89BINGRP= wheel
90UTMPGRP= utmp
91BIN1+=	bootptab changelist csh.cshrc csh.login csh.logout daily \
92	daily.conf dm.conf floppytab ftpchroot ftpusers \
93	gettytab group hosts hosts.lpd inetd.conf lkm.conf \
94	mailer.conf man.conf monthly monthly.conf mrouted.conf \
95	netconfig networks newsyslog.conf nsswitch.conf ntp.conf \
96	passwd.conf phones printcap profile protocols rbootd.conf rc rc.conf \
97	rc.lkm rc.local rc.subr rc.shutdown remote rpc \
98	security security.conf services shells sysctl.conf syslog.conf \
99	weekly weekly.conf wscons.conf \
100	etc.${MACHINE}/ttys
101
102# Use machine-specific disktab if it exists, or the MI one otherwise
103.if exists(etc.${MACHINE}/disktab)
104BIN1+=	etc.${MACHINE}/disktab
105.else
106BIN1+=	disktab
107.endif
108
109.if exists(etc.${MACHINE}/ld.so.conf)
110BIN1+=	etc.${MACHINE}/ld.so.conf
111.endif
112
113.if exists(etc.${MACHINE}/ttyaction)
114BIN1+=	etc.${MACHINE}/ttyaction
115.endif
116
117# -rw-rw-r--
118BIN2+=	motd
119
120# -rw-------
121BIN3+=	hosts.equiv
122
123ETC_PKG=-T etc_pkg
124BASE_PKG=-T base_pkg
125ETC_INSTALL_FILE=cd ${.CURDIR} && ${INSTALL_FILE} ${ETC_PKG}
126ETC_INSTALL_LINK=cd ${.CURDIR} && ${INSTALL_LINK} ${ETC_PKG}
127ETC_INSTALL_SYMLINK=cd ${.CURDIR} && ${INSTALL_SYMLINK} ${ETC_PKG}
128
129NAMEDB=	127 root.cache named.conf localhost loopback.v6
130
131.if ${TARGET_ENDIANNESS} == "1234"
132PWD_MKDB_ENDIAN=	-L
133.elif ${TARGET_ENDIANNESS} == "4321"
134PWD_MKDB_ENDIAN=	-B
135.else
136PWD_MKDB_ENDIAN=
137.endif
138
139
140# distribution --
141#	Build a distribution
142#
143distribution: check_DESTDIR .WAIT distrib-dirs
144.if !defined(DISTRIBUTION_DONE)
145.if !defined(INSTALL_DONE)
146	(cd ${NETBSDSRCDIR}; ${MAKE} _DISTRIB= includes)
147	(cd ${NETBSDSRCDIR}; ${MAKE} _DISTRIB= install)
148.endif	# !INSTALL_DONE
149	(cd ${.CURDIR}; ${MAKE} install-etc-files)
150.endif	# !DISTRIBUTION_DONE
151
152
153# install-etc-files --
154#	Install etc (config) files; not performed by "make build"
155#
156install-etc-files: check_DESTDIR
157	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
158	    ${BIN1} ${DESTDIR}/etc
159	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 664 \
160	    ${BIN2} ${DESTDIR}/etc
161	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 600 \
162	    ${BIN3} ${DESTDIR}/etc
163	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
164	    aliases ${DESTDIR}/etc/mail
165	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
166	    /dev/null ${DESTDIR}/etc/mail/local-host-names
167	${ETC_INSTALL_FILE} -o root -g wheel -m 600 \
168	    crontab ${DESTDIR}/var/cron/tabs/root
169	${ETC_INSTALL_FILE} -o root -g wheel -m 600 \
170	    master.passwd ${DESTDIR}/etc
171	${PWD_MKDB} -p ${PWD_MKDB_ENDIAN} -d ${DESTDIR}/ \
172	    ${DESTDIR}/etc/master.passwd
173.if defined(UNPRIVED)
174	( \
175		for metaent in passwd pwd.db spwd.db; do \
176	    		echo "./etc/$${metaent} type=file mode=0644 uname=root gname=wheel tags=etc_pkg"; \
177		done; \
178	) | ${METALOG.add}
179.endif	# UNPRIVED
180	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 555 \
181	    MAKEDEV.local etc.${MACHINE}/MAKEDEV ${DESTDIR}/dev
182	${ETC_INSTALL_FILE} -o root -g wheel -m 600 \
183	    minfree ${DESTDIR}/var/crash
184.for file in cshrc login profile shrc
185	${ETC_INSTALL_FILE} -o root -g wheel -m 644 \
186	    root/dot.${file} ${DESTDIR}/root/.${file}
187.endfor
188	${ETC_INSTALL_FILE} -o root -g wheel -m 600 \
189	    root/dot.klogin ${DESTDIR}/root/.klogin
190	rm -f ${DESTDIR}/.cshrc ${DESTDIR}/.profile
191	${ETC_INSTALL_LINK} ${DESTDIR}/root/.cshrc ${DESTDIR}/.cshrc
192	${ETC_INSTALL_LINK} ${DESTDIR}/root/.profile ${DESTDIR}/.profile
193	(cd ${.CURDIR}/defaults; ${MAKE} install)
194	(cd ${.CURDIR}/mtree; ${MAKE} install)
195.for file in ${NAMEDB}
196	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
197	    namedb/${file} ${DESTDIR}/etc/namedb
198.endfor
199	(cd ${.CURDIR}/powerd; ${MAKE} install)
200	(cd ${.CURDIR}/rc.d; ${MAKE} install)
201	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
202	    postinstall ${DESTDIR}/etc
203	${ETC_INSTALL_SYMLINK} -o root -g wheel -m 755 \
204	    ${TZDIR}/${LOCALTIME} ${DESTDIR}/etc/localtime
205	${ETC_INSTALL_SYMLINK} -o root -g wheel -m 755 \
206	    /usr/sbin/rmt ${DESTDIR}/etc/rmt
207	${ETC_INSTALL_FILE} -o ${BINOWN} -g operator -m 664 \
208	    /dev/null ${DESTDIR}/etc/dumpdates
209	${ETC_INSTALL_FILE} -o ${BINOWN} -g operator -m 600 \
210	    /dev/null ${DESTDIR}/etc/skeykeys
211	${ETC_INSTALL_FILE} -o root -g wheel -m 600 \
212	    /dev/null ${DESTDIR}/var/at/at.deny
213	${ETC_INSTALL_FILE} -o nobody -g ${BINGRP} -m 664 \
214	    /dev/null ${DESTDIR}/var/db/locate.database
215	${ETC_INSTALL_FILE} -o uucp -g dialer -m 640 \
216	    /dev/null ${DESTDIR}/var/log/aculog
217	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 600 \
218	    /dev/null ${DESTDIR}/var/log/authlog
219	${ETC_INSTALL_FILE} -o root -g wheel -m 600 \
220	    /dev/null ${DESTDIR}/var/log/cron
221	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 664 \
222	    /dev/null ${DESTDIR}/var/log/lastlog
223	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 640 \
224	    /dev/null ${DESTDIR}/var/log/lpd-errs
225	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 600 \
226	    /dev/null ${DESTDIR}/var/log/maillog
227	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
228	    /dev/null ${DESTDIR}/var/log/messages
229	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 600 \
230	    /dev/null ${DESTDIR}/var/log/secure
231	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
232	    /dev/null ${DESTDIR}/var/log/sendmail.st
233	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
234	    /dev/null ${DESTDIR}/var/log/wtmp
235	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
236	    /dev/null ${DESTDIR}/var/log/wtmpx
237	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 600 \
238	    /dev/null ${DESTDIR}/var/log/xferlog
239	${ETC_INSTALL_FILE} -o daemon -g staff -m 664 \
240	    /dev/null ${DESTDIR}/var/msgs/bounds
241	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${UTMPGRP} -m 664 \
242	    /dev/null ${DESTDIR}/var/run/utmp
243	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${UTMPGRP} -m 664 \
244	    /dev/null ${DESTDIR}/var/run/utmpx
245	${ETC_INSTALL_FILE} -o games -g games -m 664 \
246	    /dev/null ${DESTDIR}/var/games/atc_score
247	${ETC_INSTALL_FILE} -o games -g games -m 664 \
248	    /dev/null ${DESTDIR}/var/games/battlestar.log
249	${ETC_INSTALL_FILE} -o games -g games -m 664 \
250	    /dev/null ${DESTDIR}/var/games/cfscores
251	${ETC_INSTALL_FILE} -o games -g games -m 664 \
252	    /dev/null ${DESTDIR}/var/games/criblog
253	${ETC_INSTALL_FILE} -o games -g games -m 660 \
254	    /dev/null ${DESTDIR}/var/games/hackdir/perm
255	${ETC_INSTALL_FILE} -o games -g games -m 660 \
256	    /dev/null ${DESTDIR}/var/games/hackdir/record
257	${ETC_INSTALL_FILE} -o games -g games -m 664 \
258	    /dev/null ${DESTDIR}/var/games/larn/llog12.0
259	${ETC_INSTALL_FILE} -o games -g games -m 664 \
260	    /dev/null ${DESTDIR}/var/games/larn/lscore12.0
261	${ETC_INSTALL_FILE} -o games -g games -m 664 \
262	    /dev/null ${DESTDIR}/var/games/larn/playerids
263	${ETC_INSTALL_FILE} -o games -g games -m 664 \
264	    /dev/null ${DESTDIR}/var/games/robots_roll
265	${ETC_INSTALL_FILE} -o games -g games -m 664 \
266	    /dev/null ${DESTDIR}/var/games/rogue.scores
267	${ETC_INSTALL_FILE} -o games -g games -m 664 \
268	    /dev/null ${DESTDIR}/var/games/saillog
269	${ETC_INSTALL_FILE} -o games -g games -m 664 \
270	    /dev/null ${DESTDIR}/var/games/snakerawscores
271	${ETC_INSTALL_FILE} -o games -g games -m 664 \
272	    /dev/null ${DESTDIR}/var/games/snake.log
273	${ETC_INSTALL_FILE} -o games -g games -m 664 \
274	    /dev/null ${DESTDIR}/var/games/tetris.scores
275	(cd ${.CURDIR}/skel; ${MAKE} distribution)
276	(cd ${NETBSDSRCDIR}/usr.bin/mail; ${MAKE} distribution)
277	(cd ${NETBSDSRCDIR}/gnu/usr.sbin/postfix/; ${MAKE} distribution)
278.if (${MKCRYPTO} != "no")
279	(cd ${NETBSDSRCDIR}/usr.bin/ssh; ${MAKE} distribution)
280.endif
281.if !defined(NO_SENDMAIL) || ${NO_SENDMAIL} == "no"
282	(cd ${NETBSDSRCDIR}/gnu/usr.sbin/sendmail/cf/cf; ${MAKE} distribution)
283.endif
284
285
286# install-obsolete-lists --
287#	Install var/db/obsolete set lists; this is performed by "make build"
288#
289OBSOLETE.dir=		${.OBJDIR}/obsolete.dir
290OBSOLETE.files=		base comp etc games man misc text
291
292install-obsolete-lists:
293	mkdir -p ${OBSOLETE.dir}
294	(cd ${NETBSDSRCDIR}/distrib/sets; sh ./makeobsolete -t ${OBSOLETE.dir})
295.for file in ${OBSOLETE.files}
296	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
297	    ${OBSOLETE.dir}/${file} ${DESTDIR}/var/db/obsolete
298.endfor
299
300
301# distrib-dirs --
302#	Populate $DESTDIR with directories needed by NetBSD
303#
304distrib-dirs: check_DESTDIR
305	${INSTALL_DIR} -o root -g wheel -m 755 ${BASE_PKG} ${DESTDIR}
306	${MTREE} -def ${.CURDIR}/mtree/NetBSD.dist -N ${.CURDIR} \
307	    -p ${DESTDIR}/ -U ${UNPRIVED:D-W}
308
309
310# release, snapshot --
311#	Build a full distribution including kernels & install media.
312#
313release snapshot: check_DESTDIR check_RELEASEDIR .WAIT \
314		    distribution .WAIT \
315		    snap_pre .WAIT snap_kern .WAIT \
316		    snap_post .WAIT snap_md_post
317	(cd ${NETBSDSRCDIR}/distrib/sets; ${MAKE} sets)
318	${MAKESUMS} -t ${RELEASEDIR}/${MACHINE}/binary/kernel '*.gz'
319
320
321# iso-image --
322#	Standalone target to create a CDROM image after the release
323#	was composed.  Should be run after "make release" in src and xsrc.
324#
325#	Note: At least mkisofs 2.0 should be used.
326#
327CDROM.image=${RELEASEDIR}/${MACHINE}/installation/cdrom/netbsd-${MACHINE}.iso
328CDROM.dir=	cdrom.dir
329CDROM.pathlist=	cdrom.pathlist
330
331iso-image: check_DESTDIR check_RELEASEDIR .WAIT iso-image-md-post
332	${MAKESUMS} -t ${RELEASEDIR}/${MACHINE}/installation/cdrom '*.iso'
333
334iso-image-setup: check_RELEASEDIR
335	rm -f ${CDROM.pathlist}
336	echo "${MACHINE}=${RELEASEDIR}/${MACHINE}" >> ${CDROM.pathlist}
337	mkdir -p ${CDROM.dir}
338	mkdir -p ${RELEASEDIR}/${MACHINE}/installation/cdrom
339
340# iso-image-mi --
341#	Create the image after the MD operations have completed.
342#
343iso-image-mi: check_DESTDIR check_RELEASEDIR .WAIT \
344		iso-image-setup .WAIT iso-image-md-pre
345	@if ! ${MKISOFS} --version; then \
346		echo "install pkgsrc/sysutils/cdrecord and run 'make iso-image'." ; \
347		false; \
348	fi
349	${MKISOFS} ${MKISOFS_FLAGS} -graft-points -path-list ${CDROM.pathlist} \
350	    -o ${CDROM.image} ${CDROM.dir}
351
352# iso-image-md-pre --
353#	Setup ${CDROM.dir} to produce a bootable CD image.
354#	Overridden by etc.$MACHINE/Makefile.inc
355#
356iso-image-md-pre: check_DESTDIR check_RELEASEDIR
357#	(empty -- look in the machine-dependent Makefile.inc)
358
359# iso-image-md-post --
360#	Fixup the CD-image to be bootable.
361#	Overridden by etc.$MACHINE/Makefile.inc
362#
363iso-image-md-post: check_DESTDIR check_RELEASEDIR .WAIT iso-image-mi
364#	(empty -- look in the machine-dependent Makefile.inc)
365
366
367# snap_pre --
368#	Create ${RELEASEDIR} and necessary subdirectories.
369#
370snap_pre: check_DESTDIR check_RELEASEDIR
371	${INSTALL} -d -m 755 ${RELEASEDIR}
372.ifndef UPDATE
373# Could be a mount point, ignore the errors
374	-/bin/rm -rf ${RELEASEDIR}/${MACHINE}
375.endif
376	${INSTALL} -d -m 755 ${RELEASEDIR}/${MACHINE}
377.for dir in ${INSTALLATION_DIRS}
378	${INSTALL} -d -m 755 ${RELEASEDIR}/${MACHINE}/${dir}
379.endfor
380
381# snap_post --
382#	Build the install media and notes from distrib
383#
384snap_post: check_DESTDIR check_RELEASEDIR
385.ifndef UPDATE
386	cd ${NETBSDSRCDIR}/distrib && ${MAKE} cleandir
387.endif
388	cd ${NETBSDSRCDIR}/distrib && ${MAKE} depend && ${MAKE} && \
389	    ${MAKE} release
390
391# snap_kern --
392#	This target builds the kernels specified by each port.
393#	A port may specify the following kernels:
394#
395#	KERNEL_SETS		The list of kernels that will be
396#				packaged into sets, named
397#				kern-${kernel}.tgz.  These kernels
398#				are also placed in the binary/kernel
399#				area of the release package as
400#				netbsd-${kernel}.gz.
401#
402#	EXTRA_KERNELS		Additional kernels to place in the
403#				binary/kernel area of the release
404#				package as netbsd-${kernel}.gz, but
405#				which are not placed into sets. This
406#				allows a port to provide e.g. a netbootable
407#				installation kernel containing a ramdisk.
408#
409#	BUILD_KERNELS		Additional kernels to build which are
410#				not placed into sets nor into the
411#				binary/kernel area of the release
412#				package.  These are typically kernels
413#				that are built for inclusion only in
414#				installation disk/CD-ROM/tape images.
415#
416#	A port may also specify KERNEL_SUFFIXES, which is an optional list
417#	of filename suffixes for kernels to include in the kernel sets and
418#	in the binary/kernel area of the release package (e.g. "netbsd" vs.
419#	"netbsd.ecoff" and "netbsd.srec").  It is not an error if kernels
420#	with these suffixes do not exist in the kernel build directory.
421#
422#
423# A list of all the kernels to build, which can be overridden from
424# external sources (such as make(1)'s environment or command line)
425#
426ALL_KERNELS?=	${KERNEL_SETS} ${EXTRA_KERNELS} ${BUILD_KERNELS}
427
428GETKERNELAWK=	awk '/^config/ {print $$2; found=1} \
429		END{ if (found == 0) print "netbsd"; }'
430
431.if !target(snap_kern)						# {
432
433# build_kernels --
434#	Configure & compile kernels listed in ${ALL_KERNELS}
435#
436.if !defined(KERNELS_DONE)						# {
437.for configfile in ${ALL_KERNELS}					# {
438_KERNELS_TO_BUILD+=kern-${configfile}
439kern-${configfile}:
440	cd ${KERNCONFDIR} && ${CONFIG} -s ${KERNSRCDIR} \
441	    -b ${KERNOBJDIR}/${configfile:C/.*\///} ${configfile}
442.if !defined(UPDATE)
443	cd ${KERNOBJDIR}/${configfile:C/.*\///} && ${MAKE} distclean
444.endif
445	cd ${KERNOBJDIR}/${configfile:C/.*\///} && ${MAKE} depend && ${MAKE}
446.endfor	# ALL_KERNELS							# }
447.endif	# KERNELS_DONE							# }
448
449build_kernels: ${_KERNELS_TO_BUILD}
450
451# build_kernelsets --
452#	Create kernel sets from ${KERNEL_SETS} into
453#	${RELEASEDIR}/${MACHINE}/binary/sets
454#
455.for configfile in ${KERNEL_SETS}					# {
456_KERNELSETS_TO_BUILD+=kernset-${configfile}
457kernset-${configfile}:
458	kernlist=`${GETKERNELAWK} ${KERNCONFDIR}/${configfile}`; \
459	kerndir=${KERNOBJDIR}/${configfile:C/.*\///}; \
460	kernsuffixes="${KERNEL_SUFFIXES}"; \
461	cd $${kerndir} && ( \
462		echo "/set uname=${BINOWN} gname=${BINGRP}"; \
463		echo ". type=dir optional"; \
464		for kernel in $${kernlist}; do \
465			echo "./$${kernel} type=file"; \
466			for s in $${kernsuffixes}; do \
467				if [ -f $${kernel}.$${s} ]; then \
468					echo "./$${kernel}.$${s} type=file"; \
469				fi; \
470			done; \
471		done ) | GZIP=-9 ${PAX} -O -zw \
472		    -M -N ${NETBSDSRCDIR}/etc \
473		    -f ${RELEASEDIR}/${MACHINE}/binary/sets/kern-${configfile}.tgz
474.endfor	# KERNEL_SETS							# }
475
476build_kernelsets: ${_KERNELSETS_TO_BUILD}
477
478# build_releasekernels --
479#	Build kernel.gz from ${KERNEL_SETS} ${EXTRA_KERNELS} into
480#	${RELEASEDIR}/${MACHINE}/binary/kernel
481#
482.for configfile in ${KERNEL_SETS} ${EXTRA_KERNELS}			# {
483_RELEASEKERNELS_TO_BUILD+=releasekern-${configfile}
484releasekern-${configfile}:
485	kernlist=`${GETKERNELAWK} ${KERNCONFDIR}/${configfile:C/.*\///}`; \
486	kerndir=${KERNOBJDIR}/${configfile:C/.*\///}; \
487	kernsuffixes="${KERNEL_SUFFIXES}"; \
488	cd $${kerndir} &&	\
489		gziplist=`for kernel in $${kernlist}; do \
490			echo "$${kernel}"; \
491			for s in $${kernsuffixes}; do \
492				if [ -f $${kernel}.$${s} ]; then \
493					echo "$${kernel}.$${s}"; \
494				fi; \
495			done; \
496		done`; \
497		for kernel in $${gziplist} ; do \
498		gzip -c -9 < $${kernel} > \
499		    ${RELEASEDIR}/${MACHINE}/binary/kernel/$${kernel}-${configfile:C/.*\///}.gz ; done
500.endfor	# KERNEL_SETS EXTRA_KERNELS					# }
501
502build_releasekernels: ${_RELEASEKERNELS_TO_BUILD}
503
504# snap_kern --
505#	build the kernels, then the sets & release kernels
506#
507snap_kern: check_DESTDIR check_RELEASEDIR .WAIT \
508	    build_kernels .WAIT \
509	    build_kernelsets build_releasekernels
510
511.endif # !target(snap_kern)					# }
512
513
514# snap_md_post --
515#	Machine dependent distribution media operations.
516#	Overridden by etc.$MACHINE/Makefile.inc
517#
518snap_md_post: check_DESTDIR check_RELEASEDIR
519#	(empty -- look in the machine-dependent Makefile.inc)
520
521
522clean:
523	-rm -rf ${CDROM.dir} ${CDROM.pathlist} ${OBSOLETE.dir}
524
525.include <bsd.prog.mk>
526