Makefile revision 1.200
11.200Slukem#	$NetBSD: Makefile,v 1.200 2002/01/27 01:44:02 lukem 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.200Slukem.if !defined(DESTDIR) || ${DESTDIR} == ""				# {
1421.174Schristos__warndestdir: .USE
1431.36Scgd	@echo setenv DESTDIR before doing that!
1441.34Scgd	@false
1451.200Slukemdistribution install-etc-files distrib-dirs \
1461.200Slukem    release snapshot iso-image iso_image_mi iso-image_md_pre iso-image_md_post \
1471.200Slukem    snap_pre snap_md_pre: __warndestdir
1481.174Schristos.if !target(snap_md_post)
1491.174Schristossnap_md_post: __warndestdir
1501.174Schristos.endif
1511.200Slukem.if !target(snap_kern)
1521.200Slukemsnap_kern: __warndestdir
1531.200Slukem.endif
1541.200Slukem
1551.200Slukem.else	# DESTDIR != ""							# } {
1561.200Slukem
1571.7Scgddistribution: 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.193Sthorpejinstall-etc-files:
1671.124Ssimonb	${INSTALL} ${INSTPRIV} -c -o ${BINOWN} -g ${BINGRP} -m 644 ${BIN1} \
1681.124Ssimonb	    ${DESTDIR}/etc
1691.124Ssimonb	${INSTALL} ${INSTPRIV} -c -o ${BINOWN} -g ${BINGRP} -m 664 ${BIN2} \
1701.124Ssimonb	    ${DESTDIR}/etc
1711.124Ssimonb	${INSTALL} ${INSTPRIV} -c -o ${BINOWN} -g ${BINGRP} -m 600 ${BIN3} \
1721.124Ssimonb	    ${DESTDIR}/etc
1731.124Ssimonb	${INSTALL} ${INSTPRIV} -c -o ${BINOWN} -g ${BINGRP} -m 644 aliases \
1741.147Sitojun	    ${DESTDIR}/etc/mail
1751.124Ssimonb	${INSTALL} ${INSTPRIV} -c -o root -g wheel -m 600 crontab \
1761.56Sthorpej	    ${DESTDIR}/var/cron/tabs/root
1771.124Ssimonb	${INSTALL} ${INSTPRIV} -c -o root -g wheel -m 600 master.passwd \
1781.124Ssimonb	    ${DESTDIR}/etc
1791.198Sjmc	${PWD_MKDB} -p ${TARGET_ENDIANNESS} -d ${DESTDIR}/ \
1801.171Ssimonb		${DESTDIR}/etc/master.passwd
1811.194Sperry.if defined(UNPRIVED)
1821.194Sperry	echo "${DESTDIR}/etc/passwd type=file mode=0644 uname=root gname=wheel" \
1831.194Sperry		| sed -e 's|^/|./|g' -e 's|//|/|g' >>${METALOG}
1841.194Sperry	echo "${DESTDIR}/etc/pwd.db type=file mode=0644 uname=root gname=wheel" \
1851.194Sperry		| sed -e 's|^/|./|g' -e 's|//|/|g' >>${METALOG}
1861.194Sperry	echo "${DESTDIR}/etc/spwd.db type=file mode=0600 uname=root gname=wheel" \
1871.194Sperry		| sed -e 's|^/|./|g' -e 's|//|/|g' >>${METALOG}
1881.200Slukem.endif	# UNPRIVED
1891.124Ssimonb	${INSTALL} ${INSTPRIV} -c -o ${BINOWN} -g ${BINGRP} -m 555 \
1901.1Scgd	     MAKEDEV.local etc.${MACHINE}/MAKEDEV ${DESTDIR}/dev
1911.124Ssimonb	${INSTALL} ${INSTPRIV} -c -o root -g wheel -m 600 minfree \
1921.73Sperry	    ${DESTDIR}/var/crash
1931.1Scgd	(cd root; \
1941.124Ssimonb		${INSTALL} ${INSTPRIV} -c -o root -g wheel -m 644 dot.cshrc \
1951.1Scgd		    ${DESTDIR}/root/.cshrc; \
1961.124Ssimonb		${INSTALL} ${INSTPRIV} -c -o root -g wheel -m 600 dot.klogin \
1971.1Scgd		    ${DESTDIR}/root/.klogin; \
1981.124Ssimonb		${INSTALL} ${INSTPRIV} -c -o root -g wheel -m 644 dot.login \
1991.1Scgd		    ${DESTDIR}/root/.login; \
2001.124Ssimonb		${INSTALL} ${INSTPRIV} -c -o root -g wheel -m 644 dot.profile \
2011.1Scgd		    ${DESTDIR}/root/.profile; \
2021.128Smycroft		${INSTALL} ${INSTPRIV} -c -o root -g wheel -m 644 dot.shrc \
2031.128Smycroft		    ${DESTDIR}/root/.shrc; \
2041.189Sperry		rm -f ${DESTDIR}/.cshrc ${DESTDIR}/.profile; \
2051.188Sperry		${INSTALL} ${INSTPRIV} -l h \
2061.188Sperry			${DESTDIR}/root/.cshrc ${DESTDIR}/.cshrc; \
2071.188Sperry		${INSTALL} ${INSTPRIV} -l h \
2081.188Sperry			${DESTDIR}/root/.profile ${DESTDIR}/.profile)
2091.162Slukem	(cd defaults; ${MAKE} install)
2101.83Smrg	(cd mtree; ${MAKE} install)
2111.63Smikel	(cd namedb; \
2121.124Ssimonb		${INSTALL} ${INSTPRIV} -c -o ${BINOWN} -g ${BINGRP} -m 644 \
2131.124Ssimonb		    ${NAMEDB} ${DESTDIR}/etc/namedb)
2141.140Slukem	(cd rc.d; ${MAKE} install)
2151.188Sperry	${INSTALL} ${INSTPRIV} -l s -o root -g wheel -m 755 \
2161.188Sperry		${TZDIR}/${LOCALTIME} ${DESTDIR}/etc/localtime
2171.188Sperry	${INSTALL} ${INSTPRIV} -l s -o root -g wheel -m 755 \
2181.188Sperry		/usr/sbin/rmt ${DESTDIR}/etc/rmt
2191.124Ssimonb	${INSTALL} ${INSTPRIV} -c -o ${BINOWN} -g operator -m 664 /dev/null \
2201.32Sjtc		${DESTDIR}/etc/dumpdates
2211.124Ssimonb	${INSTALL} ${INSTPRIV} -c -o ${BINOWN} -g operator -m 600 /dev/null \
2221.44Sderaadt		${DESTDIR}/etc/skeykeys
2231.127Sperry	${INSTALL} ${INSTPRIV} -c -o root -g wheel -m 600 /dev/null \
2241.127Sperry		${DESTDIR}/var/at/at.deny
2251.124Ssimonb	${INSTALL} ${INSTPRIV} -c -o root -g wheel -m 600 /dev/null \
2261.38Scgd		${DESTDIR}/var/cron/log
2271.124Ssimonb	${INSTALL} ${INSTPRIV} -c -o nobody -g ${BINGRP} -m 664 /dev/null \
2281.32Sjtc		${DESTDIR}/var/db/locate.database
2291.124Ssimonb	${INSTALL} ${INSTPRIV} -c -o uucp -g dialer -m 640 /dev/null \
2301.113Sfair		${DESTDIR}/var/log/aculog
2311.124Ssimonb	${INSTALL} ${INSTPRIV} -c -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
2321.69Sperry		${DESTDIR}/var/log/authlog
2331.124Ssimonb	${INSTALL} ${INSTPRIV} -c -o ${BINOWN} -g ${BINGRP} -m 664 /dev/null \
2341.32Sjtc		${DESTDIR}/var/log/lastlog
2351.124Ssimonb	${INSTALL} ${INSTPRIV} -c -o ${BINOWN} -g ${BINGRP} -m 640 /dev/null \
2361.32Sjtc		${DESTDIR}/var/log/lpd-errs
2371.124Ssimonb	${INSTALL} ${INSTPRIV} -c -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
2381.32Sjtc		${DESTDIR}/var/log/maillog
2391.124Ssimonb	${INSTALL} ${INSTPRIV} -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
2401.32Sjtc		${DESTDIR}/var/log/messages
2411.124Ssimonb	${INSTALL} ${INSTPRIV} -c -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
2421.58Slukem		${DESTDIR}/var/log/secure
2431.137Smycroft	${INSTALL} ${INSTPRIV} -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
2441.137Smycroft		${DESTDIR}/var/log/sendmail.st
2451.124Ssimonb	${INSTALL} ${INSTPRIV} -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
2461.32Sjtc		${DESTDIR}/var/log/wtmp
2471.124Ssimonb	${INSTALL} ${INSTPRIV} -c -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
2481.69Sperry		${DESTDIR}/var/log/xferlog
2491.124Ssimonb	${INSTALL} ${INSTPRIV} -c -o daemon -g staff -m 664 /dev/null \
2501.39Scgd		${DESTDIR}/var/msgs/bounds
2511.124Ssimonb	${INSTALL} ${INSTPRIV} -c -o ${BINOWN} -g ${BINGRP} -m 664 /dev/null \
2521.32Sjtc		${DESTDIR}/var/run/utmp
2531.124Ssimonb	${INSTALL} ${INSTPRIV} -c -o games -g games -m 664 /dev/null \
2541.81Smrg		${DESTDIR}/var/games/atc_scores
2551.124Ssimonb	${INSTALL} ${INSTPRIV} -c -o games -g games -m 664 /dev/null \
2561.81Smrg		${DESTDIR}/var/games/battlestar.log
2571.124Ssimonb	${INSTALL} ${INSTPRIV} -c -o games -g games -m 664 /dev/null \
2581.81Smrg		${DESTDIR}/var/games/cfscores
2591.124Ssimonb	${INSTALL} ${INSTPRIV} -c -o games -g games -m 664 /dev/null \
2601.82Sperry		${DESTDIR}/var/games/criblog
2611.124Ssimonb	${INSTALL} ${INSTPRIV} -c -o games -g games -m 664 /dev/null \
2621.81Smrg		${DESTDIR}/var/games/robots_roll
2631.124Ssimonb	${INSTALL} ${INSTPRIV} -c -o games -g games -m 664 /dev/null \
2641.81Smrg		${DESTDIR}/var/games/rogue.scores
2651.124Ssimonb	${INSTALL} ${INSTPRIV} -c -o games -g games -m 664 /dev/null \
2661.81Smrg		${DESTDIR}/var/games/saillog
2671.124Ssimonb	${INSTALL} ${INSTPRIV} -c -o games -g games -m 664 /dev/null \
2681.81Smrg		${DESTDIR}/var/games/snakerawscores
2691.124Ssimonb	${INSTALL} ${INSTPRIV} -c -o games -g games -m 664 /dev/null \
2701.81Smrg		${DESTDIR}/var/games/snake.log
2711.124Ssimonb	${INSTALL} ${INSTPRIV} -c -o games -g games -m 664 /dev/null \
2721.81Smrg		${DESTDIR}/var/games/tetris.scores
2731.124Ssimonb	${INSTALL} ${INSTPRIV} -c -o games -g games -m 664 /dev/null \
2741.81Smrg		${DESTDIR}/var/games/larn/llog12.0
2751.124Ssimonb	${INSTALL} ${INSTPRIV} -c -o games -g games -m 664 /dev/null \
2761.81Smrg		${DESTDIR}/var/games/larn/lscore12.0
2771.124Ssimonb	${INSTALL} ${INSTPRIV} -c -o games -g games -m 664 /dev/null \
2781.81Smrg		${DESTDIR}/var/games/larn/playerids
2791.124Ssimonb	(cd etc.${MACHINE}; ${INSTALL} ${INSTPRIV} -c -o ${BINOWN} \
2801.124Ssimonb	    -g ${BINGRP} -m 444 fstab.* ${DESTDIR}/etc)
2811.165Ssimonb	(cd skel; ${MAKE} distribution)
2821.62Sperry	(cd ../usr.bin/mail; ${MAKE} distribution)
2831.143Sperry	(cd ../gnu/usr.sbin/postfix/; ${MAKE} distribution)
2841.155Sthorpej.if (${MKCRYPTO} != "no")
2851.155Sthorpej	(cd ../usr.bin/ssh; ${MAKE} distribution)
2861.155Sthorpej.endif
2871.200Slukem.if !defined(NO_SENDMAIL)
2881.133Stron	(cd ../gnu/usr.sbin/sendmail/cf/cf; ${MAKE} distribution)
2891.90Skim.endif
2901.1Scgd
2911.7Scgddistrib-dirs:
2921.124Ssimonb	${INSTALL} ${INSTPRIV} -d -o root -g wheel -m 755 ${DESTDIR}
2931.192Sperry	${MTREE} -def mtree/NetBSD.dist -p ${DESTDIR}/ -U ${UNPRIVED:D-W}
2941.189Sperry	rm -f ${DESTDIR}/sys
2951.188Sperry	${INSTALL} ${INSTPRIV} -l s -o root -g wheel -m 755 \
2961.188Sperry		usr/src/sys ${DESTDIR}/sys
2971.99Scjs
2981.200Slukem.if !defined(RELEASEDIR)						# {
2991.175Schristos__warnreleasedir: .USE
3001.96Scjs	@echo setenv RELEASEDIR before doing that!
3011.96Scjs	@false
3021.200Slukemrelease snapshot iso-image iso_image_mi iso-image_md_pre iso-image_md_post \
3031.200Slukem    snap_pre snap_md_pre: __warnreleasedir
3041.175Schristos.if !target(snap_md_post)
3051.175Schristossnap_md_post: __warnreleasedir
3061.175Schristos.endif
3071.200Slukem.if !target(snap_kern)
3081.200Slukemsnap_kern: __warnreleasedir
3091.200Slukem.endif
3101.200Slukem
3111.200Slukem.else	# RELEASEDIR							# } {
3121.200Slukem
3131.117Ssimonbrelease snapshot: distribution snap_pre snap_md_pre snap_kern snap_md_post
3141.141Sthorpej	(cd ../distrib/sets; ${MAKE} sets)
3151.123Sis	sh ../distrib/sets/makesums -t ${RELEASEDIR}/binary/kernel '*.gz'
3161.161Shubertf
3171.161Shubertf# Standalone target to create a CDROM image after the release
3181.161Shubertf# was composed. Should be run after "make build" in both src and xsrc
3191.161Shubertfiso-image: iso-image_md_post
3201.161Shubertf
3211.161Shubertfiso-image_mi: iso-image_md_pre
3221.161Shubertf	@if ${MKISOFS} --version; then \
3231.161Shubertf		mkdir -p ${RELEASEDIR}/installation/cdrom ; \
3241.161Shubertf		${MKISOFS} ${MKISOFS_FLAGS} \
3251.161Shubertf			-o ${RELEASEDIR}/installation/cdrom/netbsd-${MACHINE}.iso \
3261.161Shubertf			${RELEASEDIR} ; \
3271.161Shubertf		sh ../distrib/sets/makesums -t ${RELEASEDIR}/installation/cdrom '*.iso' ; \
3281.161Shubertf	else \
3291.161Shubertf		echo "install pkgsrc/sysutils/cdrecord and type 'make iso-image'." ; \
3301.161Shubertf	fi
3311.161Shubertf
3321.161Shubertf# Setup the $RELEASEDIR to produce a bootable CD image:
3331.161Shubertfiso-image_md_pre:
3341.161Shubertf# nothing here -- look in the machine-dependent Makefile.inc
3351.161Shubertf
3361.161Shubertf# Fixup the  CD-image to be bootable
3371.161Shubertfiso-image_md_post: iso-image_mi
3381.161Shubertf# nothing here -- look in the machine-dependent Makefile.inc
3391.41Scgd
3401.41Scgdsnap_pre:
3411.168Sjmc# Could be a mount point, ignore the errors
3421.167Sjmc	-/bin/rm -rf ${RELEASEDIR}
3431.124Ssimonb	${INSTALL} ${INSTPRIV} -d -o root -g wheel -m 755 ${RELEASEDIR}
3441.117Ssimonb.for dir in ${INSTALLATION_DIRS}
3451.124Ssimonb	${INSTALL} ${INSTPRIV} -d -o root -g wheel -m 755 ${RELEASEDIR}/${dir}
3461.117Ssimonb.endfor
3471.96Scjs
3481.196Sthorpej# This target builds the kernels specified by each port.  A port may
3491.196Sthorpej# specify the following kernels:
3501.196Sthorpej#
3511.196Sthorpej#	KERNEL_SETS		The list of kernels that will be
3521.196Sthorpej#				packaged into sets, named
3531.196Sthorpej#				kern-${kernel}.tgz.  These kernels
3541.196Sthorpej#				are also placed in the binary/kernels
3551.196Sthorpej#				area of the release package as
3561.196Sthorpej#				netbsd-${kernel}.gz.
3571.196Sthorpej#
3581.196Sthorpej#	EXTRA_KERNELS		Additional kernels to place in the
3591.196Sthorpej#				binary/kernels area of the release
3601.196Sthorpej#				package as netbsd-${kernel}.gz, but
3611.196Sthorpej#				which are not placed into sets. This
3621.196Sthorpej#				allows a port to provide e.g. a netbootable
3631.196Sthorpej#				installation kernel containing a ramdisk.
3641.196Sthorpej#
3651.196Sthorpej#	BUILD_KERNELS		Additional kernels to build which are
3661.196Sthorpej#				not placed into sets nor into the
3671.196Sthorpej#				binary/kernels area of the release
3681.196Sthorpej#				package.  These are typically kernels
3691.196Sthorpej#				that are built for inclusion only in
3701.196Sthorpej#				installation disk/CD-ROM/tape images.
3711.116Sfair#
3721.197Sthorpej# A port may also specify KERNEL_SUFFIXES, which is an optional list
3731.197Sthorpej# of filename suffixes for kernels to include in the kernel sets and
3741.197Sthorpej# in the binary/kernels area of the release package (e.g. "netbsd" vs.
3751.197Sthorpej# "netbsd.ecoff" and "netbsd.srec").  It is not an error if kernels
3761.197Sthorpej# with these suffixes do not exist in the kernel build directory.
3771.197Sthorpej#
3781.116SfairGETKERNELAWK=	awk '/^config/ {print $$2; found=1} \
3791.116Sfair		END{ if (found == 0) print "netbsd"; }'
3801.96Scjs#
3811.118Sgwr.if !target(snap_kern)
3821.96Scjssnap_kern:
3831.145Ssjg.ifndef KERNELS_DONE
3841.196Sthorpej.for configfile in ${KERNEL_SETS} ${EXTRA_KERNELS} ${BUILD_KERNELS}
3851.125Ssommerfe	cd ${KERNCONFDIR} && ${CONFIG} \
3861.179Smrg		-b ${KERNOBJDIR}/${configfile:C/.*\///} -s ${KERNSRCDIR} ${configfile}
3871.97Scjs.ifndef UPDATE
3881.200Slukem	cd ${KERNOBJDIR}/${configfile:C/.*\///} && ${MAKE} distclean
3891.96Scjs.endif
3901.179Smrg	cd ${KERNOBJDIR}/${configfile:C/.*\///} && ${MAKE} depend && ${MAKE} ${_J}
3911.196Sthorpej.endfor # build kernels
3921.196Sthorpej.for configfile in ${KERNEL_SETS}
3931.197Sthorpej	kernlist=`${GETKERNELAWK} ${KERNCONFDIR}/${configfile}`; \
3941.197Sthorpej	kerndir=${KERNOBJDIR}/${configfile:C/.*\///}; \
3951.197Sthorpej	cd $${kerndir} && \
3961.197Sthorpej		tarlist=`for kernel in $${kernlist}; do \
3971.197Sthorpej			echo "$${kernel}"; \
3981.197Sthorpej			for s in ${KERNEL_SUFFIXES}; do \
3991.197Sthorpej				if [ -f $${kernel}.$${s} ]; then \
4001.197Sthorpej					echo "$${kernel}.$${s}"; \
4011.197Sthorpej				fi; \
4021.197Sthorpej			done; \
4031.197Sthorpej		done`; \
4041.197Sthorpej		tar cf - $${tarlist} | \
4051.196Sthorpej		gzip -c -9 > ${RELEASEDIR}/binary/sets/kern-${configfile}.tgz
4061.196Sthorpej.endfor # make kernel sets
4071.196Sthorpej.for configfile in ${KERNEL_SETS} ${EXTRA_KERNELS}
4081.197Sthorpej	kernlist=`${GETKERNELAWK} ${KERNCONFDIR}/${configfile:C/.*\///}`; \
4091.197Sthorpej	kerndir=${KERNOBJDIR}/${configfile:C/.*\///}; \
4101.197Sthorpej	cd $${kerndir} &&	\
4111.197Sthorpej		gziplist=`for kernel in $${kernlist}; do \
4121.197Sthorpej			echo "$${kernel}"; \
4131.197Sthorpej			for s in ${KERNEL_SUFFIXES}; do \
4141.197Sthorpej				if [ -f $${kernel}.$${s} ]; then \
4151.197Sthorpej					echo "$${kernel}.$${s}"; \
4161.197Sthorpej				fi; \
4171.197Sthorpej			done; \
4181.197Sthorpej		done`; \
4191.197Sthorpej		for kernel in $${gziplist} ; do \
4201.114Sfair		gzip -c -9 < $${kernel} > \
4211.196Sthorpej			${RELEASEDIR}/binary/kernel/$${kernel}-${configfile:C/.*\///}.gz ; done
4221.196Sthorpej.endfor # place KERNEL_SETS kernels + EXTRA_KERNELS in binary/kernel/...
4231.145Ssjg.endif # KERNELS_DONE
4241.118Sgwr.endif # no target(snap_kern)
4251.108Sdrochner
4261.200Slukem.endif # RELEASEDIR							# }
4271.41Scgd
4281.117Ssimonbsnap_md_pre:
4291.117Ssimonb# nothing here -- look in the machine-dependent Makefile.inc
4301.117Ssimonb
4311.117Ssimonbsnap_md_post:
4321.41Scgd# nothing here -- look in the machine-dependent Makefile.inc
4331.41Scgd
4341.200Slukem.endif	# DESTDIR							# }
4351.7Scgd
4361.1Scgd.include <bsd.prog.mk>
437