Makefile revision 1.231
11.231Sperry#	$NetBSD: Makefile,v 1.231 2002/10/23 20:35:45 perry 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.96Scjs#	into a release(7) format in RELEASEDIR. Any port-dependent
311.96Scjs#	stuff for this target is found in etc.${MACHINE}/Makefile.inc.
321.106Scjs#    release: a synonym for `snapshot'
331.96Scjs
341.199Stv# setting NOOBJ prevents "make obj" from doing anything;
351.199Stv# an objdir would break the installation stuff below
361.199StvNOOBJ=		# defined
371.199Stv
381.155Sthorpej# For NO_SENDMAIL, INSTPRIV, MKCRYPTO
391.90Skim.include <bsd.own.mk>
401.187Sjmc
411.211Slukem# For KERNSRCDIR, KERNOBJDIR, ...
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.206Sbjh21MAKESUMS=	CKSUM=${CKSUM:Q} sh ../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.161ShubertfMKISOFS?=	mkisofs
551.224Sbjh21DISTRIBREV!=	sh ${NETBSDSRCDIR}/sys/conf/osrelease.sh -s
561.224Sbjh21# ISO 9660 volume ID.  Note that this can only contain [A-Z0-9_].
571.224Sbjh21ISO_VOLID!=	echo NETBSD_${MACHINE}_${DISTRIBREV} | tr a-z A-Z
581.161ShubertfMKISOFS_FLAGS+= -J -l \
591.161Shubertf		-r -T -v \
601.224Sbjh21		-V ${ISO_VOLID} \
611.161Shubertf		-P "The NetBSD Project" \
621.164Shubertf		-m "${RELEASEDIR}/installation/cdrom"
631.1Scgd
641.80Sjonathan# MD Makefile.inc may append MD targets to BIN[123].  Make sure all
651.80Sjonathan# are empty, to preserve the old semantics of setting them below with "=".
661.200SlukemBIN1=
671.80SjonathanBIN2=
681.80SjonathanBIN3=
691.80Sjonathan
701.117Ssimonb# Directories to build in ${RELEASEDIR}.   MD Makefile.inc files can
711.117Ssimonb# add to this.
721.117Ssimonb# NOTE: Parent directories must be listed before subdirectories.
731.217SlukemINSTALLATION_DIRS=	binary binary/sets binary/kernel installation
741.117Ssimonb
751.71Scjs.if exists(etc.${MACHINE}/Makefile.inc)
761.71Scjs.include "etc.${MACHINE}/Makefile.inc"
771.71Scjs.endif
781.32Sjtc
791.21Scgd# -rw-r--r--
801.21ScgdBINOWN= root
811.21ScgdBINGRP= wheel
821.227SperryUTMPGRP= utmp
831.184SlukemBIN1+=	bootptab changelist csh.cshrc csh.login csh.logout daily \
841.223Sfredette	daily.conf dm.conf floppytab ftpchroot ftpusers \
851.131Sveego	gettytab group hosts hosts.lpd inetd.conf lkm.conf \
861.131Sveego	mailer.conf man.conf monthly monthly.conf mrouted.conf \
871.151Sfvdl	netconfig networks newsyslog.conf nsswitch.conf ntp.conf \
881.213Sperry	passwd.conf phones printcap profile protocols rbootd.conf rc rc.conf \
891.159Slukem	rc.lkm rc.local rc.subr rc.shutdown remote rpc \
901.142Stsarna	security security.conf services shells sysctl.conf syslog.conf \
911.142Stsarna	weekly weekly.conf wscons.conf \
921.109Sdrochner	etc.${MACHINE}/ttys etc.${MACHINE}/disktab
931.105Smycroft
941.121Sfvdl.if	(${MACHINE_ARCH} == "m68k") || \
951.105Smycroft	(${MACHINE_ARCH} == "ns32k") || \
961.208Swiz	(${MACHINE_ARCH} == "vax")
971.129SchristosBIN1+=	ld.so.conf
981.129Schristos.elif exists(etc.${MACHINE_ARCH}/ld.so.conf)
991.132SjlamBIN1+=	etc.${MACHINE_ARCH}/ld.so.conf
1001.152Sperry.endif
1011.152Sperry
1021.152Sperry.if exists(etc.${MACHINE_ARCH}/ttyaction)
1031.152SperryBIN1+=	etc.${MACHINE_ARCH}/ttyaction
1041.105Smycroft.endif
1051.1Scgd
1061.46Sderaadt# -rw-rw-r--
1071.80SjonathanBIN2+=	motd
1081.1Scgd
1091.77Smycroft# -rw-------
1101.80SjonathanBIN3+=	hosts.equiv
1111.77Smycroft
1121.230SperryETC_PKG=-T etc_pkg
1131.230SperryBASE_PKG=-T base_pkg
1141.230SperryETC_INSTALL_FILE=${INSTALL_FILE} ${ETC_PKG}
1151.230SperryETC_INSTALL_LINK=${INSTALL_LINK} ${ETC_PKG}
1161.230SperryETC_INSTALL_SYMLINK=${INSTALL_SYMLINK} ${ETC_PKG}
1171.230Sperry
1181.144SthorpejNAMEDB=	127 root.cache named.conf localhost loopback.v6
1191.1Scgd
1201.220Sitojun.if make(install-etc-files)						# {
1211.221Sitojun.include <bsd.endian.mk>
1221.191Stv.if ${TARGET_ENDIANNESS} == "1234"
1231.221SitojunTARGET_ENDIANNESS=	-L
1241.191Stv.elif ${TARGET_ENDIANNESS} == "4321"
1251.221SitojunTARGET_ENDIANNESS=	-B
1261.170Sjdolecek.else
1271.170SjdolecekTARGET_ENDIANNESS=
1281.191Stv.endif
1291.220Sitojun.endif	# install-etc-files						# }
1301.149Ssjg
1311.149Ssjgobj:
1321.149Ssjg	mkdir -p ${KERNOBJDIR}
1331.149Ssjg
1341.204Slukemdistribution: check_DESTDIR .WAIT distrib-dirs
1351.182Schs.if !defined(DISTRIBUTION_DONE)
1361.87Sperry.if !defined(INSTALL_DONE)
1371.107Sscottr	(cd ..; ${MAKE} _DISTRIB= includes)
1381.107Sscottr	(cd ..; ${MAKE} _DISTRIB= install)
1391.200Slukem.endif	# !INSTALL_DONE
1401.193Sthorpej	${MAKE} install-etc-files
1411.200Slukem.endif	# !DISTRIBUTION_DONE
1421.193Sthorpej
1431.204Slukeminstall-etc-files: check_DESTDIR
1441.230Sperry	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
1451.230Sperry	    ${BIN1} ${DESTDIR}/etc
1461.230Sperry	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 664 \
1471.230Sperry	    ${BIN2} ${DESTDIR}/etc
1481.230Sperry	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 600 \
1491.230Sperry	    ${BIN3} ${DESTDIR}/etc
1501.230Sperry	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
1511.230Sperry	    aliases ${DESTDIR}/etc/mail
1521.230Sperry	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
1531.230Sperry	    /dev/null ${DESTDIR}/etc/mail/local-host-names
1541.230Sperry	${ETC_INSTALL_FILE} -o root -g wheel -m 600 \
1551.230Sperry	    crontab ${DESTDIR}/var/cron/tabs/root
1561.230Sperry	${ETC_INSTALL_FILE} -o root -g wheel -m 600 \
1571.230Sperry	    master.passwd ${DESTDIR}/etc
1581.198Sjmc	${PWD_MKDB} -p ${TARGET_ENDIANNESS} -d ${DESTDIR}/ \
1591.230Sperry	    ${DESTDIR}/etc/master.passwd
1601.194Sperry.if defined(UNPRIVED)
1611.222Slukem	( \
1621.230Sperry	    echo "/etc/passwd type=file mode=0644 uname=root gname=wheel tags=etc_pkg"; \
1631.230Sperry	    echo "/etc/pwd.db type=file mode=0644 uname=root gname=wheel tags=etc_pkg"; \
1641.230Sperry	    echo "/etc/spwd.db type=file mode=0600 uname=root gname=wheel tags=etc_pkg"; \
1651.222Slukem	) | \
1661.222Slukem	    sed -e "s|^/|./${DESTDIR}/|g" -e "s|//|/|g" | ${CAT} -l >>${METALOG}
1671.200Slukem.endif	# UNPRIVED
1681.230Sperry	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 555 \
1691.230Sperry	    MAKEDEV.local etc.${MACHINE}/MAKEDEV ${DESTDIR}/dev
1701.230Sperry	${ETC_INSTALL_FILE} -o root -g wheel -m 600 \
1711.230Sperry	    minfree ${DESTDIR}/var/crash
1721.1Scgd	(cd root; \
1731.230Sperry		${ETC_INSTALL_FILE} -o root -g wheel -m 644 \
1741.230Sperry		    dot.cshrc ${DESTDIR}/root/.cshrc; \
1751.230Sperry		${ETC_INSTALL_FILE} -o root -g wheel -m 600 \
1761.230Sperry		    dot.klogin ${DESTDIR}/root/.klogin; \
1771.230Sperry		${ETC_INSTALL_FILE} -o root -g wheel -m 644 \
1781.230Sperry		    dot.login ${DESTDIR}/root/.login; \
1791.230Sperry		${ETC_INSTALL_FILE} -o root -g wheel -m 644 \
1801.230Sperry		    dot.profile ${DESTDIR}/root/.profile; \
1811.230Sperry		${ETC_INSTALL_FILE} -o root -g wheel -m 644 \
1821.230Sperry		    dot.shrc ${DESTDIR}/root/.shrc; \
1831.189Sperry		rm -f ${DESTDIR}/.cshrc ${DESTDIR}/.profile; \
1841.230Sperry		${ETC_INSTALL_LINK} ${DESTDIR}/root/.cshrc ${DESTDIR}/.cshrc; \
1851.230Sperry		${ETC_INSTALL_LINK} ${DESTDIR}/root/.profile ${DESTDIR}/.profile)
1861.162Slukem	(cd defaults; ${MAKE} install)
1871.83Smrg	(cd mtree; ${MAKE} install)
1881.63Smikel	(cd namedb; \
1891.230Sperry		${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
1901.124Ssimonb		    ${NAMEDB} ${DESTDIR}/etc/namedb)
1911.140Slukem	(cd rc.d; ${MAKE} install)
1921.230Sperry	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
1931.230Sperry	    postinstall ${DESTDIR}/etc
1941.230Sperry	${ETC_INSTALL_SYMLINK} -o root -g wheel -m 755 \
1951.230Sperry	    ${TZDIR}/${LOCALTIME} ${DESTDIR}/etc/localtime
1961.230Sperry	${ETC_INSTALL_SYMLINK} -o root -g wheel -m 755 \
1971.230Sperry	    /usr/sbin/rmt ${DESTDIR}/etc/rmt
1981.230Sperry	${ETC_INSTALL_FILE} -o ${BINOWN} -g operator -m 664 \
1991.230Sperry	    /dev/null ${DESTDIR}/etc/dumpdates
2001.230Sperry	${ETC_INSTALL_FILE} -o ${BINOWN} -g operator -m 600 \
2011.230Sperry	    /dev/null ${DESTDIR}/etc/skeykeys
2021.230Sperry	${ETC_INSTALL_FILE} -o root -g wheel -m 600 \
2031.230Sperry	    /dev/null ${DESTDIR}/var/at/at.deny
2041.230Sperry	${ETC_INSTALL_FILE} -o root -g wheel -m 600 \
2051.230Sperry	    /dev/null ${DESTDIR}/var/cron/log
2061.230Sperry	${ETC_INSTALL_FILE} -o nobody -g ${BINGRP} -m 664 \
2071.230Sperry	    /dev/null ${DESTDIR}/var/db/locate.database
2081.230Sperry	${ETC_INSTALL_FILE} -o uucp -g dialer -m 640 \
2091.230Sperry	    /dev/null ${DESTDIR}/var/log/aculog
2101.230Sperry	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 600 \
2111.230Sperry	    /dev/null ${DESTDIR}/var/log/authlog
2121.230Sperry	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 664 \
2131.230Sperry	    /dev/null ${DESTDIR}/var/log/lastlog
2141.230Sperry	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 640 \
2151.230Sperry	    /dev/null ${DESTDIR}/var/log/lpd-errs
2161.230Sperry	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 600 \
2171.230Sperry	    /dev/null ${DESTDIR}/var/log/maillog
2181.230Sperry	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
2191.230Sperry	    /dev/null ${DESTDIR}/var/log/messages
2201.230Sperry	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 600 \
2211.230Sperry	    /dev/null ${DESTDIR}/var/log/secure
2221.230Sperry	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
2231.230Sperry	    /dev/null ${DESTDIR}/var/log/sendmail.st
2241.230Sperry	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
2251.230Sperry	    /dev/null ${DESTDIR}/var/log/wtmp
2261.230Sperry	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
2271.230Sperry	    /dev/null ${DESTDIR}/var/log/wtmpx
2281.230Sperry	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 600 \
2291.230Sperry	    /dev/null ${DESTDIR}/var/log/xferlog
2301.230Sperry	${ETC_INSTALL_FILE} -o daemon -g staff -m 664 \
2311.230Sperry	    /dev/null ${DESTDIR}/var/msgs/bounds
2321.230Sperry	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${UTMPGRP} -m 664 \
2331.230Sperry	    /dev/null ${DESTDIR}/var/run/utmp
2341.230Sperry	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${UTMPGRP} -m 664 \
2351.230Sperry	    /dev/null ${DESTDIR}/var/run/utmpx
2361.230Sperry	${ETC_INSTALL_FILE} -o games -g games -m 664 \
2371.230Sperry	    /dev/null ${DESTDIR}/var/games/atc_scores
2381.230Sperry	${ETC_INSTALL_FILE} -o games -g games -m 664 \
2391.230Sperry	    /dev/null ${DESTDIR}/var/games/battlestar.log
2401.230Sperry	${ETC_INSTALL_FILE} -o games -g games -m 664 \
2411.230Sperry	    /dev/null ${DESTDIR}/var/games/cfscores
2421.230Sperry	${ETC_INSTALL_FILE} -o games -g games -m 664 \
2431.230Sperry	    /dev/null ${DESTDIR}/var/games/criblog
2441.231Sperry	${ETC_INSTALL_FILE} -o games -g games -m 660 \
2451.231Sperry	    /dev/null ${DESTDIR}/var/games/hackdir/perm
2461.231Sperry	${ETC_INSTALL_FILE} -o games -g games -m 660 \
2471.231Sperry	    /dev/null ${DESTDIR}/var/games/hackdir/record
2481.231Sperry	${ETC_INSTALL_FILE} -o games -g games -m 664 \
2491.231Sperry	    /dev/null ${DESTDIR}/var/games/larn/llog12.0
2501.231Sperry	${ETC_INSTALL_FILE} -o games -g games -m 664 \
2511.231Sperry	    /dev/null ${DESTDIR}/var/games/larn/lscore12.0
2521.231Sperry	${ETC_INSTALL_FILE} -o games -g games -m 664 \
2531.231Sperry	    /dev/null ${DESTDIR}/var/games/larn/playerids
2541.230Sperry	${ETC_INSTALL_FILE} -o games -g games -m 664 \
2551.230Sperry	    /dev/null ${DESTDIR}/var/games/robots_roll
2561.230Sperry	${ETC_INSTALL_FILE} -o games -g games -m 664 \
2571.230Sperry	    /dev/null ${DESTDIR}/var/games/rogue.scores
2581.230Sperry	${ETC_INSTALL_FILE} -o games -g games -m 664 \
2591.230Sperry	    /dev/null ${DESTDIR}/var/games/saillog
2601.230Sperry	${ETC_INSTALL_FILE} -o games -g games -m 664 \
2611.230Sperry	    /dev/null ${DESTDIR}/var/games/snakerawscores
2621.230Sperry	${ETC_INSTALL_FILE} -o games -g games -m 664 \
2631.230Sperry	    /dev/null ${DESTDIR}/var/games/snake.log
2641.230Sperry	${ETC_INSTALL_FILE} -o games -g games -m 664 \
2651.230Sperry	    /dev/null ${DESTDIR}/var/games/tetris.scores
2661.165Ssimonb	(cd skel; ${MAKE} distribution)
2671.62Sperry	(cd ../usr.bin/mail; ${MAKE} distribution)
2681.143Sperry	(cd ../gnu/usr.sbin/postfix/; ${MAKE} distribution)
2691.155Sthorpej.if (${MKCRYPTO} != "no")
2701.155Sthorpej	(cd ../usr.bin/ssh; ${MAKE} distribution)
2711.155Sthorpej.endif
2721.200Slukem.if !defined(NO_SENDMAIL)
2731.133Stron	(cd ../gnu/usr.sbin/sendmail/cf/cf; ${MAKE} distribution)
2741.90Skim.endif
2751.1Scgd
2761.204Slukemdistrib-dirs: check_DESTDIR
2771.230Sperry	${INSTALL_DIR} -o root -g wheel -m 755 ${BASE_PKG} ${DESTDIR}
2781.192Sperry	${MTREE} -def mtree/NetBSD.dist -p ${DESTDIR}/ -U ${UNPRIVED:D-W}
2791.189Sperry	rm -f ${DESTDIR}/sys
2801.230Sperry	${INSTALL_SYMLINK} -o root -g wheel -m 755 ${BASE_PKG} \
2811.230Sperry	    usr/src/sys ${DESTDIR}/sys
2821.200Slukem
2831.204Slukemrelease snapshot: check_DESTDIR check_RELEASEDIR .WAIT \
2841.218Ssommerfe    distribution .WAIT snap_pre snap_md_pre .WAIT snap_kern .WAIT snap_md_post
2851.141Sthorpej	(cd ../distrib/sets; ${MAKE} sets)
2861.206Sbjh21	${MAKESUMS} -t ${RELEASEDIR}/binary/kernel '*.gz'
2871.161Shubertf
2881.161Shubertf# Standalone target to create a CDROM image after the release
2891.161Shubertf# was composed. Should be run after "make build" in both src and xsrc
2901.204Slukemiso-image: check_DESTDIR check_RELEASEDIR .WAIT iso-image_md_post
2911.161Shubertf
2921.204Slukemiso-image_mi: check_DESTDIR check_RELEASEDIR .WAIT iso-image_md_pre
2931.161Shubertf	@if ${MKISOFS} --version; then \
2941.161Shubertf		mkdir -p ${RELEASEDIR}/installation/cdrom ; \
2951.161Shubertf		${MKISOFS} ${MKISOFS_FLAGS} \
2961.230Sperry		    -o ${RELEASEDIR}/installation/cdrom/netbsd-${MACHINE}.iso \
2971.230Sperry		    ${RELEASEDIR} ; \
2981.206Sbjh21		${MAKESUMS} -t ${RELEASEDIR}/installation/cdrom '*.iso' ; \
2991.161Shubertf	else \
3001.161Shubertf		echo "install pkgsrc/sysutils/cdrecord and type 'make iso-image'." ; \
3011.161Shubertf	fi
3021.161Shubertf
3031.161Shubertf# Setup the $RELEASEDIR to produce a bootable CD image:
3041.204Slukemiso-image_md_pre: check_DESTDIR check_RELEASEDIR
3051.161Shubertf# nothing here -- look in the machine-dependent Makefile.inc
3061.161Shubertf
3071.161Shubertf# Fixup the  CD-image to be bootable
3081.204Slukemiso-image_md_post: check_DESTDIR check_RELEASEDIR .WAIT iso-image_mi
3091.161Shubertf# nothing here -- look in the machine-dependent Makefile.inc
3101.41Scgd
3111.204Slukemsnap_pre: check_DESTDIR check_RELEASEDIR
3121.168Sjmc# Could be a mount point, ignore the errors
3131.167Sjmc	-/bin/rm -rf ${RELEASEDIR}
3141.202Slukem	${INSTALL} -d -m 755 ${RELEASEDIR}
3151.117Ssimonb.for dir in ${INSTALLATION_DIRS}
3161.202Slukem	${INSTALL} -d -m 755 ${RELEASEDIR}/${dir}
3171.117Ssimonb.endfor
3181.96Scjs
3191.196Sthorpej# This target builds the kernels specified by each port.  A port may
3201.196Sthorpej# specify the following kernels:
3211.196Sthorpej#
3221.196Sthorpej#	KERNEL_SETS		The list of kernels that will be
3231.196Sthorpej#				packaged into sets, named
3241.196Sthorpej#				kern-${kernel}.tgz.  These kernels
3251.203Schs#				are also placed in the binary/kernel
3261.196Sthorpej#				area of the release package as
3271.196Sthorpej#				netbsd-${kernel}.gz.
3281.196Sthorpej#
3291.196Sthorpej#	EXTRA_KERNELS		Additional kernels to place in the
3301.203Schs#				binary/kernel area of the release
3311.196Sthorpej#				package as netbsd-${kernel}.gz, but
3321.196Sthorpej#				which are not placed into sets. This
3331.196Sthorpej#				allows a port to provide e.g. a netbootable
3341.196Sthorpej#				installation kernel containing a ramdisk.
3351.196Sthorpej#
3361.196Sthorpej#	BUILD_KERNELS		Additional kernels to build which are
3371.196Sthorpej#				not placed into sets nor into the
3381.203Schs#				binary/kernel area of the release
3391.196Sthorpej#				package.  These are typically kernels
3401.196Sthorpej#				that are built for inclusion only in
3411.196Sthorpej#				installation disk/CD-ROM/tape images.
3421.116Sfair#
3431.197Sthorpej# A port may also specify KERNEL_SUFFIXES, which is an optional list
3441.197Sthorpej# of filename suffixes for kernels to include in the kernel sets and
3451.203Schs# in the binary/kernel area of the release package (e.g. "netbsd" vs.
3461.197Sthorpej# "netbsd.ecoff" and "netbsd.srec").  It is not an error if kernels
3471.197Sthorpej# with these suffixes do not exist in the kernel build directory.
3481.197Sthorpej#
3491.229Slukem#
3501.229Slukem# A list of all the kernels to build, which can be overridden from
3511.229Slukem# external sources (such as make(1)'s environment or command line)
3521.229Slukem#
3531.229SlukemALL_KERNELS?=	${KERNEL_SETS} ${EXTRA_KERNELS} ${BUILD_KERNELS}
3541.229Slukem#
3551.116SfairGETKERNELAWK=	awk '/^config/ {print $$2; found=1} \
3561.116Sfair		END{ if (found == 0) print "netbsd"; }'
3571.96Scjs#
3581.118Sgwr.if !target(snap_kern)
3591.204Slukemsnap_kern: check_DESTDIR check_RELEASEDIR
3601.201Slukem.if !defined(KERNELS_DONE)						# {
3611.229Slukem.for configfile in ${ALL_KERNELS}
3621.125Ssommerfe	cd ${KERNCONFDIR} && ${CONFIG} \
3631.179Smrg		-b ${KERNOBJDIR}/${configfile:C/.*\///} -s ${KERNSRCDIR} ${configfile}
3641.201Slukem.if !defined(UPDATE)
3651.200Slukem	cd ${KERNOBJDIR}/${configfile:C/.*\///} && ${MAKE} distclean
3661.96Scjs.endif
3671.218Ssommerfe	cd ${KERNOBJDIR}/${configfile:C/.*\///} && ${MAKE} depend && ${MAKE}
3681.196Sthorpej.endfor # build kernels
3691.203Schs.endif # KERNELS_DONE							# }
3701.196Sthorpej.for configfile in ${KERNEL_SETS}
3711.197Sthorpej	kernlist=`${GETKERNELAWK} ${KERNCONFDIR}/${configfile}`; \
3721.197Sthorpej	kerndir=${KERNOBJDIR}/${configfile:C/.*\///}; \
3731.207Sbjh21	kernsuffixes="${KERNEL_SUFFIXES}"; \
3741.210Slukem	cd $${kerndir} && ( \
3751.214Slukem		echo "/set uname=${BINOWN} gname=${BINGRP}"; \
3761.214Slukem		echo ". type=dir optional"; \
3771.210Slukem		for kernel in $${kernlist}; do \
3781.214Slukem			echo "./$${kernel} type=file"; \
3791.207Sbjh21			for s in $${kernsuffixes}; do \
3801.197Sthorpej				if [ -f $${kernel}.$${s} ]; then \
3811.214Slukem					echo "./$${kernel}.$${s} type=file"; \
3821.197Sthorpej				fi; \
3831.197Sthorpej			done; \
3841.216Slukem		done ) | GZIP=-9 ${PAX} -zw \
3851.216Slukem		    -M ${UNPRIVED:D-N${NETBSDSRCDIR}/etc} \
3861.210Slukem		    -f ${RELEASEDIR}/binary/sets/kern-${configfile}.tgz
3871.196Sthorpej.endfor # make kernel sets
3881.196Sthorpej.for configfile in ${KERNEL_SETS} ${EXTRA_KERNELS}
3891.197Sthorpej	kernlist=`${GETKERNELAWK} ${KERNCONFDIR}/${configfile:C/.*\///}`; \
3901.197Sthorpej	kerndir=${KERNOBJDIR}/${configfile:C/.*\///}; \
3911.207Sbjh21	kernsuffixes="${KERNEL_SUFFIXES}"; \
3921.197Sthorpej	cd $${kerndir} &&	\
3931.197Sthorpej		gziplist=`for kernel in $${kernlist}; do \
3941.197Sthorpej			echo "$${kernel}"; \
3951.207Sbjh21			for s in $${kernsuffixes}; do \
3961.197Sthorpej				if [ -f $${kernel}.$${s} ]; then \
3971.197Sthorpej					echo "$${kernel}.$${s}"; \
3981.197Sthorpej				fi; \
3991.197Sthorpej			done; \
4001.197Sthorpej		done`; \
4011.197Sthorpej		for kernel in $${gziplist} ; do \
4021.114Sfair		gzip -c -9 < $${kernel} > \
4031.201Slukem		    ${RELEASEDIR}/binary/kernel/$${kernel}-${configfile:C/.*\///}.gz ; done
4041.196Sthorpej.endfor # place KERNEL_SETS kernels + EXTRA_KERNELS in binary/kernel/...
4051.118Sgwr.endif # no target(snap_kern)
4061.108Sdrochner
4071.204Slukemsnap_md_pre: check_DESTDIR check_RELEASEDIR
4081.117Ssimonb# nothing here -- look in the machine-dependent Makefile.inc
4091.117Ssimonb
4101.204Slukemsnap_md_post: check_DESTDIR check_RELEASEDIR
4111.41Scgd# nothing here -- look in the machine-dependent Makefile.inc
4121.7Scgd
4131.1Scgd.include <bsd.prog.mk>
414