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