Home | History | Annotate | Line # | Download | only in etc
Makefile revision 1.288
      1 #	$NetBSD: Makefile,v 1.288 2004/05/17 07:00:16 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 #   MKCRYPTO; if not `no', install crypto-related configuration
     19 #   MKSENDMAIL; if not `no', install sendmail configuration
     20 #   MKUNPRIVED; if not `no', allow non-root installs.
     21 #   MKUPDATE; if not `no', don't do a 'make clean' before kernel compile
     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/${RELEASEMACHINEDIR}.
     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 MK* vars
     37 .include <bsd.own.mk>
     38 
     39 .include <bsd.sys.mk>		# for HOST_SH
     40 .include <bsd.kernobj.mk>	# For KERNSRCDIR, KERNOBJDIR, ...
     41 .include <bsd.endian.mk>	# For TARGET_ENDIANNESS
     42 
     43 
     44 .MAKEOVERRIDES+=	USETOOLS
     45 
     46 TZDIR=		/usr/share/zoneinfo
     47 LOCALTIME?=	UTC
     48 CKSUM?=		${TOOL_CKSUM}
     49 MAKESUMS=	CKSUM=${CKSUM:Q} ${HOST_SH} ${NETBSDSRCDIR}/distrib/sets/makesums
     50 DISTRIBVER!=	${HOST_SH} ${NETBSDSRCDIR}/sys/conf/osrelease.sh
     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!=	${HOST_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}/${RELEASEMACHINEDIR}/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}/${RELEASEMACHINEDIR}.
     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.${RELEASEMACHINE}/Makefile.inc)
     80 .include "etc.${RELEASEMACHINE}/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 locate.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_OBJ_FILE=cd ${.OBJDIR} && ${INSTALL_FILE} ${ETC_PKG}
    123 ETC_INSTALL_LINK=cd ${.CURDIR} && ${INSTALL_LINK} ${ETC_PKG}
    124 ETC_INSTALL_SYMLINK=cd ${.CURDIR} && ${INSTALL_SYMLINK} ${ETC_PKG}
    125 
    126 .if ${TARGET_ENDIANNESS} == "1234"
    127 PWD_MKDB_ENDIAN=	-L
    128 .elif ${TARGET_ENDIANNESS} == "4321"
    129 PWD_MKDB_ENDIAN=	-B
    130 .else
    131 PWD_MKDB_ENDIAN=
    132 .endif
    133 
    134 
    135 # distribution --
    136 #	Build a distribution
    137 #
    138 distribution: .PHONY check_DESTDIR .WAIT distrib-dirs
    139 .if !defined(DISTRIBUTION_DONE)
    140 .if !defined(INSTALL_DONE)
    141 	${MAKEDIRTARGET} ${NETBSDSRCDIR} include _DISTRIB=
    142 	${MAKEDIRTARGET} ${NETBSDSRCDIR} install _DISTRIB=
    143 .endif	# !INSTALL_DONE
    144 	${MAKEDIRTARGET} . install-etc-files
    145 .if ${MKX11} != "no"
    146 	${MAKEDIRTARGET} ${NETBSDSRCDIR}/x11 distribution
    147 .endif
    148 	${MAKEDIRTARGET} ${NETBSDSRCDIR}/distrib/sets makesetfiles
    149 .endif	# !DISTRIBUTION_DONE
    150 
    151 
    152 CLEANFILES+=	MAKEDEV
    153 MAKEDEV: .EXEC
    154 	${_MKTARGET_CREATE}
    155 	MACHINE=${MACHINE:Q} MACHINE_ARCH=${MACHINE_ARCH:Q} \
    156 	    NETBSDSRCDIR=${NETBSDSRCDIR:Q} \
    157 	    awk -f ${.CURDIR}/MAKEDEV.awk ${.CURDIR}/MAKEDEV.tmpl > ${.TARGET}
    158 
    159 
    160 RELEASEVARS=	BSDOBJDIR BSDSRCDIR BUILDID \
    161 		DESTDIR EXTERNAL_TOOLCHAIN \
    162 		INSTALLWORLDDIR \
    163 		KERNARCHDIR KERNCONFDIR KERNOBJDIR KERNSRCDIR \
    164 		MACHINE MACHINE_ARCH MAKE MAKECONF MAKEFLAGS \
    165 		MAKEOBJDIR MAKEOBJDIRPREFIX MAKEVERBOSE \
    166 		MKBFD MKCATPAGES \
    167 		MKCRYPTO MKCRYPTO_IDEA MKCRYPTO_MDC2 MKCRYPTO_RC5 MKCVS \
    168 		MKDOC MKDYNAMICROOT MKGCC MKGCCCMDS MKGDB \
    169 		MKHESIOD MKHOSTOBJ MKHTML MKIEEEFP MKINFO \
    170 		MKKERBEROS4 MKKERBEROS MKLINKLIB MKLINT \
    171 		MKMAN MKMANZ MKNLS MKOBJ MKOBJDIRS \
    172 		MKPIC MKPICINSTALL MKPICLIB MKPOSTFIX MKPROFILE \
    173 		MKSENDMAIL MKSHARE MKSKEY MKSOFTFLOAT MKSTATICLIB \
    174 		MKUNPRIVED MKUPDATE MKUUCP MKX11 MKYP \
    175 		NBUILDJOBS NETBSDSRCDIR \
    176 		NOCLEANDIR NODISTRIBDIRS NOINCLUDES \
    177 		OBJMACHINE \
    178 		RELEASEDIR TOOLCHAIN_MISSING TOOLDIR \
    179 		USETOOLS USR_OBJMACHINE \
    180 		X11SRCDIR
    181 
    182 params: .PHONY
    183 .for var in ${RELEASEVARS}
    184 .if defined(${var})
    185 	@printf "%20s = '%-s'\n" ${var} ${${var}:Q}
    186 .else
    187 	@printf "%20s = (undefined)\n" ${var}
    188 .endif
    189 .endfor
    190 
    191 CLEANFILES+=	etc-release
    192 etc-release: .EXEC
    193 	${_MKTARGET_CREATE}
    194 	@(	echo "NetBSD ${DISTRIBVER}/${MACHINE}"; \
    195 		echo ; \
    196 		cat ${NETBSDSRCDIR}/sys/conf/copyright; \
    197 		echo ; \
    198 		echo "Build settings:"; \
    199 		printf "%20s   %s\n"  "Build date" "$$(date -u)"; \
    200 		printf "%20s   %s\n"  "Built by" "$${USER-root}@$$(hostname)"; \
    201 		echo ; \
    202 		(cd ${.CURDIR}; ${MAKE} ${MFLAGS} -j1 params); \
    203 	) >${.OBJDIR}/${.TARGET}
    204 
    205 install-etc-release: .PHONY etc-release
    206 	${_MKMSG_INSTALL} etc/release
    207 	${ETC_INSTALL_OBJ_FILE} -o ${BINOWN} -g ${BINGRP} -m 444 \
    208 	    etc-release ${DESTDIR}/etc/release
    209 
    210 # install-etc-files --
    211 #	Install etc (config) files; not performed by "make build"
    212 #
    213 install-etc-files: .PHONY check_DESTDIR MAKEDEV
    214 	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
    215 	    ${BIN1} ${DESTDIR}/etc
    216 	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 664 \
    217 	    ${BIN2} ${DESTDIR}/etc
    218 	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 600 \
    219 	    ${BIN3} ${DESTDIR}/etc
    220 	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
    221 	    aliases ${DESTDIR}/etc/mail
    222 	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
    223 	    /dev/null ${DESTDIR}/etc/mail/local-host-names
    224 	${ETC_INSTALL_FILE} -o root -g wheel -m 600 \
    225 	    crontab ${DESTDIR}/var/cron/tabs/root
    226 	${ETC_INSTALL_FILE} -o root -g wheel -m 600 \
    227 	    master.passwd ${DESTDIR}/etc
    228 	${TOOL_PWD_MKDB} -p ${PWD_MKDB_ENDIAN} -d ${DESTDIR}/ \
    229 	    ${DESTDIR}/etc/master.passwd
    230 .if ${MKUNPRIVED} != "no"
    231 	( \
    232 		for metaent in passwd pwd.db spwd.db; do \
    233 	    		echo "./etc/$${metaent} type=file mode=0644 uname=root gname=wheel tags=etc_pkg"; \
    234 		done; \
    235 	) | ${METALOG.add}
    236 .endif	# MKUNPRIVED != no
    237 	${ETC_INSTALL_OBJ_FILE} -o ${BINOWN} -g ${BINGRP} -m 555 \
    238 	    MAKEDEV ${DESTDIR}/dev
    239 	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 555 \
    240 	    MAKEDEV.local ${DESTDIR}/dev
    241 	${ETC_INSTALL_FILE} -o root -g wheel -m 600 \
    242 	    minfree ${DESTDIR}/var/crash
    243 	${MAKEDIRTARGET} defaults configinstall
    244 	${MAKEDIRTARGET} mtree configinstall
    245 	${MAKEDIRTARGET} namedb configinstall
    246 	${MAKEDIRTARGET} powerd configinstall
    247 	${MAKEDIRTARGET} rc.d configinstall
    248 	${MAKEDIRTARGET} root configinstall
    249 	${MAKEDIRTARGET} skel configinstall
    250 	${MAKEDIRTARGET} ssh configinstall
    251 	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
    252 	    postinstall ${DESTDIR}/etc
    253 	${ETC_INSTALL_SYMLINK} -o root -g wheel -m 755 \
    254 	    ${TZDIR}/${LOCALTIME} ${DESTDIR}/etc/localtime
    255 	${ETC_INSTALL_SYMLINK} -o root -g wheel -m 755 \
    256 	    /usr/sbin/rmt ${DESTDIR}/etc/rmt
    257 	${ETC_INSTALL_FILE} -o ${BINOWN} -g operator -m 664 \
    258 	    /dev/null ${DESTDIR}/etc/dumpdates
    259 	${ETC_INSTALL_FILE} -o ${BINOWN} -g operator -m 600 \
    260 	    /dev/null ${DESTDIR}/etc/skeykeys
    261 	${ETC_INSTALL_FILE} -o root -g wheel -m 600 \
    262 	    /dev/null ${DESTDIR}/var/at/at.deny
    263 	${ETC_INSTALL_FILE} -o nobody -g ${BINGRP} -m 664 \
    264 	    /dev/null ${DESTDIR}/var/db/locate.database
    265 	${ETC_INSTALL_FILE} -o uucp -g dialer -m 640 \
    266 	    /dev/null ${DESTDIR}/var/log/aculog
    267 	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 600 \
    268 	    /dev/null ${DESTDIR}/var/log/authlog
    269 	${ETC_INSTALL_FILE} -o root -g wheel -m 600 \
    270 	    /dev/null ${DESTDIR}/var/log/cron
    271 	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 664 \
    272 	    /dev/null ${DESTDIR}/var/log/lastlog
    273 	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 640 \
    274 	    /dev/null ${DESTDIR}/var/log/lpd-errs
    275 	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 600 \
    276 	    /dev/null ${DESTDIR}/var/log/maillog
    277 	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
    278 	    /dev/null ${DESTDIR}/var/log/messages
    279 	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 600 \
    280 	    /dev/null ${DESTDIR}/var/log/secure
    281 	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
    282 	    /dev/null ${DESTDIR}/var/log/sendmail.st
    283 	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
    284 	    /dev/null ${DESTDIR}/var/log/wtmp
    285 	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
    286 	    /dev/null ${DESTDIR}/var/log/wtmpx
    287 	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 600 \
    288 	    /dev/null ${DESTDIR}/var/log/xferlog
    289 	${ETC_INSTALL_FILE} -o daemon -g staff -m 664 \
    290 	    /dev/null ${DESTDIR}/var/msgs/bounds
    291 	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${UTMPGRP} -m 664 \
    292 	    /dev/null ${DESTDIR}/var/run/utmp
    293 	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${UTMPGRP} -m 664 \
    294 	    /dev/null ${DESTDIR}/var/run/utmpx
    295 	${ETC_INSTALL_FILE} -o games -g games -m 664 \
    296 	    /dev/null ${DESTDIR}/var/games/atc_score
    297 	${ETC_INSTALL_FILE} -o games -g games -m 664 \
    298 	    /dev/null ${DESTDIR}/var/games/battlestar.log
    299 	${ETC_INSTALL_FILE} -o games -g games -m 664 \
    300 	    /dev/null ${DESTDIR}/var/games/cfscores
    301 	${ETC_INSTALL_FILE} -o games -g games -m 664 \
    302 	    /dev/null ${DESTDIR}/var/games/criblog
    303 	${ETC_INSTALL_FILE} -o games -g games -m 660 \
    304 	    /dev/null ${DESTDIR}/var/games/hackdir/perm
    305 	${ETC_INSTALL_FILE} -o games -g games -m 660 \
    306 	    /dev/null ${DESTDIR}/var/games/hackdir/record
    307 	${ETC_INSTALL_FILE} -o games -g games -m 664 \
    308 	    /dev/null ${DESTDIR}/var/games/larn/llog12.0
    309 	${ETC_INSTALL_FILE} -o games -g games -m 664 \
    310 	    /dev/null ${DESTDIR}/var/games/larn/lscore12.0
    311 	${ETC_INSTALL_FILE} -o games -g games -m 664 \
    312 	    /dev/null ${DESTDIR}/var/games/larn/playerids
    313 	${ETC_INSTALL_FILE} -o games -g games -m 664 \
    314 	    /dev/null ${DESTDIR}/var/games/robots_roll
    315 	${ETC_INSTALL_FILE} -o games -g games -m 664 \
    316 	    /dev/null ${DESTDIR}/var/games/rogue.scores
    317 	${ETC_INSTALL_FILE} -o games -g games -m 664 \
    318 	    /dev/null ${DESTDIR}/var/games/saillog
    319 	${ETC_INSTALL_FILE} -o games -g games -m 664 \
    320 	    /dev/null ${DESTDIR}/var/games/snakerawscores
    321 	${ETC_INSTALL_FILE} -o games -g games -m 664 \
    322 	    /dev/null ${DESTDIR}/var/games/snake.log
    323 	${ETC_INSTALL_FILE} -o games -g games -m 664 \
    324 	    /dev/null ${DESTDIR}/var/games/tetris.scores
    325 	${MAKEDIRTARGET} ${NETBSDSRCDIR}/usr.bin/mail configinstall
    326 	${MAKEDIRTARGET} ${NETBSDSRCDIR}/gnu/usr.sbin/postfix configinstall
    327 .if (${MKCRYPTO} != "no")
    328 	${MAKEDIRTARGET} ${NETBSDSRCDIR}/usr.bin/ssh configinstall
    329 .endif
    330 .if (${MKSENDMAIL} != "no")
    331 	${MAKEDIRTARGET} ${NETBSDSRCDIR}/gnu/usr.sbin/sendmail/cf/cf configinstall
    332 .endif
    333 
    334 
    335 # install-obsolete-lists --
    336 #	Install var/db/obsolete set lists; this is performed by "make build"
    337 #
    338 OBSOLETE.dir=		${.OBJDIR}/obsolete.dir
    339 OBSOLETE.files=		base comp etc games man misc text
    340 
    341 install-obsolete-lists: .PHONY
    342 	mkdir -p ${OBSOLETE.dir}
    343 	(cd ${NETBSDSRCDIR}/distrib/sets && \
    344 	    MAKE=${MAKE:Q} ${HOST_SH} ./makeobsolete -t ${OBSOLETE.dir})
    345 .for file in ${OBSOLETE.files}
    346 	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
    347 	    ${OBSOLETE.dir}/${file} ${DESTDIR}/var/db/obsolete
    348 .endfor
    349 
    350 
    351 # distrib-dirs --
    352 #	Populate $DESTDIR with directories needed by NetBSD
    353 #
    354 .if ${MKUNPRIVED} == "no"
    355 TOOL_MTREE.unpriv=
    356 .else
    357 TOOL_MTREE.unpriv=	-W
    358 .endif
    359 
    360 distrib-dirs: .PHONY check_DESTDIR
    361 .if !defined(DISTRIBUTION_DONE)
    362 	${INSTALL_DIR} -o root -g wheel -m 755 ${BASE_PKG} ${DESTDIR}
    363 .endif
    364 	${TOOL_MTREE} -def ${.CURDIR}/mtree/NetBSD.dist -N ${.CURDIR} \
    365 	    -p ${DESTDIR}/ -U ${TOOL_MTREE.unpriv}
    366 
    367 
    368 # release, snapshot --
    369 #	Build a full distribution including kernels & install media.
    370 #
    371 release snapshot: .PHONY check_DESTDIR check_RELEASEDIR .WAIT \
    372 		    distribution .WAIT \
    373 		    snap_pre .WAIT snap_kern .WAIT \
    374 		    snap_post .WAIT snap_md_post
    375 	${MAKEDIRTARGET} ${NETBSDSRCDIR}/distrib/sets sets
    376 	${MAKESUMS} -t ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/kernel '*.gz'
    377 
    378 
    379 # iso-image --
    380 #	Standalone target to create a CDROM image after the release
    381 #	was composed.  Should be run after "make release" in src and xsrc.
    382 #
    383 #	Note: At least mkisofs 2.0 should be used.
    384 #
    385 CDROM.image=${RELEASEDIR}/${RELEASEMACHINEDIR}/installation/cdrom/netbsd-${MACHINE}.iso
    386 CDROM.dir=	cdrom.dir
    387 CDROM.pathlist=	cdrom.pathlist
    388 
    389 iso-image: .PHONY check_DESTDIR check_RELEASEDIR .WAIT iso-image-md-post
    390 	${MAKESUMS} -t ${RELEASEDIR}/${RELEASEMACHINEDIR}/installation/cdrom '*.iso'
    391 	@echo "iso-image created as: ${CDROM.image}"
    392 
    393 iso-image-setup: .PHONY check_RELEASEDIR
    394 	rm -f ${CDROM.pathlist}
    395 	echo "${MACHINE}=${RELEASEDIR}/${RELEASEMACHINEDIR}" >> ${CDROM.pathlist}
    396 	mkdir -p ${CDROM.dir}
    397 	mkdir -p ${RELEASEDIR}/${RELEASEMACHINEDIR}/installation/cdrom
    398 
    399 # iso-image-mi --
    400 #	Create the image after the MD operations have completed.
    401 #
    402 iso-image-mi: .PHONY check_DESTDIR check_RELEASEDIR .WAIT \
    403 		iso-image-setup .WAIT iso-image-md-pre
    404 	@if ! ${MKISOFS} --version; then \
    405 		echo "install pkgsrc/sysutils/cdrecord and run 'make iso-image'." ; \
    406 		false; \
    407 	fi
    408 	${MKISOFS} ${MKISOFS_FLAGS} -graft-points -path-list ${CDROM.pathlist} \
    409 	    -o ${CDROM.image} ${CDROM.dir}
    410 
    411 # iso-image-md-pre --
    412 #	Setup ${CDROM.dir} to produce a bootable CD image.
    413 #	Overridden by etc.$MACHINE/Makefile.inc
    414 #
    415 iso-image-md-pre: .PHONY check_DESTDIR check_RELEASEDIR
    416 #	(empty -- look in the machine-dependent Makefile.inc)
    417 
    418 # iso-image-md-post --
    419 #	Fixup the CD-image to be bootable.
    420 #	Overridden by etc.$MACHINE/Makefile.inc
    421 #
    422 iso-image-md-post: .PHONY check_DESTDIR check_RELEASEDIR .WAIT iso-image-mi
    423 #	(empty -- look in the machine-dependent Makefile.inc)
    424 
    425 
    426 # snap_pre --
    427 #	Create ${RELEASEDIR} and necessary subdirectories.
    428 #
    429 snap_pre: .PHONY check_DESTDIR check_RELEASEDIR
    430 	${INSTALL} -d -m 755 ${RELEASEDIR}
    431 .if ${MKUPDATE} == "no"
    432 # Could be a mount point, ignore the errors
    433 	-/bin/rm -rf ${RELEASEDIR}/${RELEASEMACHINEDIR}
    434 .endif
    435 	${INSTALL} -d -m 755 ${RELEASEDIR}/${RELEASEMACHINEDIR}
    436 .for dir in ${INSTALLATION_DIRS}
    437 	${INSTALL} -d -m 755 ${RELEASEDIR}/${RELEASEMACHINEDIR}/${dir}
    438 .endfor
    439 
    440 # snap_post --
    441 #	Build the install media and notes from distrib
    442 #
    443 snap_post: .PHONY check_DESTDIR check_RELEASEDIR
    444 .if ${MKUPDATE} == "no"
    445 	cd ${NETBSDSRCDIR}/distrib && ${MAKE} cleandir
    446 .endif
    447 	cd ${NETBSDSRCDIR}/distrib && ${MAKE} depend && ${MAKE} && \
    448 	    ${MAKE} release
    449 
    450 # snap_kern --
    451 #	This target builds the kernels specified by each port.
    452 #	A port may specify the following kernels:
    453 #
    454 #	KERNEL_SETS		The list of kernels that will be
    455 #				packaged into sets, named
    456 #				kern-${kernel}.tgz.  These kernels
    457 #				are also placed in the binary/kernel
    458 #				area of the release package as
    459 #				netbsd-${kernel}.gz.
    460 #
    461 #	EXTRA_KERNELS		Additional kernels to place in the
    462 #				binary/kernel area of the release
    463 #				package as netbsd-${kernel}.gz, but
    464 #				which are not placed into sets. This
    465 #				allows a port to provide e.g. a netbootable
    466 #				installation kernel containing a ramdisk.
    467 #
    468 #	BUILD_KERNELS		Additional kernels to build which are
    469 #				not placed into sets nor into the
    470 #				binary/kernel area of the release
    471 #				package.  These are typically kernels
    472 #				that are built for inclusion only in
    473 #				installation disk/CD-ROM/tape images.
    474 #
    475 #	A port may also specify KERNEL_SUFFIXES, which is an optional list
    476 #	of filename suffixes for kernels to include in the kernel sets and
    477 #	in the binary/kernel area of the release package (e.g. "netbsd" vs.
    478 #	"netbsd.ecoff" and "netbsd.srec").  It is not an error if kernels
    479 #	with these suffixes do not exist in the kernel build directory.
    480 #
    481 #
    482 # A list of all the kernels to build, which can be overridden from
    483 # external sources (such as make(1)'s environment or command line)
    484 #
    485 ALL_KERNELS?=	${KERNEL_SETS} ${EXTRA_KERNELS} ${BUILD_KERNELS}
    486 
    487 GETKERNELAWK=	awk '/^config/ {print $$2; found=1} \
    488 		END{ if (found == 0) print "netbsd"; }'
    489 
    490 .if !target(snap_kern)						# {
    491 
    492 # build_kernels --
    493 #	Configure & compile kernels listed in ${ALL_KERNELS}
    494 #
    495 # The 'sync' is so that all writes during the build are pushed back
    496 # to the disk.  Not having it causes problems on some host systems
    497 # (e.g. Linux) when building on NFS.
    498 #
    499 .if !defined(KERNELS_DONE)						# {
    500 .for configfile in ${ALL_KERNELS}					# {
    501 _KERNELS_TO_BUILD+=kern-${configfile}
    502 kern-${configfile}: .PHONY
    503 	cd ${KERNCONFDIR} && ${TOOL_CONFIG} -s ${KERNSRCDIR} \
    504 	    -b ${KERNOBJDIR}/${configfile:C/.*\///} ${configfile}
    505 .if ${MKUPDATE} == "no"
    506 	cd ${KERNOBJDIR}/${configfile:C/.*\///} && ${MAKE} distclean
    507 .endif
    508 	cd ${KERNOBJDIR}/${configfile:C/.*\///} && ${MAKE} depend && ${MAKE}
    509 	sync
    510 .endfor	# ALL_KERNELS							# }
    511 .endif	# KERNELS_DONE							# }
    512 
    513 build_kernels: .PHONY ${_KERNELS_TO_BUILD}
    514 
    515 # build_kernelsets --
    516 #	Create kernel sets from ${KERNEL_SETS} into
    517 #	${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/sets
    518 #
    519 .for configfile in ${KERNEL_SETS}					# {
    520 _KERNELSETS_TO_BUILD+=kernset-${configfile}
    521 kernset-${configfile}: .PHONY
    522 	@ kernlist=`${GETKERNELAWK} ${KERNCONFDIR}/${configfile}`; \
    523 	kerndir=${KERNOBJDIR}/${configfile:C/.*\///}; \
    524 	kernsuffixes="${KERNEL_SUFFIXES:S/^/./}"; \
    525 	kern_tgz=${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/sets/kern-${configfile}.tgz; \
    526 	pax_cmd="GZIP=-9 ${TOOL_PAX} -O -zw -M -N ${NETBSDSRCDIR}/etc -f $${kern_tgz}"; \
    527 	cd $${kerndir} && { \
    528 		kernels=; newest=; \
    529 		for kernel in $${kernlist}; do \
    530 			for s in "" $${kernsuffixes}; do \
    531 				ks="$${kernel}$${s}"; \
    532 				[ -f $${ks} ] || continue; \
    533 				kernels="$${kernels} $${ks}"; \
    534 				[ -z "$${newest}" -o $${ks} -nt "$${newest}" ] && \
    535 					newest=$${ks}; \
    536 			done; \
    537 		done; \
    538 		[ $${kern_tgz} -nt "$${newest}" ] || { \
    539 			echo "echo $${kernels} | $${pax_cmd}"; \
    540 			( echo "/set uname=${BINOWN} gname=${BINGRP}"; \
    541 			echo ". type=dir optional"; \
    542 			for kernel in $${kernels}; do \
    543 				echo "./$${kernel} type=file"; \
    544 			done ) | eval $${pax_cmd}; \
    545 		} \
    546 	}
    547 .endfor	# KERNEL_SETS							# }
    548 
    549 build_kernelsets: ${_KERNELSETS_TO_BUILD}
    550 
    551 # build_releasekernels --
    552 #	Build kernel.gz from ${KERNEL_SETS} ${EXTRA_KERNELS} into
    553 #	${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/kernel
    554 #
    555 .for configfile in ${KERNEL_SETS} ${EXTRA_KERNELS}			# {
    556 _RELEASEKERNELS_TO_BUILD+=releasekern-${configfile}
    557 releasekern-${configfile}: .PHONY
    558 	@ kernlist=`${GETKERNELAWK} ${KERNCONFDIR}/${configfile:C/.*\///}`; \
    559 	kerndir=${KERNOBJDIR}/${configfile:C/.*\///}; \
    560 	kernsuffixes="${KERNEL_SUFFIXES:S/^/./}"; \
    561 	cd $${kerndir} && {	\
    562 		for kernel in $${kernlist}; do \
    563 			for s in "" $${kernsuffixes}; do \
    564 				ks="$${kernel}$${s}"; \
    565 				[ ! -f $${ks} ] && continue; \
    566 				knl_gz="${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/kernel/$${ks}-${configfile:C/.*\///}.gz"; \
    567 				[ $${knl_gz} -nt $${ks} ] && continue; \
    568 				echo "gzip -c -9 < $${kerndir}/$${ks} > $${knl_gz}"; \
    569 				gzip -c -9 < $${ks} > $${knl_gz}; \
    570 			done; \
    571 		done; \
    572 	}
    573 .endfor	# KERNEL_SETS EXTRA_KERNELS					# }
    574 
    575 build_releasekernels: ${_RELEASEKERNELS_TO_BUILD}
    576 
    577 # snap_kern --
    578 #	build the kernels, then the sets & release kernels
    579 #
    580 snap_kern: check_DESTDIR check_RELEASEDIR .WAIT \
    581 	    build_kernels .WAIT \
    582 	    build_kernelsets build_releasekernels
    583 
    584 .endif # !target(snap_kern)					# }
    585 
    586 
    587 # snap_md_post --
    588 #	Machine dependent distribution media operations.
    589 #	Overridden by etc.$MACHINE/Makefile.inc
    590 #
    591 snap_md_post: check_DESTDIR check_RELEASEDIR
    592 #	(empty -- look in the machine-dependent Makefile.inc)
    593 
    594 
    595 clean:
    596 	-rm -rf ${CDROM.dir} ${CDROM.pathlist} ${OBSOLETE.dir}
    597 
    598 .include <bsd.prog.mk>
    599