Makefile revision 1.203
11.203Schs#	$NetBSD: Makefile,v 1.203 2002/03/01 06:22:09 chs 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.149Ssjg# do this before bsd.own.mk so we get correct KERNSRCDIR
391.145Ssjg.include "../Makefile.inc"
401.145Ssjg
411.155Sthorpej# For NO_SENDMAIL, INSTPRIV, MKCRYPTO
421.90Skim.include <bsd.own.mk>
431.187Sjmc
441.187Sjmc.MAKEOVERRIDES+=	USETOOLS
451.90Skim
461.23ScgdTZDIR=		/usr/share/zoneinfo
471.157SkleinkLOCALTIME?=	UTC
481.198SjmcPWD_MKDB?=	pwd_mkdb
491.19Sderaadt
501.161Shubertf# Flags for creating ISO CDROM image
511.161Shubertf# mkisofs is expected to be in $PATH, install via pkgsrc/sysutils/cdrecord
521.161ShubertfMKISOFS?=	mkisofs
531.161ShubertfMKISOFS_FLAGS+= -J -l \
541.161Shubertf		-r -T -v \
551.161Shubertf		-P "The NetBSD Project" \
561.164Shubertf		-m "${RELEASEDIR}/installation/cdrom"
571.1Scgd
581.80Sjonathan# MD Makefile.inc may append MD targets to BIN[123].  Make sure all
591.80Sjonathan# are empty, to preserve the old semantics of setting them below with "=".
601.200SlukemBIN1=
611.80SjonathanBIN2=
621.80SjonathanBIN3=
631.80Sjonathan
641.117Ssimonb# Directories to build in ${RELEASEDIR}.   MD Makefile.inc files can
651.117Ssimonb# add to this.
661.117Ssimonb# NOTE: Parent directories must be listed before subdirectories.
671.117SsimonbINSTALLATION_DIRS= \
681.158Sfvdl	binary binary/sets binary/kernel installation
691.117Ssimonb
701.71Scjs.if exists(etc.${MACHINE}/Makefile.inc)
711.71Scjs.include "etc.${MACHINE}/Makefile.inc"
721.71Scjs.endif
731.32Sjtc
741.96Scjs# Use multiple jobs for kernel builds, if NBUILDJOBS set.
751.96Scjs# (Taken from src/Makefile.)
761.96Scjs.if defined(NBUILDJOBS)
771.96Scjs_J= -j${NBUILDJOBS}
781.96Scjs.endif
791.96Scjs
801.21Scgd# -rw-r--r--
811.21ScgdBINOWN= root
821.21ScgdBINGRP= wheel
831.184SlukemBIN1+=	bootptab changelist csh.cshrc csh.login csh.logout daily \
841.131Sveego	daily.conf dm.conf floppytab ftpchroot ftpusers ftpwelcome \
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.131Sveego	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.105Smycroft	(${MACHINE_ARCH} == "vax") || \
971.105Smycroft	(${MACHINE_ARCH} == "arm32")
981.129SchristosBIN1+=	ld.so.conf
991.129Schristos.elif exists(etc.${MACHINE_ARCH}/ld.so.conf)
1001.132SjlamBIN1+=	etc.${MACHINE_ARCH}/ld.so.conf
1011.152Sperry.endif
1021.152Sperry
1031.152Sperry.if exists(etc.${MACHINE_ARCH}/ttyaction)
1041.152SperryBIN1+=	etc.${MACHINE_ARCH}/ttyaction
1051.105Smycroft.endif
1061.1Scgd
1071.46Sderaadt# -rw-rw-r--
1081.80SjonathanBIN2+=	motd
1091.1Scgd
1101.77Smycroft# -rw-------
1111.80SjonathanBIN3+=	hosts.equiv
1121.77Smycroft
1131.144SthorpejNAMEDB=	127 root.cache named.conf localhost loopback.v6
1141.1ScgdPCS=	pcs750.bin
1151.1Scgd
1161.200Slukem.if make(release) || make(snapshot) || make(distribution)		# {
1171.170Sjdolecek# find out endianness of target and set proper flag for pwd_mkdb so that
1181.170Sjdolecek# it creates database in same endianness
1191.191Stv.if exists(${DESTDIR}/usr/include/sys/endian.h)
1201.171SsimonbTARGET_ENDIANNESS!= \
1211.191Stv	printf '\#include <sys/endian.h>\n_BYTE_ORDER\n' | \
1221.171Ssimonb	${CC} -I${DESTDIR}/usr/include -E - | tail -1 | awk '{print $$1}'
1231.170Sjdolecek.else
1241.170SjdolecekTARGET_ENDIANNESS=
1251.170Sjdolecek.endif
1261.170Sjdolecek
1271.191Stv.if ${TARGET_ENDIANNESS} == "1234"
1281.170SjdolecekTARGET_ENDIANNESS= -L
1291.191Stv.elif ${TARGET_ENDIANNESS} == "4321"
1301.170SjdolecekTARGET_ENDIANNESS= -B
1311.170Sjdolecek.else
1321.170SjdolecekTARGET_ENDIANNESS=
1331.191Stv.endif
1341.200Slukem.endif	# release || snapshot || distribution				# }
1351.170Sjdolecek
1361.149Ssjg.include <bsd.kernobj.mk>
1371.149Ssjg
1381.149Ssjgobj:
1391.149Ssjg	mkdir -p ${KERNOBJDIR}
1401.149Ssjg
1411.202Slukemcheck_destdir: .PHONY
1421.202Slukem.if !defined(DESTDIR)
1431.202Slukem	@echo "setenv DESTDIR before doing that!"
1441.34Scgd	@false
1451.202Slukem.else
1461.202Slukem	@true
1471.174Schristos.endif
1481.202Slukem
1491.202Slukemcheck_releasedir: .PHONY
1501.202Slukem.if !defined(RELEASEDIR)
1511.202Slukem	@echo "setenv RELEASEDIR before doing that!"
1521.202Slukem	@false
1531.202Slukem.else
1541.202Slukem	@true
1551.200Slukem.endif
1561.200Slukem
1571.202Slukemdistribution: check_destdir .WAIT distrib-dirs
1581.182Schs.if !defined(DISTRIBUTION_DONE)
1591.87Sperry.if !defined(INSTALL_DONE)
1601.107Sscottr	(cd ..; ${MAKE} _DISTRIB= includes)
1611.107Sscottr	(cd ..; ${MAKE} _DISTRIB= install)
1621.200Slukem.endif	# !INSTALL_DONE
1631.193Sthorpej	${MAKE} install-etc-files
1641.200Slukem.endif	# !DISTRIBUTION_DONE
1651.193Sthorpej
1661.202Slukeminstall-etc-files: check_destdir
1671.202Slukem	${INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 ${BIN1} ${DESTDIR}/etc
1681.202Slukem	${INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 664 ${BIN2} ${DESTDIR}/etc
1691.202Slukem	${INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 600 ${BIN3} ${DESTDIR}/etc
1701.202Slukem	${INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 aliases \
1711.147Sitojun	    ${DESTDIR}/etc/mail
1721.202Slukem	${INSTALL_FILE} -o root -g wheel -m 600 crontab \
1731.56Sthorpej	    ${DESTDIR}/var/cron/tabs/root
1741.202Slukem	${INSTALL_FILE} -o root -g wheel -m 600 master.passwd ${DESTDIR}/etc
1751.198Sjmc	${PWD_MKDB} -p ${TARGET_ENDIANNESS} -d ${DESTDIR}/ \
1761.171Ssimonb		${DESTDIR}/etc/master.passwd
1771.194Sperry.if defined(UNPRIVED)
1781.194Sperry	echo "${DESTDIR}/etc/passwd type=file mode=0644 uname=root gname=wheel" \
1791.194Sperry		| sed -e 's|^/|./|g' -e 's|//|/|g' >>${METALOG}
1801.194Sperry	echo "${DESTDIR}/etc/pwd.db type=file mode=0644 uname=root gname=wheel" \
1811.194Sperry		| sed -e 's|^/|./|g' -e 's|//|/|g' >>${METALOG}
1821.194Sperry	echo "${DESTDIR}/etc/spwd.db type=file mode=0600 uname=root gname=wheel" \
1831.194Sperry		| sed -e 's|^/|./|g' -e 's|//|/|g' >>${METALOG}
1841.200Slukem.endif	# UNPRIVED
1851.202Slukem	${INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 555 \
1861.1Scgd	     MAKEDEV.local etc.${MACHINE}/MAKEDEV ${DESTDIR}/dev
1871.202Slukem	${INSTALL_FILE} -o root -g wheel -m 600 minfree ${DESTDIR}/var/crash
1881.1Scgd	(cd root; \
1891.202Slukem		${INSTALL_FILE} -o root -g wheel -m 644 dot.cshrc \
1901.1Scgd		    ${DESTDIR}/root/.cshrc; \
1911.202Slukem		${INSTALL_FILE} -o root -g wheel -m 600 dot.klogin \
1921.1Scgd		    ${DESTDIR}/root/.klogin; \
1931.202Slukem		${INSTALL_FILE} -o root -g wheel -m 644 dot.login \
1941.1Scgd		    ${DESTDIR}/root/.login; \
1951.202Slukem		${INSTALL_FILE} -o root -g wheel -m 644 dot.profile \
1961.1Scgd		    ${DESTDIR}/root/.profile; \
1971.202Slukem		${INSTALL_FILE} -o root -g wheel -m 644 dot.shrc \
1981.128Smycroft		    ${DESTDIR}/root/.shrc; \
1991.189Sperry		rm -f ${DESTDIR}/.cshrc ${DESTDIR}/.profile; \
2001.202Slukem		${INSTALL_LINK} ${DESTDIR}/root/.cshrc ${DESTDIR}/.cshrc; \
2011.202Slukem		${INSTALL_LINK} ${DESTDIR}/root/.profile ${DESTDIR}/.profile)
2021.162Slukem	(cd defaults; ${MAKE} install)
2031.83Smrg	(cd mtree; ${MAKE} install)
2041.63Smikel	(cd namedb; \
2051.202Slukem		${INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
2061.124Ssimonb		    ${NAMEDB} ${DESTDIR}/etc/namedb)
2071.140Slukem	(cd rc.d; ${MAKE} install)
2081.202Slukem	${INSTALL_SYMLINK} -o root -g wheel -m 755 \
2091.188Sperry		${TZDIR}/${LOCALTIME} ${DESTDIR}/etc/localtime
2101.202Slukem	${INSTALL_SYMLINK} -o root -g wheel -m 755 \
2111.188Sperry		/usr/sbin/rmt ${DESTDIR}/etc/rmt
2121.202Slukem	${INSTALL_FILE} -o ${BINOWN} -g operator -m 664 /dev/null \
2131.32Sjtc		${DESTDIR}/etc/dumpdates
2141.202Slukem	${INSTALL_FILE} -o ${BINOWN} -g operator -m 600 /dev/null \
2151.44Sderaadt		${DESTDIR}/etc/skeykeys
2161.202Slukem	${INSTALL_FILE} -o root -g wheel -m 600 /dev/null \
2171.127Sperry		${DESTDIR}/var/at/at.deny
2181.202Slukem	${INSTALL_FILE} -o root -g wheel -m 600 /dev/null \
2191.38Scgd		${DESTDIR}/var/cron/log
2201.202Slukem	${INSTALL_FILE} -o nobody -g ${BINGRP} -m 664 /dev/null \
2211.32Sjtc		${DESTDIR}/var/db/locate.database
2221.202Slukem	${INSTALL_FILE} -o uucp -g dialer -m 640 /dev/null \
2231.113Sfair		${DESTDIR}/var/log/aculog
2241.202Slukem	${INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
2251.69Sperry		${DESTDIR}/var/log/authlog
2261.202Slukem	${INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 664 /dev/null \
2271.32Sjtc		${DESTDIR}/var/log/lastlog
2281.202Slukem	${INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 640 /dev/null \
2291.32Sjtc		${DESTDIR}/var/log/lpd-errs
2301.202Slukem	${INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
2311.32Sjtc		${DESTDIR}/var/log/maillog
2321.202Slukem	${INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
2331.32Sjtc		${DESTDIR}/var/log/messages
2341.202Slukem	${INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
2351.58Slukem		${DESTDIR}/var/log/secure
2361.202Slukem	${INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
2371.137Smycroft		${DESTDIR}/var/log/sendmail.st
2381.202Slukem	${INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
2391.32Sjtc		${DESTDIR}/var/log/wtmp
2401.202Slukem	${INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
2411.69Sperry		${DESTDIR}/var/log/xferlog
2421.202Slukem	${INSTALL_FILE} -o daemon -g staff -m 664 /dev/null \
2431.39Scgd		${DESTDIR}/var/msgs/bounds
2441.202Slukem	${INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 664 /dev/null \
2451.32Sjtc		${DESTDIR}/var/run/utmp
2461.202Slukem	${INSTALL_FILE} -o games -g games -m 664 /dev/null \
2471.81Smrg		${DESTDIR}/var/games/atc_scores
2481.202Slukem	${INSTALL_FILE} -o games -g games -m 664 /dev/null \
2491.81Smrg		${DESTDIR}/var/games/battlestar.log
2501.202Slukem	${INSTALL_FILE} -o games -g games -m 664 /dev/null \
2511.81Smrg		${DESTDIR}/var/games/cfscores
2521.202Slukem	${INSTALL_FILE} -o games -g games -m 664 /dev/null \
2531.82Sperry		${DESTDIR}/var/games/criblog
2541.202Slukem	${INSTALL_FILE} -o games -g games -m 664 /dev/null \
2551.81Smrg		${DESTDIR}/var/games/robots_roll
2561.202Slukem	${INSTALL_FILE} -o games -g games -m 664 /dev/null \
2571.81Smrg		${DESTDIR}/var/games/rogue.scores
2581.202Slukem	${INSTALL_FILE} -o games -g games -m 664 /dev/null \
2591.81Smrg		${DESTDIR}/var/games/saillog
2601.202Slukem	${INSTALL_FILE} -o games -g games -m 664 /dev/null \
2611.81Smrg		${DESTDIR}/var/games/snakerawscores
2621.202Slukem	${INSTALL_FILE} -o games -g games -m 664 /dev/null \
2631.81Smrg		${DESTDIR}/var/games/snake.log
2641.202Slukem	${INSTALL_FILE} -o games -g games -m 664 /dev/null \
2651.81Smrg		${DESTDIR}/var/games/tetris.scores
2661.202Slukem	${INSTALL_FILE} -o games -g games -m 664 /dev/null \
2671.81Smrg		${DESTDIR}/var/games/larn/llog12.0
2681.202Slukem	${INSTALL_FILE} -o games -g games -m 664 /dev/null \
2691.81Smrg		${DESTDIR}/var/games/larn/lscore12.0
2701.202Slukem	${INSTALL_FILE} -o games -g games -m 664 /dev/null \
2711.81Smrg		${DESTDIR}/var/games/larn/playerids
2721.202Slukem	(cd etc.${MACHINE}; ${INSTALL_FILE} -o ${BINOWN} \
2731.124Ssimonb	    -g ${BINGRP} -m 444 fstab.* ${DESTDIR}/etc)
2741.165Ssimonb	(cd skel; ${MAKE} distribution)
2751.62Sperry	(cd ../usr.bin/mail; ${MAKE} distribution)
2761.143Sperry	(cd ../gnu/usr.sbin/postfix/; ${MAKE} distribution)
2771.155Sthorpej.if (${MKCRYPTO} != "no")
2781.155Sthorpej	(cd ../usr.bin/ssh; ${MAKE} distribution)
2791.155Sthorpej.endif
2801.200Slukem.if !defined(NO_SENDMAIL)
2811.133Stron	(cd ../gnu/usr.sbin/sendmail/cf/cf; ${MAKE} distribution)
2821.90Skim.endif
2831.1Scgd
2841.202Slukemdistrib-dirs: check_destdir
2851.202Slukem	${INSTALL_DIR} -o root -g wheel -m 755 ${DESTDIR}
2861.192Sperry	${MTREE} -def mtree/NetBSD.dist -p ${DESTDIR}/ -U ${UNPRIVED:D-W}
2871.189Sperry	rm -f ${DESTDIR}/sys
2881.202Slukem	${INSTALL_SYMLINK} -o root -g wheel -m 755 usr/src/sys ${DESTDIR}/sys
2891.200Slukem
2901.202Slukemrelease snapshot: check_destdir check_releasedir .WAIT \
2911.202Slukem    distribution snap_pre snap_md_pre snap_kern snap_md_post
2921.141Sthorpej	(cd ../distrib/sets; ${MAKE} sets)
2931.123Sis	sh ../distrib/sets/makesums -t ${RELEASEDIR}/binary/kernel '*.gz'
2941.161Shubertf
2951.161Shubertf# Standalone target to create a CDROM image after the release
2961.161Shubertf# was composed. Should be run after "make build" in both src and xsrc
2971.202Slukemiso-image: check_destdir check_releasedir .WAIT iso-image_md_post
2981.161Shubertf
2991.202Slukemiso-image_mi: check_destdir check_releasedir .WAIT iso-image_md_pre
3001.161Shubertf	@if ${MKISOFS} --version; then \
3011.161Shubertf		mkdir -p ${RELEASEDIR}/installation/cdrom ; \
3021.161Shubertf		${MKISOFS} ${MKISOFS_FLAGS} \
3031.161Shubertf			-o ${RELEASEDIR}/installation/cdrom/netbsd-${MACHINE}.iso \
3041.161Shubertf			${RELEASEDIR} ; \
3051.161Shubertf		sh ../distrib/sets/makesums -t ${RELEASEDIR}/installation/cdrom '*.iso' ; \
3061.161Shubertf	else \
3071.161Shubertf		echo "install pkgsrc/sysutils/cdrecord and type 'make iso-image'." ; \
3081.161Shubertf	fi
3091.161Shubertf
3101.161Shubertf# Setup the $RELEASEDIR to produce a bootable CD image:
3111.202Slukemiso-image_md_pre: check_destdir check_releasedir
3121.161Shubertf# nothing here -- look in the machine-dependent Makefile.inc
3131.161Shubertf
3141.161Shubertf# Fixup the  CD-image to be bootable
3151.202Slukemiso-image_md_post: check_destdir check_releasedir .WAIT iso-image_mi
3161.161Shubertf# nothing here -- look in the machine-dependent Makefile.inc
3171.41Scgd
3181.202Slukemsnap_pre: check_destdir check_releasedir
3191.168Sjmc# Could be a mount point, ignore the errors
3201.167Sjmc	-/bin/rm -rf ${RELEASEDIR}
3211.202Slukem	${INSTALL} -d -m 755 ${RELEASEDIR}
3221.117Ssimonb.for dir in ${INSTALLATION_DIRS}
3231.202Slukem	${INSTALL} -d -m 755 ${RELEASEDIR}/${dir}
3241.117Ssimonb.endfor
3251.96Scjs
3261.196Sthorpej# This target builds the kernels specified by each port.  A port may
3271.196Sthorpej# specify the following kernels:
3281.196Sthorpej#
3291.196Sthorpej#	KERNEL_SETS		The list of kernels that will be
3301.196Sthorpej#				packaged into sets, named
3311.196Sthorpej#				kern-${kernel}.tgz.  These kernels
3321.203Schs#				are also placed in the binary/kernel
3331.196Sthorpej#				area of the release package as
3341.196Sthorpej#				netbsd-${kernel}.gz.
3351.196Sthorpej#
3361.196Sthorpej#	EXTRA_KERNELS		Additional kernels to place in the
3371.203Schs#				binary/kernel area of the release
3381.196Sthorpej#				package as netbsd-${kernel}.gz, but
3391.196Sthorpej#				which are not placed into sets. This
3401.196Sthorpej#				allows a port to provide e.g. a netbootable
3411.196Sthorpej#				installation kernel containing a ramdisk.
3421.196Sthorpej#
3431.196Sthorpej#	BUILD_KERNELS		Additional kernels to build which are
3441.196Sthorpej#				not placed into sets nor into the
3451.203Schs#				binary/kernel area of the release
3461.196Sthorpej#				package.  These are typically kernels
3471.196Sthorpej#				that are built for inclusion only in
3481.196Sthorpej#				installation disk/CD-ROM/tape images.
3491.116Sfair#
3501.197Sthorpej# A port may also specify KERNEL_SUFFIXES, which is an optional list
3511.197Sthorpej# of filename suffixes for kernels to include in the kernel sets and
3521.203Schs# in the binary/kernel area of the release package (e.g. "netbsd" vs.
3531.197Sthorpej# "netbsd.ecoff" and "netbsd.srec").  It is not an error if kernels
3541.197Sthorpej# with these suffixes do not exist in the kernel build directory.
3551.197Sthorpej#
3561.116SfairGETKERNELAWK=	awk '/^config/ {print $$2; found=1} \
3571.116Sfair		END{ if (found == 0) print "netbsd"; }'
3581.96Scjs#
3591.118Sgwr.if !target(snap_kern)
3601.202Slukemsnap_kern: check_destdir check_releasedir
3611.201Slukem.if !defined(KERNELS_DONE)						# {
3621.196Sthorpej.for configfile in ${KERNEL_SETS} ${EXTRA_KERNELS} ${BUILD_KERNELS}
3631.125Ssommerfe	cd ${KERNCONFDIR} && ${CONFIG} \
3641.179Smrg		-b ${KERNOBJDIR}/${configfile:C/.*\///} -s ${KERNSRCDIR} ${configfile}
3651.201Slukem.if !defined(UPDATE)
3661.200Slukem	cd ${KERNOBJDIR}/${configfile:C/.*\///} && ${MAKE} distclean
3671.96Scjs.endif
3681.179Smrg	cd ${KERNOBJDIR}/${configfile:C/.*\///} && ${MAKE} depend && ${MAKE} ${_J}
3691.196Sthorpej.endfor # build kernels
3701.203Schs.endif # KERNELS_DONE							# }
3711.196Sthorpej.for configfile in ${KERNEL_SETS}
3721.197Sthorpej	kernlist=`${GETKERNELAWK} ${KERNCONFDIR}/${configfile}`; \
3731.197Sthorpej	kerndir=${KERNOBJDIR}/${configfile:C/.*\///}; \
3741.197Sthorpej	cd $${kerndir} && \
3751.197Sthorpej		tarlist=`for kernel in $${kernlist}; do \
3761.197Sthorpej			echo "$${kernel}"; \
3771.197Sthorpej			for s in ${KERNEL_SUFFIXES}; do \
3781.197Sthorpej				if [ -f $${kernel}.$${s} ]; then \
3791.197Sthorpej					echo "$${kernel}.$${s}"; \
3801.197Sthorpej				fi; \
3811.197Sthorpej			done; \
3821.197Sthorpej		done`; \
3831.201Slukem		GZIP=-9 ${PAX} -zwf \
3841.201Slukem		    ${RELEASEDIR}/binary/sets/kern-${configfile}.tgz $${tarlist}
3851.196Sthorpej.endfor # make kernel sets
3861.196Sthorpej.for configfile in ${KERNEL_SETS} ${EXTRA_KERNELS}
3871.197Sthorpej	kernlist=`${GETKERNELAWK} ${KERNCONFDIR}/${configfile:C/.*\///}`; \
3881.197Sthorpej	kerndir=${KERNOBJDIR}/${configfile:C/.*\///}; \
3891.197Sthorpej	cd $${kerndir} &&	\
3901.197Sthorpej		gziplist=`for kernel in $${kernlist}; do \
3911.197Sthorpej			echo "$${kernel}"; \
3921.197Sthorpej			for s in ${KERNEL_SUFFIXES}; do \
3931.197Sthorpej				if [ -f $${kernel}.$${s} ]; then \
3941.197Sthorpej					echo "$${kernel}.$${s}"; \
3951.197Sthorpej				fi; \
3961.197Sthorpej			done; \
3971.197Sthorpej		done`; \
3981.197Sthorpej		for kernel in $${gziplist} ; do \
3991.114Sfair		gzip -c -9 < $${kernel} > \
4001.201Slukem		    ${RELEASEDIR}/binary/kernel/$${kernel}-${configfile:C/.*\///}.gz ; done
4011.196Sthorpej.endfor # place KERNEL_SETS kernels + EXTRA_KERNELS in binary/kernel/...
4021.118Sgwr.endif # no target(snap_kern)
4031.108Sdrochner
4041.202Slukemsnap_md_pre: check_destdir check_releasedir
4051.117Ssimonb# nothing here -- look in the machine-dependent Makefile.inc
4061.117Ssimonb
4071.202Slukemsnap_md_post: check_destdir check_releasedir
4081.41Scgd# nothing here -- look in the machine-dependent Makefile.inc
4091.7Scgd
4101.1Scgd.include <bsd.prog.mk>
411