Home | History | Annotate | Line # | Download | only in etc
Makefile revision 1.246
      1 #	$NetBSD: Makefile,v 1.246 2003/02/20 11:40:28 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 
     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 OBSOLETE.dir=		${.OBJDIR}/obsolete.dir
    138 OBSOLETE.files=		base comp etc games man misc text
    139 
    140 
    141 # distribution --
    142 #	Build a distribution
    143 #
    144 distribution: check_DESTDIR .WAIT distrib-dirs
    145 .if !defined(DISTRIBUTION_DONE)
    146 .if !defined(INSTALL_DONE)
    147 	(cd ${NETBSDSRCDIR}; ${MAKE} _DISTRIB= includes)
    148 	(cd ${NETBSDSRCDIR}; ${MAKE} _DISTRIB= install)
    149 .endif	# !INSTALL_DONE
    150 	(cd ${.CURDIR}; ${MAKE} install-etc-files)
    151 .endif	# !DISTRIBUTION_DONE
    152 
    153 
    154 # install-etc-files --
    155 #	Install etc (config) files; not performed by "make build"
    156 #
    157 install-etc-files: check_DESTDIR
    158 	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
    159 	    ${BIN1} ${DESTDIR}/etc
    160 	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 664 \
    161 	    ${BIN2} ${DESTDIR}/etc
    162 	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 600 \
    163 	    ${BIN3} ${DESTDIR}/etc
    164 	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
    165 	    aliases ${DESTDIR}/etc/mail
    166 	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
    167 	    /dev/null ${DESTDIR}/etc/mail/local-host-names
    168 	${ETC_INSTALL_FILE} -o root -g wheel -m 600 \
    169 	    crontab ${DESTDIR}/var/cron/tabs/root
    170 	${ETC_INSTALL_FILE} -o root -g wheel -m 600 \
    171 	    master.passwd ${DESTDIR}/etc
    172 	${PWD_MKDB} -p ${TARGET_ENDIANNESS} -d ${DESTDIR}/ \
    173 	    ${DESTDIR}/etc/master.passwd
    174 .if defined(UNPRIVED)
    175 	( \
    176 		for metaent in passwd pwd.db spwd.db; do \
    177 	    		echo "./etc/$${metaent} type=file mode=0644 uname=root gname=wheel tags=etc_pkg"; \
    178 		done; \
    179 	) | ${METALOG.add}
    180 .endif	# UNPRIVED
    181 	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 555 \
    182 	    MAKEDEV.local etc.${MACHINE}/MAKEDEV ${DESTDIR}/dev
    183 	${ETC_INSTALL_FILE} -o root -g wheel -m 600 \
    184 	    minfree ${DESTDIR}/var/crash
    185 .for file in cshrc login profile shrc
    186 	${ETC_INSTALL_FILE} -o root -g wheel -m 644 \
    187 	    root/dot.${file} ${DESTDIR}/root/.${file}
    188 .endfor
    189 	${ETC_INSTALL_FILE} -o root -g wheel -m 600 \
    190 	    root/dot.klogin ${DESTDIR}/root/.klogin
    191 	rm -f ${DESTDIR}/.cshrc ${DESTDIR}/.profile
    192 	${ETC_INSTALL_LINK} ${DESTDIR}/root/.cshrc ${DESTDIR}/.cshrc
    193 	${ETC_INSTALL_LINK} ${DESTDIR}/root/.profile ${DESTDIR}/.profile
    194 	(cd ${.CURDIR}/defaults; ${MAKE} install)
    195 	(cd ${.CURDIR}/mtree; ${MAKE} install)
    196 .for file in ${NAMEDB}
    197 	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
    198 	    namedb/${file} ${DESTDIR}/etc/namedb
    199 .endfor
    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 root -g wheel -m 600 \
    214 	    /dev/null ${DESTDIR}/var/cron/log
    215 	${ETC_INSTALL_FILE} -o nobody -g ${BINGRP} -m 664 \
    216 	    /dev/null ${DESTDIR}/var/db/locate.database
    217 	${ETC_INSTALL_FILE} -o uucp -g dialer -m 640 \
    218 	    /dev/null ${DESTDIR}/var/log/aculog
    219 	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 600 \
    220 	    /dev/null ${DESTDIR}/var/log/authlog
    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_scores
    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 	mkdir -p ${OBSOLETE.dir}
    285 	(cd ${NETBSDSRCDIR}/distrib/sets; sh ./makeobsolete -t ${OBSOLETE.dir})
    286 .for file in ${OBSOLETE.files}
    287 	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
    288 	    ${OBSOLETE.dir}/${file} ${DESTDIR}/etc/obsolete
    289 .endfor
    290 
    291 
    292 # distrib-dirs --
    293 #	Populate $DESTDIR with directories needed by NetBSD
    294 #
    295 distrib-dirs: check_DESTDIR
    296 	${INSTALL_DIR} -o root -g wheel -m 755 ${BASE_PKG} ${DESTDIR}
    297 	${MTREE} -def ${.CURDIR}/mtree/NetBSD.dist -N ${.CURDIR} \
    298 	    -p ${DESTDIR}/ -U ${UNPRIVED:D-W}
    299 
    300 
    301 # release, snapshot --
    302 #	Build a full distribution including kernels & install media.
    303 #
    304 release snapshot: check_DESTDIR check_RELEASEDIR .WAIT \
    305 		    distribution .WAIT \
    306 		    snap_pre .WAIT snap_kern .WAIT \
    307 		    snap_post .WAIT snap_md_post
    308 	(cd ${NETBSDSRCDIR}/distrib/sets; ${MAKE} sets)
    309 	${MAKESUMS} -t ${RELEASEDIR}/${MACHINE}/binary/kernel '*.gz'
    310 
    311 
    312 # iso-image --
    313 #	Standalone target to create a CDROM image after the release
    314 #	was composed.  Should be run after "make release" in src and xsrc.
    315 #
    316 #	Note: At least mkisofs 2.0 should be used.
    317 #
    318 CDROM.image=${RELEASEDIR}/${MACHINE}/installation/cdrom/netbsd-${MACHINE}.iso
    319 CDROM.dir=	cdrom.dir
    320 CDROM.pathlist=	cdrom.pathlist
    321 
    322 iso-image: check_DESTDIR check_RELEASEDIR .WAIT iso-image_md_post
    323 #	empty target
    324 
    325 iso-image_setup: check_RELEASEDIR
    326 	rm -f ${CDROM.pathlist}
    327 	echo "${MACHINE}=${RELEASEDIR}/${MACHINE}" >> ${CDROM.pathlist}
    328 	mkdir -p ${CDROM.dir}
    329 	mkdir -p ${RELEASEDIR}/${MACHINE}/installation/cdrom
    330 
    331 # iso-image_mi --
    332 #	Create the image after the MD operations have completed.
    333 iso-image_mi: check_DESTDIR check_RELEASEDIR .WAIT \
    334 		iso-image_setup .WAIT iso-image_md_pre
    335 	@if ! ${MKISOFS} --version; then \
    336 		echo "install pkgsrc/sysutils/cdrecord and run 'make iso-image'." ; \
    337 		false; \
    338 	fi
    339 	${MKISOFS} ${MKISOFS_FLAGS} -graft-points -path-list ${CDROM.pathlist} \
    340 	    -o ${CDROM.image} ${CDROM.dir}
    341 	${MAKESUMS} -t ${RELEASEDIR}/${MACHINE}/installation/cdrom '*.iso'
    342 
    343 # iso-image_md_pre --
    344 #	Setup ${CDROM.dir} to produce a bootable CD image.
    345 #	Overridden by etc.$MACHINE/Makefile.inc
    346 #
    347 iso-image_md_pre: check_DESTDIR check_RELEASEDIR
    348 #	(empty -- look in the machine-dependent Makefile.inc)
    349 
    350 # iso-image_md_post --
    351 #	Fixup the CD-image to be bootable.
    352 #	Overridden by etc.$MACHINE/Makefile.inc
    353 #
    354 iso-image_md_post: check_DESTDIR check_RELEASEDIR .WAIT iso-image_mi
    355 #	(empty -- look in the machine-dependent Makefile.inc)
    356 
    357 
    358 # snap_pre --
    359 #	Create ${RELEASEDIR} and necessary subdirectories.
    360 #
    361 snap_pre: check_DESTDIR check_RELEASEDIR
    362 	${INSTALL} -d -m 755 ${RELEASEDIR}
    363 .ifndef UPDATE
    364 # Could be a mount point, ignore the errors
    365 	-/bin/rm -rf ${RELEASEDIR}/${MACHINE}
    366 .endif
    367 	${INSTALL} -d -m 755 ${RELEASEDIR}/${MACHINE}
    368 .for dir in ${INSTALLATION_DIRS}
    369 	${INSTALL} -d -m 755 ${RELEASEDIR}/${MACHINE}/${dir}
    370 .endfor
    371 
    372 # snap_post --
    373 #	Build the install media and notes from distrib
    374 #
    375 snap_post: check_DESTDIR check_RELEASEDIR
    376 .ifndef UPDATE
    377 	cd ${NETBSDSRCDIR}/distrib && ${MAKE} cleandir
    378 .endif
    379 	cd ${NETBSDSRCDIR}/distrib && ${MAKE} depend && ${MAKE} && \
    380 	    ${MAKE} release
    381 
    382 # snap_kern --
    383 #	This target builds the kernels specified by each port.
    384 #	A port may specify the following kernels:
    385 #
    386 #	KERNEL_SETS		The list of kernels that will be
    387 #				packaged into sets, named
    388 #				kern-${kernel}.tgz.  These kernels
    389 #				are also placed in the binary/kernel
    390 #				area of the release package as
    391 #				netbsd-${kernel}.gz.
    392 #
    393 #	EXTRA_KERNELS		Additional kernels to place in the
    394 #				binary/kernel area of the release
    395 #				package as netbsd-${kernel}.gz, but
    396 #				which are not placed into sets. This
    397 #				allows a port to provide e.g. a netbootable
    398 #				installation kernel containing a ramdisk.
    399 #
    400 #	BUILD_KERNELS		Additional kernels to build which are
    401 #				not placed into sets nor into the
    402 #				binary/kernel area of the release
    403 #				package.  These are typically kernels
    404 #				that are built for inclusion only in
    405 #				installation disk/CD-ROM/tape images.
    406 #
    407 #	A port may also specify KERNEL_SUFFIXES, which is an optional list
    408 #	of filename suffixes for kernels to include in the kernel sets and
    409 #	in the binary/kernel area of the release package (e.g. "netbsd" vs.
    410 #	"netbsd.ecoff" and "netbsd.srec").  It is not an error if kernels
    411 #	with these suffixes do not exist in the kernel build directory.
    412 #
    413 #
    414 # A list of all the kernels to build, which can be overridden from
    415 # external sources (such as make(1)'s environment or command line)
    416 #
    417 ALL_KERNELS?=	${KERNEL_SETS} ${EXTRA_KERNELS} ${BUILD_KERNELS}
    418 
    419 GETKERNELAWK=	awk '/^config/ {print $$2; found=1} \
    420 		END{ if (found == 0) print "netbsd"; }'
    421 
    422 .if !target(snap_kern)						# {
    423 
    424 # build_kernels --
    425 #	Configure & compile kernels listed in ${ALL_KERNELS}
    426 #
    427 .if !defined(KERNELS_DONE)						# {
    428 .for configfile in ${ALL_KERNELS}					# {
    429 _KERNELS_TO_BUILD+=kern-${configfile}
    430 kern-${configfile}:
    431 	cd ${KERNCONFDIR} && ${CONFIG} -s ${KERNSRCDIR} \
    432 	    -b ${KERNOBJDIR}/${configfile:C/.*\///} ${configfile}
    433 .if !defined(UPDATE)
    434 	cd ${KERNOBJDIR}/${configfile:C/.*\///} && ${MAKE} distclean
    435 .endif
    436 	cd ${KERNOBJDIR}/${configfile:C/.*\///} && ${MAKE} depend && ${MAKE}
    437 .endfor	# ALL_KERNELS							# }
    438 .endif	# KERNELS_DONE							# }
    439 
    440 build_kernels: ${_KERNELS_TO_BUILD}
    441 
    442 # build_kernelsets --
    443 #	Create kernel sets from ${KERNEL_SETS} into
    444 #	${RELEASEDIR}/${MACHINE}/binary/sets
    445 #
    446 .for configfile in ${KERNEL_SETS}					# {
    447 _KERNELSETS_TO_BUILD+=kernset-${configfile}
    448 kernset-${configfile}:
    449 	kernlist=`${GETKERNELAWK} ${KERNCONFDIR}/${configfile}`; \
    450 	kerndir=${KERNOBJDIR}/${configfile:C/.*\///}; \
    451 	kernsuffixes="${KERNEL_SUFFIXES}"; \
    452 	cd $${kerndir} && ( \
    453 		echo "/set uname=${BINOWN} gname=${BINGRP}"; \
    454 		echo ". type=dir optional"; \
    455 		for kernel in $${kernlist}; do \
    456 			echo "./$${kernel} type=file"; \
    457 			for s in $${kernsuffixes}; do \
    458 				if [ -f $${kernel}.$${s} ]; then \
    459 					echo "./$${kernel}.$${s} type=file"; \
    460 				fi; \
    461 			done; \
    462 		done ) | GZIP=-9 ${PAX} -O -zw \
    463 		    -M -N ${NETBSDSRCDIR}/etc \
    464 		    -f ${RELEASEDIR}/${MACHINE}/binary/sets/kern-${configfile}.tgz
    465 .endfor	# KERNEL_SETS							# }
    466 
    467 build_kernelsets: ${_KERNELSETS_TO_BUILD}
    468 
    469 # build_releasekernels --
    470 #	Build kernel.gz from ${KERNEL_SETS} ${EXTRA_KERNELS} into
    471 #	${RELEASEDIR}/${MACHINE}/binary/kernel
    472 #
    473 .for configfile in ${KERNEL_SETS} ${EXTRA_KERNELS}			# {
    474 _RELEASEKERNELS_TO_BUILD+=releasekern-${configfile}
    475 releasekern-${configfile}:
    476 	kernlist=`${GETKERNELAWK} ${KERNCONFDIR}/${configfile:C/.*\///}`; \
    477 	kerndir=${KERNOBJDIR}/${configfile:C/.*\///}; \
    478 	kernsuffixes="${KERNEL_SUFFIXES}"; \
    479 	cd $${kerndir} &&	\
    480 		gziplist=`for kernel in $${kernlist}; do \
    481 			echo "$${kernel}"; \
    482 			for s in $${kernsuffixes}; do \
    483 				if [ -f $${kernel}.$${s} ]; then \
    484 					echo "$${kernel}.$${s}"; \
    485 				fi; \
    486 			done; \
    487 		done`; \
    488 		for kernel in $${gziplist} ; do \
    489 		gzip -c -9 < $${kernel} > \
    490 		    ${RELEASEDIR}/${MACHINE}/binary/kernel/$${kernel}-${configfile:C/.*\///}.gz ; done
    491 .endfor	# KERNEL_SETS EXTRA_KERNELS					# }
    492 
    493 build_releasekernels: ${_RELEASEKERNELS_TO_BUILD}
    494 
    495 # snap_kern --
    496 #	build the kernels, then the sets & release kernels
    497 #
    498 snap_kern: check_DESTDIR check_RELEASEDIR .WAIT \
    499 	    build_kernels .WAIT \
    500 	    build_kernelsets build_releasekernels
    501 
    502 .endif # !target(snap_kern)					# }
    503 
    504 
    505 # snap_md_post --
    506 #	Machine dependent distribution media operations.
    507 #	Overridden by etc.$MACHINE/Makefile.inc
    508 #
    509 snap_md_post: check_DESTDIR check_RELEASEDIR
    510 #	(empty -- look in the machine-dependent Makefile.inc)
    511 
    512 
    513 clean:
    514 	-rm -rf ${CDROM.dir} ${CDROM.pathlist} ${OBSOLETE.dir}
    515 
    516 .include <bsd.prog.mk>
    517