Makefile revision 1.253
1#	$NetBSD: Makefile,v 1.253 2003/06/08 23:49:21 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 && \
295	    MAKE=${MAKE:Q} ${HOST_SH} ./makeobsolete -t ${OBSOLETE.dir})
296.for file in ${OBSOLETE.files}
297	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
298	    ${OBSOLETE.dir}/${file} ${DESTDIR}/var/db/obsolete
299.endfor
300
301
302# distrib-dirs --
303#	Populate $DESTDIR with directories needed by NetBSD
304#
305distrib-dirs: check_DESTDIR
306	${INSTALL_DIR} -o root -g wheel -m 755 ${BASE_PKG} ${DESTDIR}
307	${MTREE} -def ${.CURDIR}/mtree/NetBSD.dist -N ${.CURDIR} \
308	    -p ${DESTDIR}/ -U ${UNPRIVED:D-W}
309
310
311# release, snapshot --
312#	Build a full distribution including kernels & install media.
313#
314release snapshot: check_DESTDIR check_RELEASEDIR .WAIT \
315		    distribution .WAIT \
316		    snap_pre .WAIT snap_kern .WAIT \
317		    snap_post .WAIT snap_md_post
318	(cd ${NETBSDSRCDIR}/distrib/sets; ${MAKE} sets)
319	${MAKESUMS} -t ${RELEASEDIR}/${MACHINE}/binary/kernel '*.gz'
320
321
322# iso-image --
323#	Standalone target to create a CDROM image after the release
324#	was composed.  Should be run after "make release" in src and xsrc.
325#
326#	Note: At least mkisofs 2.0 should be used.
327#
328CDROM.image=${RELEASEDIR}/${MACHINE}/installation/cdrom/netbsd-${MACHINE}.iso
329CDROM.dir=	cdrom.dir
330CDROM.pathlist=	cdrom.pathlist
331
332iso-image: check_DESTDIR check_RELEASEDIR .WAIT iso-image-md-post
333	${MAKESUMS} -t ${RELEASEDIR}/${MACHINE}/installation/cdrom '*.iso'
334
335iso-image-setup: check_RELEASEDIR
336	rm -f ${CDROM.pathlist}
337	echo "${MACHINE}=${RELEASEDIR}/${MACHINE}" >> ${CDROM.pathlist}
338	mkdir -p ${CDROM.dir}
339	mkdir -p ${RELEASEDIR}/${MACHINE}/installation/cdrom
340
341# iso-image-mi --
342#	Create the image after the MD operations have completed.
343#
344iso-image-mi: check_DESTDIR check_RELEASEDIR .WAIT \
345		iso-image-setup .WAIT iso-image-md-pre
346	@if ! ${MKISOFS} --version; then \
347		echo "install pkgsrc/sysutils/cdrecord and run 'make iso-image'." ; \
348		false; \
349	fi
350	${MKISOFS} ${MKISOFS_FLAGS} -graft-points -path-list ${CDROM.pathlist} \
351	    -o ${CDROM.image} ${CDROM.dir}
352
353# iso-image-md-pre --
354#	Setup ${CDROM.dir} to produce a bootable CD image.
355#	Overridden by etc.$MACHINE/Makefile.inc
356#
357iso-image-md-pre: check_DESTDIR check_RELEASEDIR
358#	(empty -- look in the machine-dependent Makefile.inc)
359
360# iso-image-md-post --
361#	Fixup the CD-image to be bootable.
362#	Overridden by etc.$MACHINE/Makefile.inc
363#
364iso-image-md-post: check_DESTDIR check_RELEASEDIR .WAIT iso-image-mi
365#	(empty -- look in the machine-dependent Makefile.inc)
366
367
368# snap_pre --
369#	Create ${RELEASEDIR} and necessary subdirectories.
370#
371snap_pre: check_DESTDIR check_RELEASEDIR
372	${INSTALL} -d -m 755 ${RELEASEDIR}
373.ifndef UPDATE
374# Could be a mount point, ignore the errors
375	-/bin/rm -rf ${RELEASEDIR}/${MACHINE}
376.endif
377	${INSTALL} -d -m 755 ${RELEASEDIR}/${MACHINE}
378.for dir in ${INSTALLATION_DIRS}
379	${INSTALL} -d -m 755 ${RELEASEDIR}/${MACHINE}/${dir}
380.endfor
381
382# snap_post --
383#	Build the install media and notes from distrib
384#
385snap_post: check_DESTDIR check_RELEASEDIR
386.ifndef UPDATE
387	cd ${NETBSDSRCDIR}/distrib && ${MAKE} cleandir
388.endif
389	cd ${NETBSDSRCDIR}/distrib && ${MAKE} depend && ${MAKE} && \
390	    ${MAKE} release
391
392# snap_kern --
393#	This target builds the kernels specified by each port.
394#	A port may specify the following kernels:
395#
396#	KERNEL_SETS		The list of kernels that will be
397#				packaged into sets, named
398#				kern-${kernel}.tgz.  These kernels
399#				are also placed in the binary/kernel
400#				area of the release package as
401#				netbsd-${kernel}.gz.
402#
403#	EXTRA_KERNELS		Additional kernels to place in the
404#				binary/kernel area of the release
405#				package as netbsd-${kernel}.gz, but
406#				which are not placed into sets. This
407#				allows a port to provide e.g. a netbootable
408#				installation kernel containing a ramdisk.
409#
410#	BUILD_KERNELS		Additional kernels to build which are
411#				not placed into sets nor into the
412#				binary/kernel area of the release
413#				package.  These are typically kernels
414#				that are built for inclusion only in
415#				installation disk/CD-ROM/tape images.
416#
417#	A port may also specify KERNEL_SUFFIXES, which is an optional list
418#	of filename suffixes for kernels to include in the kernel sets and
419#	in the binary/kernel area of the release package (e.g. "netbsd" vs.
420#	"netbsd.ecoff" and "netbsd.srec").  It is not an error if kernels
421#	with these suffixes do not exist in the kernel build directory.
422#
423#
424# A list of all the kernels to build, which can be overridden from
425# external sources (such as make(1)'s environment or command line)
426#
427ALL_KERNELS?=	${KERNEL_SETS} ${EXTRA_KERNELS} ${BUILD_KERNELS}
428
429GETKERNELAWK=	awk '/^config/ {print $$2; found=1} \
430		END{ if (found == 0) print "netbsd"; }'
431
432.if !target(snap_kern)						# {
433
434# build_kernels --
435#	Configure & compile kernels listed in ${ALL_KERNELS}
436#
437.if !defined(KERNELS_DONE)						# {
438.for configfile in ${ALL_KERNELS}					# {
439_KERNELS_TO_BUILD+=kern-${configfile}
440kern-${configfile}:
441	cd ${KERNCONFDIR} && ${CONFIG} -s ${KERNSRCDIR} \
442	    -b ${KERNOBJDIR}/${configfile:C/.*\///} ${configfile}
443.if !defined(UPDATE)
444	cd ${KERNOBJDIR}/${configfile:C/.*\///} && ${MAKE} distclean
445.endif
446	cd ${KERNOBJDIR}/${configfile:C/.*\///} && ${MAKE} depend && ${MAKE}
447.endfor	# ALL_KERNELS							# }
448.endif	# KERNELS_DONE							# }
449
450build_kernels: ${_KERNELS_TO_BUILD}
451
452# build_kernelsets --
453#	Create kernel sets from ${KERNEL_SETS} into
454#	${RELEASEDIR}/${MACHINE}/binary/sets
455#
456.for configfile in ${KERNEL_SETS}					# {
457_KERNELSETS_TO_BUILD+=kernset-${configfile}
458kernset-${configfile}:
459	kernlist=`${GETKERNELAWK} ${KERNCONFDIR}/${configfile}`; \
460	kerndir=${KERNOBJDIR}/${configfile:C/.*\///}; \
461	kernsuffixes="${KERNEL_SUFFIXES}"; \
462	cd $${kerndir} && ( \
463		echo "/set uname=${BINOWN} gname=${BINGRP}"; \
464		echo ". type=dir optional"; \
465		for kernel in $${kernlist}; do \
466			echo "./$${kernel} type=file"; \
467			for s in $${kernsuffixes}; do \
468				if [ -f $${kernel}.$${s} ]; then \
469					echo "./$${kernel}.$${s} type=file"; \
470				fi; \
471			done; \
472		done ) | GZIP=-9 ${PAX} -O -zw \
473		    -M -N ${NETBSDSRCDIR}/etc \
474		    -f ${RELEASEDIR}/${MACHINE}/binary/sets/kern-${configfile}.tgz
475.endfor	# KERNEL_SETS							# }
476
477build_kernelsets: ${_KERNELSETS_TO_BUILD}
478
479# build_releasekernels --
480#	Build kernel.gz from ${KERNEL_SETS} ${EXTRA_KERNELS} into
481#	${RELEASEDIR}/${MACHINE}/binary/kernel
482#
483.for configfile in ${KERNEL_SETS} ${EXTRA_KERNELS}			# {
484_RELEASEKERNELS_TO_BUILD+=releasekern-${configfile}
485releasekern-${configfile}:
486	kernlist=`${GETKERNELAWK} ${KERNCONFDIR}/${configfile:C/.*\///}`; \
487	kerndir=${KERNOBJDIR}/${configfile:C/.*\///}; \
488	kernsuffixes="${KERNEL_SUFFIXES}"; \
489	cd $${kerndir} &&	\
490		gziplist=`for kernel in $${kernlist}; do \
491			echo "$${kernel}"; \
492			for s in $${kernsuffixes}; do \
493				if [ -f $${kernel}.$${s} ]; then \
494					echo "$${kernel}.$${s}"; \
495				fi; \
496			done; \
497		done`; \
498		for kernel in $${gziplist} ; do \
499		gzip -c -9 < $${kernel} > \
500		    ${RELEASEDIR}/${MACHINE}/binary/kernel/$${kernel}-${configfile:C/.*\///}.gz ; done
501.endfor	# KERNEL_SETS EXTRA_KERNELS					# }
502
503build_releasekernels: ${_RELEASEKERNELS_TO_BUILD}
504
505# snap_kern --
506#	build the kernels, then the sets & release kernels
507#
508snap_kern: check_DESTDIR check_RELEASEDIR .WAIT \
509	    build_kernels .WAIT \
510	    build_kernelsets build_releasekernels
511
512.endif # !target(snap_kern)					# }
513
514
515# snap_md_post --
516#	Machine dependent distribution media operations.
517#	Overridden by etc.$MACHINE/Makefile.inc
518#
519snap_md_post: check_DESTDIR check_RELEASEDIR
520#	(empty -- look in the machine-dependent Makefile.inc)
521
522
523clean:
524	-rm -rf ${CDROM.dir} ${CDROM.pathlist} ${OBSOLETE.dir}
525
526.include <bsd.prog.mk>
527