Makefile revision 1.244
11.244Smrg#	$NetBSD: Makefile,v 1.244 2003/01/09 16:57:45 mrg Exp $
21.66Smikel#	from: @(#)Makefile	8.7 (Berkeley) 5/25/95
31.1Scgd
41.96Scjs# Environment variables without default values:
51.96Scjs#   DESTDIR must be set before anything in this file will work.
61.96Scjs#   RELEASEDIR is where the tarred up stuff for a snapshot or
71.96Scjs#	release will be placed.
81.96Scjs#
91.96Scjs# Environment variables with default values:
101.96Scjs#   LOCALTIME will set the default local time for the system you
111.96Scjs#	build; it determines what /etc/localtime is symlink'd to.
121.96Scjs#   KERNSRCDIR points to kernel source; it is set by default to ../sys,
131.96Scjs#	but can be overridden.
141.96Scjs#   KERNOBJDIR is the kernel build directory, it defaults to
151.172Sjlam#	${KERNSRCDIR}/arch/${MACHINE}/compile, but can be overridden.
161.96Scjs#   KERNCONFDIR is where the configuration files for kernels are found;
171.96Scjs#	default is ${KERNSRCDIR}/arch/${MACHINE}/conf but can be overridden.
181.97Scjs#   UPDATE is normally undefined; if defined, don't do a 'make clean'
191.97Scjs#	before kernel compile
201.96Scjs#   NO_SENDMAIL is normally undefined; if defined, it will not do a
211.96Scjs#	`make distribution' in the sendmail config file source directory.
221.154Sthorpej#
231.96Scjs# Targets:
241.96Scjs#    distribution: makes a full NetBSD distribution in DESTDIR. If
251.96Scjs#	INSTALL_DONE is set, it will not do a `make install.'
261.182Schs#	if DISTRIBUTION_DONE is set, it will not do anything.
271.96Scjs#    distrib-dirs: creates an empty NetBSD directory tree in DESTDIR.
281.96Scjs#	Called by distribution.
291.96Scjs#    snapshot: calls distribution, above, and then tars up the files
301.241Slukem#	into a release(7) format in RELEASEDIR/${MACHINE}.
311.241Slukem#	Any port-dependent stuff for this target is found in
321.241Slukem#	etc.${MACHINE}/Makefile.inc.
331.106Scjs#    release: a synonym for `snapshot'
341.242Slukem#
351.199Stv
361.155Sthorpej# For NO_SENDMAIL, INSTPRIV, MKCRYPTO
371.242Slukem#
381.90Skim.include <bsd.own.mk>
391.187Sjmc
401.211Slukem# For KERNSRCDIR, KERNOBJDIR, ...
411.242Slukem#
421.211Slukem.include <bsd.kernobj.mk>
431.211Slukem
441.211Slukem
451.187Sjmc.MAKEOVERRIDES+=	USETOOLS
461.90Skim
471.23ScgdTZDIR=		/usr/share/zoneinfo
481.157SkleinkLOCALTIME?=	UTC
491.198SjmcPWD_MKDB?=	pwd_mkdb
501.233SlukemMAKESUMS=	CKSUM=${CKSUM:Q} sh ${NETBSDSRCDIR}/distrib/sets/makesums
511.19Sderaadt
521.161Shubertf# Flags for creating ISO CDROM image
531.161Shubertf# mkisofs is expected to be in $PATH, install via pkgsrc/sysutils/cdrecord
541.242Slukem# Note: At least mkisofs 2.0 should be used.
551.242Slukem#
561.161ShubertfMKISOFS?=	mkisofs
571.233SlukemDISTRIBREV!=	sh ${KERNSRCDIR}/conf/osrelease.sh -s
581.224Sbjh21# ISO 9660 volume ID.  Note that this can only contain [A-Z0-9_].
591.224Sbjh21ISO_VOLID!=	echo NETBSD_${MACHINE}_${DISTRIBREV} | tr a-z A-Z
601.161ShubertfMKISOFS_FLAGS+= -J -l \
611.161Shubertf		-r -T -v \
621.224Sbjh21		-V ${ISO_VOLID} \
631.161Shubertf		-P "The NetBSD Project" \
641.241Slukem		-m "${RELEASEDIR}/${MACHINE}/installation/cdrom"
651.1Scgd
661.80Sjonathan# MD Makefile.inc may append MD targets to BIN[123].  Make sure all
671.80Sjonathan# are empty, to preserve the old semantics of setting them below with "=".
681.242Slukem#
691.200SlukemBIN1=
701.80SjonathanBIN2=
711.80SjonathanBIN3=
721.80Sjonathan
731.241Slukem# Directories to build in ${RELEASEDIR}/${MACHINE}.
741.241Slukem# MD Makefile.inc files can add to this.
751.117Ssimonb# NOTE: Parent directories must be listed before subdirectories.
761.242Slukem#
771.217SlukemINSTALLATION_DIRS=	binary binary/sets binary/kernel installation
781.117Ssimonb
791.71Scjs.if exists(etc.${MACHINE}/Makefile.inc)
801.71Scjs.include "etc.${MACHINE}/Makefile.inc"
811.71Scjs.endif
821.32Sjtc
831.21Scgd# -rw-r--r--
841.21ScgdBINOWN= root
851.21ScgdBINGRP= wheel
861.227SperryUTMPGRP= utmp
871.184SlukemBIN1+=	bootptab changelist csh.cshrc csh.login csh.logout daily \
881.223Sfredette	daily.conf dm.conf floppytab ftpchroot ftpusers \
891.131Sveego	gettytab group hosts hosts.lpd inetd.conf lkm.conf \
901.131Sveego	mailer.conf man.conf monthly monthly.conf mrouted.conf \
911.151Sfvdl	netconfig networks newsyslog.conf nsswitch.conf ntp.conf \
921.213Sperry	passwd.conf phones printcap profile protocols rbootd.conf rc rc.conf \
931.159Slukem	rc.lkm rc.local rc.subr rc.shutdown remote rpc \
941.142Stsarna	security security.conf services shells sysctl.conf syslog.conf \
951.142Stsarna	weekly weekly.conf wscons.conf \
961.236Sjdolecek	etc.${MACHINE}/ttys
971.236Sjdolecek
981.242Slukem# Use machine-specific disktab if it exists, or the MI one otherwise
991.236Sjdolecek.if exists(etc.${MACHINE}/disktab)
1001.236SjdolecekBIN1+=	etc.${MACHINE}/disktab
1011.236Sjdolecek.else
1021.236SjdolecekBIN1+=	disktab
1031.236Sjdolecek.endif
1041.105Smycroft
1051.234Sjdolecek.if exists(etc.${MACHINE}/ld.so.conf)
1061.234SjdolecekBIN1+=	etc.${MACHINE}/ld.so.conf
1071.152Sperry.endif
1081.152Sperry
1091.234Sjdolecek.if exists(etc.${MACHINE}/ttyaction)
1101.234SjdolecekBIN1+=	etc.${MACHINE}/ttyaction
1111.105Smycroft.endif
1121.1Scgd
1131.46Sderaadt# -rw-rw-r--
1141.80SjonathanBIN2+=	motd
1151.1Scgd
1161.77Smycroft# -rw-------
1171.80SjonathanBIN3+=	hosts.equiv
1181.77Smycroft
1191.230SperryETC_PKG=-T etc_pkg
1201.230SperryBASE_PKG=-T base_pkg
1211.242SlukemETC_INSTALL_FILE=cd ${.CURDIR} && ${INSTALL_FILE} ${ETC_PKG}
1221.242SlukemETC_INSTALL_LINK=cd ${.CURDIR} && ${INSTALL_LINK} ${ETC_PKG}
1231.242SlukemETC_INSTALL_SYMLINK=cd ${.CURDIR} && ${INSTALL_SYMLINK} ${ETC_PKG}
1241.230Sperry
1251.144SthorpejNAMEDB=	127 root.cache named.conf localhost loopback.v6
1261.1Scgd
1271.220Sitojun.if make(install-etc-files)						# {
1281.221Sitojun.include <bsd.endian.mk>
1291.191Stv.if ${TARGET_ENDIANNESS} == "1234"
1301.221SitojunTARGET_ENDIANNESS=	-L
1311.191Stv.elif ${TARGET_ENDIANNESS} == "4321"
1321.221SitojunTARGET_ENDIANNESS=	-B
1331.170Sjdolecek.else
1341.170SjdolecekTARGET_ENDIANNESS=
1351.191Stv.endif
1361.220Sitojun.endif	# install-etc-files						# }
1371.149Ssjg
1381.149Ssjg
1391.242Slukem# distribution --
1401.242Slukem#	Build a distribution
1411.242Slukem#
1421.204Slukemdistribution: check_DESTDIR .WAIT distrib-dirs
1431.182Schs.if !defined(DISTRIBUTION_DONE)
1441.87Sperry.if !defined(INSTALL_DONE)
1451.233Slukem	(cd ${NETBSDSRCDIR}; ${MAKE} _DISTRIB= includes)
1461.233Slukem	(cd ${NETBSDSRCDIR}; ${MAKE} _DISTRIB= install)
1471.200Slukem.endif	# !INSTALL_DONE
1481.243Slukem	(cd ${.CURDIR}; ${MAKE} install-etc-files)
1491.200Slukem.endif	# !DISTRIBUTION_DONE
1501.193Sthorpej
1511.242Slukem
1521.242Slukem# install-etc-files --
1531.242Slukem#	Install etc (config) files; not performed by "make build"
1541.242Slukem#
1551.204Slukeminstall-etc-files: check_DESTDIR
1561.230Sperry	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
1571.230Sperry	    ${BIN1} ${DESTDIR}/etc
1581.230Sperry	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 664 \
1591.230Sperry	    ${BIN2} ${DESTDIR}/etc
1601.230Sperry	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 600 \
1611.230Sperry	    ${BIN3} ${DESTDIR}/etc
1621.230Sperry	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
1631.230Sperry	    aliases ${DESTDIR}/etc/mail
1641.230Sperry	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
1651.230Sperry	    /dev/null ${DESTDIR}/etc/mail/local-host-names
1661.230Sperry	${ETC_INSTALL_FILE} -o root -g wheel -m 600 \
1671.230Sperry	    crontab ${DESTDIR}/var/cron/tabs/root
1681.230Sperry	${ETC_INSTALL_FILE} -o root -g wheel -m 600 \
1691.230Sperry	    master.passwd ${DESTDIR}/etc
1701.198Sjmc	${PWD_MKDB} -p ${TARGET_ENDIANNESS} -d ${DESTDIR}/ \
1711.230Sperry	    ${DESTDIR}/etc/master.passwd
1721.194Sperry.if defined(UNPRIVED)
1731.222Slukem	( \
1741.239Slukem	    echo "./etc/passwd type=file mode=0644 uname=root gname=wheel tags=etc_pkg"; \
1751.239Slukem	    echo "./etc/pwd.db type=file mode=0644 uname=root gname=wheel tags=etc_pkg"; \
1761.239Slukem	    echo "./etc/spwd.db type=file mode=0600 uname=root gname=wheel tags=etc_pkg"; \
1771.239Slukem	) | ${METALOG.add}
1781.200Slukem.endif	# UNPRIVED
1791.230Sperry	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 555 \
1801.230Sperry	    MAKEDEV.local etc.${MACHINE}/MAKEDEV ${DESTDIR}/dev
1811.230Sperry	${ETC_INSTALL_FILE} -o root -g wheel -m 600 \
1821.230Sperry	    minfree ${DESTDIR}/var/crash
1831.242Slukem.for file in cshrc login profile shrc
1841.242Slukem	${ETC_INSTALL_FILE} -o root -g wheel -m 644 \
1851.242Slukem	    root/dot.${file} ${DESTDIR}/root/.${file}
1861.242Slukem.endfor
1871.242Slukem	${ETC_INSTALL_FILE} -o root -g wheel -m 600 \
1881.242Slukem	    root/dot.klogin ${DESTDIR}/root/.klogin
1891.242Slukem	rm -f ${DESTDIR}/.cshrc ${DESTDIR}/.profile
1901.242Slukem	${ETC_INSTALL_LINK} ${DESTDIR}/root/.cshrc ${DESTDIR}/.cshrc
1911.242Slukem	${ETC_INSTALL_LINK} ${DESTDIR}/root/.profile ${DESTDIR}/.profile
1921.242Slukem	(cd ${.CURDIR}/defaults; ${MAKE} install)
1931.242Slukem	(cd ${.CURDIR}/mtree; ${MAKE} install)
1941.242Slukem.for file in ${NAMEDB}
1951.242Slukem	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
1961.242Slukem	    namedb/${file} ${DESTDIR}/etc/namedb
1971.242Slukem.endfor
1981.242Slukem	(cd ${.CURDIR}/rc.d; ${MAKE} install)
1991.230Sperry	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
2001.230Sperry	    postinstall ${DESTDIR}/etc
2011.230Sperry	${ETC_INSTALL_SYMLINK} -o root -g wheel -m 755 \
2021.230Sperry	    ${TZDIR}/${LOCALTIME} ${DESTDIR}/etc/localtime
2031.230Sperry	${ETC_INSTALL_SYMLINK} -o root -g wheel -m 755 \
2041.230Sperry	    /usr/sbin/rmt ${DESTDIR}/etc/rmt
2051.230Sperry	${ETC_INSTALL_FILE} -o ${BINOWN} -g operator -m 664 \
2061.230Sperry	    /dev/null ${DESTDIR}/etc/dumpdates
2071.230Sperry	${ETC_INSTALL_FILE} -o ${BINOWN} -g operator -m 600 \
2081.230Sperry	    /dev/null ${DESTDIR}/etc/skeykeys
2091.230Sperry	${ETC_INSTALL_FILE} -o root -g wheel -m 600 \
2101.230Sperry	    /dev/null ${DESTDIR}/var/at/at.deny
2111.230Sperry	${ETC_INSTALL_FILE} -o root -g wheel -m 600 \
2121.230Sperry	    /dev/null ${DESTDIR}/var/cron/log
2131.230Sperry	${ETC_INSTALL_FILE} -o nobody -g ${BINGRP} -m 664 \
2141.230Sperry	    /dev/null ${DESTDIR}/var/db/locate.database
2151.230Sperry	${ETC_INSTALL_FILE} -o uucp -g dialer -m 640 \
2161.230Sperry	    /dev/null ${DESTDIR}/var/log/aculog
2171.230Sperry	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 600 \
2181.230Sperry	    /dev/null ${DESTDIR}/var/log/authlog
2191.230Sperry	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 664 \
2201.230Sperry	    /dev/null ${DESTDIR}/var/log/lastlog
2211.230Sperry	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 640 \
2221.230Sperry	    /dev/null ${DESTDIR}/var/log/lpd-errs
2231.230Sperry	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 600 \
2241.230Sperry	    /dev/null ${DESTDIR}/var/log/maillog
2251.230Sperry	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
2261.230Sperry	    /dev/null ${DESTDIR}/var/log/messages
2271.230Sperry	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 600 \
2281.230Sperry	    /dev/null ${DESTDIR}/var/log/secure
2291.230Sperry	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
2301.230Sperry	    /dev/null ${DESTDIR}/var/log/sendmail.st
2311.230Sperry	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
2321.230Sperry	    /dev/null ${DESTDIR}/var/log/wtmp
2331.230Sperry	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
2341.230Sperry	    /dev/null ${DESTDIR}/var/log/wtmpx
2351.230Sperry	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 600 \
2361.230Sperry	    /dev/null ${DESTDIR}/var/log/xferlog
2371.230Sperry	${ETC_INSTALL_FILE} -o daemon -g staff -m 664 \
2381.230Sperry	    /dev/null ${DESTDIR}/var/msgs/bounds
2391.230Sperry	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${UTMPGRP} -m 664 \
2401.230Sperry	    /dev/null ${DESTDIR}/var/run/utmp
2411.230Sperry	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${UTMPGRP} -m 664 \
2421.230Sperry	    /dev/null ${DESTDIR}/var/run/utmpx
2431.230Sperry	${ETC_INSTALL_FILE} -o games -g games -m 664 \
2441.230Sperry	    /dev/null ${DESTDIR}/var/games/atc_scores
2451.230Sperry	${ETC_INSTALL_FILE} -o games -g games -m 664 \
2461.230Sperry	    /dev/null ${DESTDIR}/var/games/battlestar.log
2471.230Sperry	${ETC_INSTALL_FILE} -o games -g games -m 664 \
2481.230Sperry	    /dev/null ${DESTDIR}/var/games/cfscores
2491.230Sperry	${ETC_INSTALL_FILE} -o games -g games -m 664 \
2501.230Sperry	    /dev/null ${DESTDIR}/var/games/criblog
2511.231Sperry	${ETC_INSTALL_FILE} -o games -g games -m 660 \
2521.231Sperry	    /dev/null ${DESTDIR}/var/games/hackdir/perm
2531.231Sperry	${ETC_INSTALL_FILE} -o games -g games -m 660 \
2541.231Sperry	    /dev/null ${DESTDIR}/var/games/hackdir/record
2551.231Sperry	${ETC_INSTALL_FILE} -o games -g games -m 664 \
2561.231Sperry	    /dev/null ${DESTDIR}/var/games/larn/llog12.0
2571.231Sperry	${ETC_INSTALL_FILE} -o games -g games -m 664 \
2581.231Sperry	    /dev/null ${DESTDIR}/var/games/larn/lscore12.0
2591.231Sperry	${ETC_INSTALL_FILE} -o games -g games -m 664 \
2601.231Sperry	    /dev/null ${DESTDIR}/var/games/larn/playerids
2611.230Sperry	${ETC_INSTALL_FILE} -o games -g games -m 664 \
2621.230Sperry	    /dev/null ${DESTDIR}/var/games/robots_roll
2631.230Sperry	${ETC_INSTALL_FILE} -o games -g games -m 664 \
2641.230Sperry	    /dev/null ${DESTDIR}/var/games/rogue.scores
2651.230Sperry	${ETC_INSTALL_FILE} -o games -g games -m 664 \
2661.230Sperry	    /dev/null ${DESTDIR}/var/games/saillog
2671.230Sperry	${ETC_INSTALL_FILE} -o games -g games -m 664 \
2681.230Sperry	    /dev/null ${DESTDIR}/var/games/snakerawscores
2691.230Sperry	${ETC_INSTALL_FILE} -o games -g games -m 664 \
2701.230Sperry	    /dev/null ${DESTDIR}/var/games/snake.log
2711.230Sperry	${ETC_INSTALL_FILE} -o games -g games -m 664 \
2721.230Sperry	    /dev/null ${DESTDIR}/var/games/tetris.scores
2731.242Slukem	(cd ${.CURDIR}/skel; ${MAKE} distribution)
2741.233Slukem	(cd ${NETBSDSRCDIR}/usr.bin/mail; ${MAKE} distribution)
2751.233Slukem	(cd ${NETBSDSRCDIR}/gnu/usr.sbin/postfix/; ${MAKE} distribution)
2761.155Sthorpej.if (${MKCRYPTO} != "no")
2771.233Slukem	(cd ${NETBSDSRCDIR}/usr.bin/ssh; ${MAKE} distribution)
2781.155Sthorpej.endif
2791.244Smrg.if !defined(NO_SENDMAIL) || ${NO_SENDMAIL} == "no"
2801.233Slukem	(cd ${NETBSDSRCDIR}/gnu/usr.sbin/sendmail/cf/cf; ${MAKE} distribution)
2811.90Skim.endif
2821.1Scgd
2831.242Slukem
2841.242Slukem# distrib-dirs --
2851.242Slukem#	Populate $DESTDIR with directories needed by NetBSD
2861.242Slukem#
2871.204Slukemdistrib-dirs: check_DESTDIR
2881.230Sperry	${INSTALL_DIR} -o root -g wheel -m 755 ${BASE_PKG} ${DESTDIR}
2891.242Slukem	${MTREE} -def ${.CURDIR}/mtree/NetBSD.dist -N ${.CURDIR} \
2901.235Slukem	    -p ${DESTDIR}/ -U ${UNPRIVED:D-W}
2911.200Slukem
2921.242Slukem
2931.242Slukem# release, snapshot --
2941.242Slukem#	Build a full distribution including kernels & install media.
2951.242Slukem#
2961.204Slukemrelease snapshot: check_DESTDIR check_RELEASEDIR .WAIT \
2971.233Slukem		    distribution .WAIT \
2981.233Slukem		    snap_pre .WAIT snap_kern .WAIT \
2991.233Slukem		    snap_post .WAIT snap_md_post
3001.233Slukem	(cd ${NETBSDSRCDIR}/distrib/sets; ${MAKE} sets)
3011.241Slukem	${MAKESUMS} -t ${RELEASEDIR}/${MACHINE}/binary/kernel '*.gz'
3021.161Shubertf
3031.242Slukem
3041.242Slukem# iso-image --
3051.242Slukem#	Standalone target to create a CDROM image after the release
3061.242Slukem#	was composed.  Should be run after "make release" in src and xsrc.
3071.242Slukem#
3081.242Slukem#
3091.242SlukemCDROM.image=${RELEASEDIR}/${MACHINE}/installation/cdrom/netbsd-${MACHINE}.iso
3101.242SlukemCDROM.dir=	cdrom.dir
3111.242SlukemCDROM.pathlist=	cdrom.pathlist
3121.242Slukem
3131.204Slukemiso-image: check_DESTDIR check_RELEASEDIR .WAIT iso-image_md_post
3141.233Slukem#	empty target
3151.161Shubertf
3161.242Slukemiso-image_setup: check_RELEASEDIR
3171.242Slukem	rm -f ${CDROM.pathlist}
3181.242Slukem	echo "${MACHINE}=${RELEASEDIR}/${MACHINE}" >> ${CDROM.pathlist}
3191.242Slukem	mkdir -p ${CDROM.dir}
3201.242Slukem	mkdir -p ${RELEASEDIR}/${MACHINE}/installation/cdrom
3211.242Slukem
3221.242Slukem# iso-image_mi --
3231.242Slukem#	Create the image after the MD operations have completed.
3241.242Slukemiso-image_mi: check_DESTDIR check_RELEASEDIR .WAIT \
3251.242Slukem		iso-image_setup .WAIT iso-image_md_pre
3261.242Slukem	@if ! ${MKISOFS} --version; then \
3271.242Slukem		echo "install pkgsrc/sysutils/cdrecord and run 'make iso-image'." ; \
3281.242Slukem		false; \
3291.161Shubertf	fi
3301.242Slukem	${MKISOFS} ${MKISOFS_FLAGS} -graft-points -path-list ${CDROM.pathlist} \
3311.242Slukem	    -o ${CDROM.image} ${CDROM.dir}
3321.242Slukem	${MAKESUMS} -t ${RELEASEDIR}/${MACHINE}/installation/cdrom '*.iso'
3331.242Slukem
3341.242Slukem# iso-image_md_pre --
3351.242Slukem#	Setup ${CDROM.dir} to produce a bootable CD image.
3361.242Slukem#	Overridden by etc.$MACHINE/Makefile.inc
3371.242Slukem#
3381.204Slukemiso-image_md_pre: check_DESTDIR check_RELEASEDIR
3391.242Slukem#	(empty -- look in the machine-dependent Makefile.inc)
3401.161Shubertf
3411.242Slukem# iso-image_md_post --
3421.242Slukem#	Fixup the CD-image to be bootable.
3431.242Slukem#	Overridden by etc.$MACHINE/Makefile.inc
3441.242Slukem#
3451.204Slukemiso-image_md_post: check_DESTDIR check_RELEASEDIR .WAIT iso-image_mi
3461.242Slukem#	(empty -- look in the machine-dependent Makefile.inc)
3471.41Scgd
3481.242Slukem
3491.242Slukem# snap_pre --
3501.242Slukem#	Create ${RELEASEDIR} and necessary subdirectories.
3511.242Slukem#
3521.204Slukemsnap_pre: check_DESTDIR check_RELEASEDIR
3531.241Slukem	${INSTALL} -d -m 755 ${RELEASEDIR}
3541.240Slukem.ifndef UPDATE
3551.168Sjmc# Could be a mount point, ignore the errors
3561.241Slukem	-/bin/rm -rf ${RELEASEDIR}/${MACHINE}
3571.240Slukem.endif
3581.241Slukem	${INSTALL} -d -m 755 ${RELEASEDIR}/${MACHINE}
3591.117Ssimonb.for dir in ${INSTALLATION_DIRS}
3601.241Slukem	${INSTALL} -d -m 755 ${RELEASEDIR}/${MACHINE}/${dir}
3611.117Ssimonb.endfor
3621.96Scjs
3631.242Slukem# snap_post --
3641.242Slukem#	Build the install media and notes from distrib
3651.242Slukem#
3661.233Slukemsnap_post: check_DESTDIR check_RELEASEDIR
3671.233Slukem.ifndef UPDATE
3681.233Slukem	cd ${NETBSDSRCDIR}/distrib && ${MAKE} cleandir
3691.233Slukem.endif
3701.233Slukem	cd ${NETBSDSRCDIR}/distrib && ${MAKE} depend && ${MAKE} && \
3711.233Slukem	    ${MAKE} release
3721.233Slukem
3731.232Slukem# snap_kern --
3741.242Slukem#	This target builds the kernels specified by each port.
3751.242Slukem#	A port may specify the following kernels:
3761.196Sthorpej#
3771.196Sthorpej#	KERNEL_SETS		The list of kernels that will be
3781.196Sthorpej#				packaged into sets, named
3791.196Sthorpej#				kern-${kernel}.tgz.  These kernels
3801.203Schs#				are also placed in the binary/kernel
3811.196Sthorpej#				area of the release package as
3821.196Sthorpej#				netbsd-${kernel}.gz.
3831.196Sthorpej#
3841.196Sthorpej#	EXTRA_KERNELS		Additional kernels to place in the
3851.203Schs#				binary/kernel area of the release
3861.196Sthorpej#				package as netbsd-${kernel}.gz, but
3871.196Sthorpej#				which are not placed into sets. This
3881.196Sthorpej#				allows a port to provide e.g. a netbootable
3891.196Sthorpej#				installation kernel containing a ramdisk.
3901.196Sthorpej#
3911.196Sthorpej#	BUILD_KERNELS		Additional kernels to build which are
3921.196Sthorpej#				not placed into sets nor into the
3931.203Schs#				binary/kernel area of the release
3941.196Sthorpej#				package.  These are typically kernels
3951.196Sthorpej#				that are built for inclusion only in
3961.196Sthorpej#				installation disk/CD-ROM/tape images.
3971.116Sfair#
3981.242Slukem#	A port may also specify KERNEL_SUFFIXES, which is an optional list
3991.242Slukem#	of filename suffixes for kernels to include in the kernel sets and
4001.242Slukem#	in the binary/kernel area of the release package (e.g. "netbsd" vs.
4011.242Slukem#	"netbsd.ecoff" and "netbsd.srec").  It is not an error if kernels
4021.242Slukem#	with these suffixes do not exist in the kernel build directory.
4031.197Sthorpej#
4041.229Slukem#
4051.229Slukem# A list of all the kernels to build, which can be overridden from
4061.229Slukem# external sources (such as make(1)'s environment or command line)
4071.229Slukem#
4081.229SlukemALL_KERNELS?=	${KERNEL_SETS} ${EXTRA_KERNELS} ${BUILD_KERNELS}
4091.242Slukem
4101.116SfairGETKERNELAWK=	awk '/^config/ {print $$2; found=1} \
4111.116Sfair		END{ if (found == 0) print "netbsd"; }'
4121.242Slukem
4131.232Slukem.if !target(snap_kern)						# {
4141.232Slukem
4151.232Slukem# build_kernels --
4161.232Slukem#	Configure & compile kernels listed in ${ALL_KERNELS}
4171.232Slukem#
4181.201Slukem.if !defined(KERNELS_DONE)						# {
4191.232Slukem.for configfile in ${ALL_KERNELS}					# {
4201.232Slukem_KERNELS_TO_BUILD+=kern-${configfile}
4211.232Slukemkern-${configfile}:
4221.232Slukem	cd ${KERNCONFDIR} && ${CONFIG} -s ${KERNSRCDIR} \
4231.232Slukem	    -b ${KERNOBJDIR}/${configfile:C/.*\///} ${configfile}
4241.201Slukem.if !defined(UPDATE)
4251.200Slukem	cd ${KERNOBJDIR}/${configfile:C/.*\///} && ${MAKE} distclean
4261.96Scjs.endif
4271.218Ssommerfe	cd ${KERNOBJDIR}/${configfile:C/.*\///} && ${MAKE} depend && ${MAKE}
4281.232Slukem.endfor	# ALL_KERNELS							# }
4291.232Slukem.endif	# KERNELS_DONE							# }
4301.232Slukem
4311.232Slukembuild_kernels: ${_KERNELS_TO_BUILD}
4321.232Slukem
4331.232Slukem# build_kernelsets --
4341.241Slukem#	Create kernel sets from ${KERNEL_SETS} into
4351.241Slukem#	${RELEASEDIR}/${MACHINE}/binary/sets
4361.232Slukem#
4371.232Slukem.for configfile in ${KERNEL_SETS}					# {
4381.232Slukem_KERNELSETS_TO_BUILD+=kernset-${configfile}
4391.232Slukemkernset-${configfile}:
4401.197Sthorpej	kernlist=`${GETKERNELAWK} ${KERNCONFDIR}/${configfile}`; \
4411.197Sthorpej	kerndir=${KERNOBJDIR}/${configfile:C/.*\///}; \
4421.207Sbjh21	kernsuffixes="${KERNEL_SUFFIXES}"; \
4431.210Slukem	cd $${kerndir} && ( \
4441.214Slukem		echo "/set uname=${BINOWN} gname=${BINGRP}"; \
4451.214Slukem		echo ". type=dir optional"; \
4461.210Slukem		for kernel in $${kernlist}; do \
4471.214Slukem			echo "./$${kernel} type=file"; \
4481.207Sbjh21			for s in $${kernsuffixes}; do \
4491.197Sthorpej				if [ -f $${kernel}.$${s} ]; then \
4501.214Slukem					echo "./$${kernel}.$${s} type=file"; \
4511.197Sthorpej				fi; \
4521.197Sthorpej			done; \
4531.238Slukem		done ) | GZIP=-9 ${PAX} -O -zw \
4541.235Slukem		    -M -N ${NETBSDSRCDIR}/etc \
4551.241Slukem		    -f ${RELEASEDIR}/${MACHINE}/binary/sets/kern-${configfile}.tgz
4561.232Slukem.endfor	# KERNEL_SETS							# }
4571.232Slukem
4581.232Slukembuild_kernelsets: ${_KERNELSETS_TO_BUILD}
4591.232Slukem
4601.232Slukem# build_releasekernels --
4611.232Slukem#	Build kernel.gz from ${KERNEL_SETS} ${EXTRA_KERNELS} into
4621.241Slukem#	${RELEASEDIR}/${MACHINE}/binary/kernel
4631.232Slukem#
4641.232Slukem.for configfile in ${KERNEL_SETS} ${EXTRA_KERNELS}			# {
4651.232Slukem_RELEASEKERNELS_TO_BUILD+=releasekern-${configfile}
4661.232Slukemreleasekern-${configfile}:
4671.197Sthorpej	kernlist=`${GETKERNELAWK} ${KERNCONFDIR}/${configfile:C/.*\///}`; \
4681.197Sthorpej	kerndir=${KERNOBJDIR}/${configfile:C/.*\///}; \
4691.207Sbjh21	kernsuffixes="${KERNEL_SUFFIXES}"; \
4701.197Sthorpej	cd $${kerndir} &&	\
4711.197Sthorpej		gziplist=`for kernel in $${kernlist}; do \
4721.197Sthorpej			echo "$${kernel}"; \
4731.207Sbjh21			for s in $${kernsuffixes}; do \
4741.197Sthorpej				if [ -f $${kernel}.$${s} ]; then \
4751.197Sthorpej					echo "$${kernel}.$${s}"; \
4761.197Sthorpej				fi; \
4771.197Sthorpej			done; \
4781.197Sthorpej		done`; \
4791.197Sthorpej		for kernel in $${gziplist} ; do \
4801.114Sfair		gzip -c -9 < $${kernel} > \
4811.241Slukem		    ${RELEASEDIR}/${MACHINE}/binary/kernel/$${kernel}-${configfile:C/.*\///}.gz ; done
4821.232Slukem.endfor	# KERNEL_SETS EXTRA_KERNELS					# }
4831.232Slukem
4841.232Slukembuild_releasekernels: ${_RELEASEKERNELS_TO_BUILD}
4851.232Slukem
4861.232Slukem# snap_kern --
4871.232Slukem#	build the kernels, then the sets & release kernels
4881.242Slukem#
4891.232Slukemsnap_kern: check_DESTDIR check_RELEASEDIR .WAIT \
4901.232Slukem	    build_kernels .WAIT \
4911.232Slukem	    build_kernelsets build_releasekernels
4921.232Slukem
4931.232Slukem.endif # !target(snap_kern)					# }
4941.232Slukem
4951.108Sdrochner
4961.242Slukem# snap_md_post --
4971.242Slukem#	Machine dependent distribution media operations.
4981.242Slukem#	Overridden by etc.$MACHINE/Makefile.inc
4991.242Slukem#
5001.204Slukemsnap_md_post: check_DESTDIR check_RELEASEDIR
5011.242Slukem#	(empty -- look in the machine-dependent Makefile.inc)
5021.242Slukem
5031.242Slukem
5041.242Slukemclean:
5051.242Slukem	-rm -rf ${CDROM.dir} ${CDROM.pathlist}
5061.7Scgd
5071.1Scgd.include <bsd.prog.mk>
508