Makefile revision 210024
1# $FreeBSD: head/release/Makefile 210024 2010-07-13 21:19:59Z nwhitehorn $
2#
3# make release [BUILDNAME=somename] CHROOTDIR=/some/dir CVSROOT=/cvs/dir \
4#     [RELEASETAG=tag] [SVNROOT=svn://svn.freebsd.org/base] \
5#     [SVNBRANCH=some/branch]
6#
7# Where "/some/dir" is the pathname of a directory on a some filesystem with
8# at least 1000MB of free space, "somename" is what you want the release to
9# call itself, "/cvs/dir" is where our source repo resides and, optionally,
10# which CVS "tag" name should be used when checking out the sources to build
11# the release (default is HEAD).
12#
13# Please note the support for building from SVN is preliminary and there
14# are still questions about things like how to handle updates of
15# /usr/src on production systems (csup(1) replacement).  It is a work
16# in progress and may change as the other issues get worked out.
17#
18# Please note: the md(4) driver must be present in the kernel
19# (either by being compiled in or available as a kld(4) module),
20# otherwise the target 'release.8' and possibly others will fail.
21#
22# Note: If you add options to this file, please keep release(7) updated!
23#
24# Set these, release builder!
25#
26# Fixed version:
27#BUILDNAME=9.0-CURRENT
28#
29# Automatic SNAP versioning:
30DATE != date +%Y%m%d
31BASE = 9.0
32BUILDNAME?=${BASE}-${DATE}-SNAP
33#
34#CHROOTDIR=/junk/release
35# If this is a -stable snapshot, then set
36#RELEASETAG=RELENG_8
37#
38# To test a release with a source tree containing patches and
39# other work. This tree will get copied instead of getting the
40# src/ tree from a CVS checkout. For "rerelease", this will NOT
41# be copied; cvs update will be used instead.
42#EXTSRCDIR=/usr/src
43#
44# To use a checked-out ports collection directory instead of
45# checking out from a local CVS repository, set this option.
46#EXTPORTSDIR=/usr/ports
47#
48# To use a checked-out doc/ directory instead of
49# checking out from a local CVS repository, set this option.
50#EXTDOCDIR=/usr/doc
51#
52# To add other options to the CVS subcommands (co,up), set
53#CVSCMDARGS="-D '01/01/2002 00:00:00 UTC'"
54#
55# To add other options to the CVS command, set
56#CVSARGS="-lfq"
57#
58# To prefix the CVS command
59#CVSPREFIX="/usr/bin/time"
60#
61# Where the CVS repository is
62#CVSROOT="/home/ncvs"
63#
64# To add other options to the Subversion subcommands (co,up), set
65#SVNCMDARGS="-r '{ 01/01/2002 00:00:00 UTC }'"
66#
67# To prefix the Subversion command
68#SVNPREFIX="/usr/bin/time"
69#
70# Where the Subversion repository is
71#SVNROOT=svn://svn.freebsd.org/base
72#
73# Subversion branch to build for src.  If this is not set then it is
74# automatically computed from RELEASETAG.
75#SVNBRANCH=stable/8
76#
77# Non-zero if ${RELEASETAG} is in the form "RELENG_ver_RELEASE"; we
78# are building an official release.  Otherwise, we are building for
79# a branch.
80.if defined(RELEASETAG)
81ISRELEASE!=	expr "${RELEASETAG}" : '^RELENG_.*_RELEASE$$' || true
82.if ${ISRELEASE} != 0
83# Convert "RELENG_ver_RELEASE" to "RELEASE_ver" for ports and doc trees.
84AUXRELEASETAG!=	echo ${RELEASETAG} | sed -e 's/^RELENG_/RELEASE_/' -e 's/_RELEASE$$//'
85DOCRELEASETAG?=		${AUXRELEASETAG}
86PORTSRELEASETAG?=	${AUXRELEASETAG}
87.endif
88.endif
89
90# Determine the Subversion source branch that corresponds to the requested
91# RELEASETAG.
92.if !defined(SVNBRANCH)
93.if defined(RELEASETAG)
94SVNBRANCH!=	echo "${RELEASETAG}" | awk -f ${.CURDIR}/svnbranch.awk
95.else
96SVNBRANCH=	head
97.endif
98.endif
99
100# If you want to pass flags to the world build such as -j X, use
101# WORLD_FLAGS.  Similarly, you can specify make flags for kernel
102# builds via KERNEL_FLAGS.
103#WORLD_FLAGS=-j4
104#KERNEL_FLAGS=-j4
105
106TARGET_ARCH?=	${MACHINE_ARCH}
107.if ${TARGET_ARCH} == ${MACHINE_ARCH}
108TARGET?=	${MACHINE}
109.else
110TARGET?=	${TARGET_ARCH}
111.endif
112CROSSENV=	TARGET_ARCH=${TARGET_ARCH} TARGET=${TARGET}
113CROSSMAKE=	${MAKE} ${CROSSENV}
114NATIVEMAKE=	${MAKE} TARGET_ARCH=${MACHINE_ARCH} TARGET=${MACHINE}
115
116# If you are using a local CVS repository with components stored in 
117# non-standard modules, override these on the make commandline or
118# in the environment.
119RELEASESRCMODULE?=	src
120RELEASEDOCMODULE?=	doc
121RELEASEPORTSMODULE?=	ports
122
123# Uncomment this to disable the doc.1 target.  Docs normally require
124# the ports tree, so NOPORTS can be set together with NODOC in order
125# to have neither ports or docs.  If only NOPORTS is set to YES, but
126# docs are still desired, the DOMINIMALDOCPORTS logic below will only
127# install the ports that are minimally required for the release note documentation.  This is
128# intended as a compromise, less disk space is required than for using
129# the entire ports collection (and much less time due to the huge number
130# of directories it would create), but still quite a bit as well as some
131# CPU cycles (some of the programs are C++, and things like ghostscript
132# belong to the required ports nevertheless).
133#
134#NODOC=  YES
135#NOPORTS=  YES
136
137# When retrieving ports using the pkg_add -r method, set your proxies to these.
138# src/release/${arch}/mkisoimages.sh can use these.
139#HTTP_PROXY?=	www.example.com
140#FTP_PROXY?=	ftp.example.com
141
142# When creating ISO images, point ${CD_PACKAGE_TREE} to a directory containing
143# the package split by an earlier invocation of the 'package-split' target.
144#CD_PACKAGE_TREE=	/path/to/pkg
145
146# Extra source tarballs; each argument is a pair of source dir and
147# distribution name.  The dist name should not exceed 7 characters
148# (another "s" for "source" will be prepended).
149#EXTRA_SRC=	games/fortune fortune
150
151# Modify this definition if you want the release notes 
152# and other release documentation in a language other than English.
153RELNOTES_LANG?=	en_US.ISO8859-1
154
155# As an alternative to installing the entire ports collection (which
156# can take a huge amount of time, in particular on slower disks),
157# setting ${MINIMALDOCPORTS} allows to install and build just those
158# ports that are really required for getting the docs up & running.
159.if defined(NOPORTS) && !defined(NODOC)
160DOMINIMALDOCPORTS=	YES
161.include "Makefile.inc.docports"
162RELEASEPORTSMODULE=	${MINIMALDOCPORTS} ports/sysutils/cdrtools
163.endif
164
165# Helper variable
166.if defined(NOPORTS)
167.if !defined(DOMINIMALDOCPORTS) || ${DOMINIMALDOCPORTS} != "YES"
168NOPORTSATALL=	YES
169.endif
170.endif
171
172#
173# Doing 'make index' in /usr/ports requires Perl.
174MAKEINDEXPORTS=	lang/perl5.10
175DOCPORTS=	textproc/docproj
176# Set this to wherever the distfiles required by release procedures.
177.if defined(DOCDISTFILES)
178# Respect DOCDISTFILES which is used before.
179RELEASEDISTFILES?=	${DOCDISTFILES}
180.else
181RELEASEDISTFILES?=	${.CURDIR}/../../ports/distfiles
182.endif
183# Set this to 1 if you want -P to be used for automatic keyboard detection
184# on the boot floppy.  WARNING: Breaks on some Athlon (K7) motherboards.
185AUTO_KEYBOARD_DETECT?= 0
186
187.if !defined(NODOC)
188DIST_DOCS_ARCH_INDEP=	hardware readme relnotes errata
189DIST_DOCS_ARCH_DEP=	
190.endif
191
192# Things which without too much trouble can be considered variables
193# BASE_DISTS are special in that they get full /etc installation sets.
194#
195OTHER_DISTS?=	catpages manpages games proflibs dict info doc ${ARCH_DISTS}
196BASE_DISTS?=	base
197.if ${TARGET_ARCH} == "amd64"
198ARCH_DISTS?=	lib32
199.endif
200DISTRIBUTIONS?=	${BASE_DISTS} ${OTHER_DISTS}
201
202#
203# Build and package both GENERIC and SMP kernels if the target
204# has both configuration files.  Otherwise only GENERIC is done.
205#
206.if ${TARGET_ARCH} == "powerpc64"
207KERN_GENERIC?=	GENERIC64
208.else
209KERN_GENERIC?=	GENERIC
210.endif
211
212.if exists(${.CURDIR}/../sys/${TARGET}/conf/SMP)
213KERNELS_BASE?=	${KERN_GENERIC} SMP
214.else
215KERNELS_BASE?=	${KERN_GENERIC}
216.endif
217
218# mountpoint for filesystems.
219MNT=			/mnt
220
221# Various floppy image parameters.
222#
223
224.undef MAKE_FLOPPIES
225.if ${TARGET_ARCH} == "i386"
226MAKE_DVD=
227SEPARATE_LIVEFS=
228SPLIT_MFSROOT=
229.if ${TARGET} == "pc98"
230MAKE_FLOPPIES=		true
231SMALLFLOPPYSIZE=	1200
232SMALLFLOPPYSPLITSIZE=	1152
233SMALLFLOPPYLABEL=	fd1200
234SPLIT_MFSROOT=
235.endif
236FLOPPYSIZE=		1440
237FLOPPYSPLITSIZE=	1392
238FLOPPYINODE=		40000
239FLOPPYLABEL=		fd1440
240BOOTINODE=		80000
241MFSSIZE=		4320
242MFSINODE=		8000
243MFSLABEL=		minimum3
244.elif ${TARGET_ARCH} == "sparc64"
245DISKLABEL=		sunlabel
246MAKE_DVD=
247MFSSIZE=		4096
248MFSINODE=		8192
249MFSLABEL=		auto
250MINIROOT=
251SEPARATE_LIVEFS=
252.elif ${TARGET_ARCH} == "ia64"
253DISKLABEL=		""
254MAKE_DVD=
255MFSSIZE=		8192
256MFSINODE=		8192
257MFSLABEL=		auto
258SEPARATE_LIVEFS=
259.elif ${TARGET_ARCH} == "amd64"
260MAKE_DVD=
261FLOPPYSIZE=		1440
262FLOPPYSPLITSIZE=	1392
263FLOPPYINODE=		40000
264FLOPPYLABEL=		fd1440
265BOOTINODE=		80000
266MFSSIZE=		4096
267MFSINODE=		8192
268MFSLABEL=		auto
269SEPARATE_LIVEFS=
270SPLIT_MFSROOT=
271.elif ${TARGET_ARCH} == "powerpc"
272DISKLABEL=		""
273MFSSIZE=		4096
274MFSINODE=		8192
275MFSLABEL=		auto
276SEPARATE_LIVEFS=
277.endif
278.if defined(NO_FLOPPIES)
279.undef MAKE_FLOPPIES
280.endif
281
282.if exists(/sbin/bsdlabel)
283DISKLABEL?=		bsdlabel
284.else
285DISKLABEL?=		disklabel
286.endif
287
288ZIPPER=			gzip -9 --no-name
289ZIPNSPLIT=		${ZIPPER} -c | split -b 1392k -
290
291# Things which may get you into trouble if you change them
292MTREEFILES=		${.CURDIR}/../etc/mtree
293_R?=			/R
294RD=			${_R}/stage
295RND=			${RD}/release.doc
296FD=			${_R}/ftp
297CD=			${_R}/cdrom
298CD_BOOT=		${CD}/bootonly
299CD_DISC1=		${CD}/disc1
300CD_DISC2=		${CD}/disc2
301.if defined(MAKE_DVD)
302CD_DVD1=		${CD}/dvd1
303.endif
304.if !defined(NODOC)
305CD_DOCS=		${CD}/docs
306.endif
307.if defined(SEPARATE_LIVEFS)
308CD_LIVEFS=		${CD}/livefs
309.else
310CD_LIVEFS=		${CD_DISC1}
311.endif
312_MK?=			${CHROOTDIR}/mk
313
314# Where the bootstrap ports (see DOCPORTS) get installed.
315LOCALDIR=		/usr/local/bin
316
317.if ${TARGET} != ${MACHINE} && ${DISKLABEL} == "bsdlabel"
318DOFS_SH=	${.CURDIR}/scripts/doFS.sh ${DISKLABEL} ${TARGET}
319.else
320DOFS_SH=	${.CURDIR}/scripts/doFS.sh ${DISKLABEL} ""
321.endif
322
323CRUNCH_TARGETS=	boot
324.if ${TARGET_ARCH} == "i386"
325CRUNCH_TARGETS+=fixit
326.if ${TARGET} == "pc98"
327CRUNCH_TARGETS+=fixit-small
328.endif
329.endif
330
331.if defined(MAKE_FLOPPIES)
332EXTRAS= floppies.1
333.if ${TARGET_ARCH} == "i386"
334EXTRAS+= floppies.2
335.endif
336EXTRAS+= floppies.3
337.endif
338EXTRAS+= ftp.1
339.if !defined(NOCDROM)
340EXTRAS+= cdrom.1 cdrom.2 cdrom.3
341.if defined(MAKE_ISOS)
342EXTRAS+= iso.1
343.endif
344.if ${TARGET} == "pc98"
345BOOTABLE="-G"
346.else
347BOOTABLE="-b"
348.endif
349.endif
350
351.if !defined(NODOC)
352DOCREL= doc.1 doc.2
353.endif
354
355.if !make(release) && !make(rerelease) && !make(package-split)
356BINMAKE!=	cd ${.CURDIR}/..; ${MAKE} -V BINMAKE
357WMAKEENV!=	cd ${.CURDIR}/..; \
358		${BINMAKE} ${CROSSENV} -f Makefile.inc1 -V WMAKEENV
359WMAKE=		${WMAKEENV} ${BINMAKE}
360.endif
361
362CVS_SRCARGS=	-P
363.if defined(RELEASETAG)
364CVS_SRCARGS+=	-r ${RELEASETAG}
365.endif
366
367CVS_DOCARGS=	-P
368.if defined(DOCRELEASETAG)
369CVS_DOCARGS+=	-r ${DOCRELEASETAG}
370.endif
371
372CVS_PORTSARGS=	-P
373.if defined(PORTSRELEASETAG)
374CVS_PORTSARGS+=	-r ${PORTSRELEASETAG}
375.endif
376
377WORLDDIR?=	${.CURDIR}/..
378
379release rerelease:
380.if !defined(CHROOTDIR) || !defined(BUILDNAME)
381	@echo "To make a release you must set CHROOTDIR and BUILDNAME" && false
382.endif
383.if !defined(NOPORTSATALL) && !defined(EXTPORTSDIR) && !defined(CVSROOT)
384	@echo "Building ports requires CVSROOT or EXTPORTSDIR" && false
385.endif
386.if !defined(NODOC) && !defined(EXTDOCDIR) && !defined(CVSROOT)
387	@echo "Building docs requires CVSROOT or EXTDOCDIR" && false
388.endif
389.if !defined(EXTSRCDIR) && !defined(CVSROOT) && !defined(SVNROOT)
390	@echo "The source tree requires SVNROOT, CVSROOT, or EXTSRCDIR" && false
391.endif
392.if defined(NOPORTSATALL) && !defined(NODOC)
393	@echo "Ports are required for building the release docs.  Either set NODOC or"
394	@echo "unset NOPORTS, or set at least DOMINIMALDOCPORTS to YES!"
395	@exit 1
396.endif
397.if defined(LOCAL_PATCHES) && !empty(LOCAL_PATCHES)
398.for p in ${LOCAL_PATCHES}
399.if !exists(${p})
400	@echo "The patch file ${p} does not exist!"
401	@exit 1
402.endif
403.endfor
404.endif
405.if defined(LOCAL_SCRIPT) && !exists(${LOCAL_SCRIPT})
406	@echo "The local script ${LOCAL_SCRIPT} does not exist!"
407	@exit 1
408.endif
409.if make(release)
410.if exists(${CHROOTDIR})
411# The first command will fail on a handful of files that have their schg
412# flags set.  But it greatly speeds up the next two commands.
413	# NB: clear any vestigial devfs mount, just in case
414	-umount ${CHROOTDIR}/dev > /dev/null 2>&1
415	-rm -rf ${CHROOTDIR} 2>/dev/null
416	-chflags -R 0 ${CHROOTDIR}/.
417	-rm -rf ${CHROOTDIR}
418.endif
419	mkdir -p ${CHROOTDIR}
420	@echo ">>> make release for ${TARGET} started on `LC_ALL=C TZ=GMT date`"
421	cd ${WORLDDIR} && ${NATIVEMAKE} -DWITHOUT_GAMES -DWITHOUT_HTML -DWITHOUT_LIB32 \
422	    -DWITHOUT_MAN -DWITHOUT_NLS -DWITHOUT_PROFILE installworld DESTDIR=${CHROOTDIR}
423	cd ${WORLDDIR} && ${NATIVEMAKE} distribution DESTDIR=${CHROOTDIR}
424	if [ -f /etc/resolv.conf ]; then \
425		cp -p /etc/resolv.conf ${CHROOTDIR}/etc; \
426	fi
427.if defined(EXTLOCALDIR)
428	rm -rf ${CHROOTDIR}/usr/local
429	cd ${CHROOTDIR}/usr && cp -R -H ${EXTLOCALDIR} local
430.endif
431	rm -rf ${CHROOTDIR}/usr/src
432.if defined(EXTSRCDIR)
433	cd ${CHROOTDIR}/usr && \
434	    cp -R -H ${EXTSRCDIR} src
435.elif defined(SVNROOT)
436	cd ${CHROOTDIR}/usr && \
437	    ${SVNPREFIX} svn co ${SVNCMDARGS} ${SVNROOT}/${SVNBRANCH} \
438	    ${RELEASESRCMODULE} 
439.else
440	cd ${CHROOTDIR}/usr && \
441	    ${CVSPREFIX} cvs -R ${CVSARGS} -d ${CVSROOT} \
442	    co ${CVSCMDARGS} ${CVS_SRCARGS} ${RELEASESRCMODULE}
443.endif
444.if defined(LOCAL_PATCHES) && !empty(LOCAL_PATCHES)
445.for p in ${LOCAL_PATCHES}
446	patch -d ${CHROOTDIR}/usr/${RELEASESRCMODULE} ${PATCH_FLAGS} < ${p}
447.endfor
448.endif
449.if defined(LOCAL_SCRIPT)
450	cd ${CHROOTDIR} && env CHROOTDIR=${CHROOTDIR} BUILDNAME=${BUILDNAME} \
451	    RELEASETAG=${RELEASETAG} ${LOCAL_SCRIPT}
452.endif
453	rm -rf ${CHROOTDIR}/usr/ports
454.if !defined(NOPORTSATALL)
455.if defined(EXTPORTSDIR)
456	cd ${CHROOTDIR}/usr && cp -R -H ${EXTPORTSDIR} ports
457	# If there are distfiles downloaded removing them
458	rm -rf ports/distfiles/*
459.else
460	cd ${CHROOTDIR}/usr && ${CVSPREFIX} cvs -R ${CVSARGS} -d ${CVSROOT} \
461	    co ${CVSCMDARGS} ${CVS_PORTSARGS} ${RELEASEPORTSMODULE}
462.endif
463.endif
464.if !defined(NODOC)
465	rm -rf ${CHROOTDIR}/usr/doc
466.if defined(EXTDOCDIR)
467	cd ${CHROOTDIR}/usr && cp -R -H ${EXTDOCDIR} doc
468.else
469	cd ${CHROOTDIR}/usr && ${CVSPREFIX} cvs -R ${CVSARGS} -d ${CVSROOT} \
470	    co ${CVSCMDARGS} ${CVS_DOCARGS} ${RELEASEDOCMODULE}
471.endif
472	if [ -d ${RELEASEDISTFILES}/ ]; then \
473		cp -rp ${RELEASEDISTFILES} ${CHROOTDIR}/usr/ports/distfiles; \
474	else \
475		mkdir -p ${CHROOTDIR}/usr/ports/distfiles; \
476	fi
477.if !defined(NO_PREFETCHDISTFILES)
478	@cd ${.CURDIR} && ${MAKE} fetch-distfiles
479.endif
480.endif
481.endif
482.if make(rerelease)
483.if !defined(RELEASENOUPDATE) && !defined(EXTSRCDIR)
484.if defined(SVNROOT)
485	cd ${CHROOTDIR}/usr/src && ${SVNPREFIX} svn switch ${SVNCMDARGS} \
486	    ${SVNROOT}/${SVNBRANCH}
487.elif !defined(RELEASETAG)
488	cd ${CHROOTDIR}/usr/src && ${CVSPREFIX} cvs -R ${CVSARGS} -q \
489	    update ${CVSCMDARGS} -P -d -A
490.else
491	cd ${CHROOTDIR}/usr/src && ${CVSPREFIX} cvs -R ${CVSARGS} -q \
492	    update ${CVSCMDARGS} -P -d -r ${RELEASETAG}
493.endif
494	rm -f ${CHROOTDIR}/tmp/.world_done 
495.if !defined(NOPORTS) && !defined(EXTPORTSDIR)
496	cd ${CHROOTDIR}/usr/ports && ${CVSPREFIX} cvs -R ${CVSARGS} -q \
497	    update ${CVSCMDARGS} -P -d
498	rm -f ${CHROOTDIR}/tmp/.skip_ports_index
499.endif
500.if defined(DOMINIMALDOCPORTS) && ${DOMINIMALDOCPORTS} == "YES"
501	for i in ${MINIMALDOCPORTS}; do \
502	    ( cd ${CHROOTDIR}/usr/$$i && ${CVSPREFIX} cvs -R ${CVSARGS} -q \
503		update ${CVSCMDARGS} -P -d ) ; \
504	done
505.endif
506.if !defined(NODOC)
507	cd ${CHROOTDIR}/usr/doc && ${CVSPREFIX} cvs -R ${CVSARGS} -q \
508	    update ${CVSCMDARGS} -P -d
509.endif
510.endif
511.endif
512	# Add version information to those things that need it.
513	if [ ! -f ${CHROOTDIR}/tmp/.world_done ]; then \
514		cd ${CHROOTDIR}/usr/src/sys/conf && \
515		mv newvers.sh foo && \
516		sed "s/^RELEASE=.*/RELEASE=${BUILDNAME}/" foo > newvers.sh && \
517		rm foo; \
518	fi
519	-test -f install.cfg && cp install.cfg ${CHROOTDIR}/usr/src/release
520	echo "#!/bin/sh"			> ${_MK}
521	echo "set -ex"				>> ${_MK}
522	echo "trap 'umount /dev || true' 0"	>> ${_MK}
523	echo "_RELTARGET=\$${1:-doRELEASE}"	>> ${_MK}
524.for var in \
525	AUTO_KEYBOARD_DETECT \
526	BUILDNAME \
527	CD_PACKAGE_TREE \
528	DISTRIBUTIONS \
529	DOMINIMALDOCPORTS \
530	EXTRA_SRC \
531	FTP_PASSIVE_MODE \
532	FTP_PROXY \
533	HTTP_PROXY \
534	KERNELS \
535	KERNELS_BASE \
536	KERNEL_FLAGS \
537	MAKE_DVD \
538	MAKE_FLOPPIES \
539	MAKE_ISOS \
540	NOCDROM \
541	NODOC \
542	NOPORTS \
543	NO_SHARED \
544	NOSRC \
545	NO_CPU_CFLAGS \
546	NO_CPU_COPTFLAGS \
547	NO_FLOPPIES \
548	RELEASETAG \
549	RELNOTES_LANG \
550	SEPARATE_LIVEFS \
551	TARGET \
552	TARGET_ARCH \
553	WORLD_FLAGS
554.if defined(${var})
555	echo "export ${var}=\"${${var}}\""	>> ${_MK}
556.endif
557.endfor
558	# Don't remove this, or the build will fall over!
559	echo "export RELEASEDIR=${_R}"		>> ${_MK}
560	echo "export PATH=/bin:/usr/bin:/sbin:/usr/sbin:${LOCALDIR}"	>> ${_MK}
561	echo "export MANBUILDCAT=YES"		>> ${_MK}
562	# NB: these may fail if the host is running w/o devfs
563	echo "umount /dev >/dev/null 2>&1 || true" >> ${_MK}
564	echo "mount -t devfs devfs /dev >/dev/null 2>&1 || true"	>> ${_MK}
565	echo "if [ ! -c /dev/null ]; then" >> ${_MK}
566	echo "	echo /dev/null is not a device!" >> ${_MK}
567	echo "	exit 1" >> ${_MK}
568	echo "fi" >> ${_MK}
569	echo "if [ -x /etc/rc.d/ldconfig ]; then" >> ${_MK}
570	echo "	/etc/rc.d/ldconfig start"	>> ${_MK}
571	echo "else"				>> ${_MK}
572	echo "	ldconfig /lib /usr/lib /usr/local/lib || true" >> ${_MK}
573	echo "fi"				>> ${_MK}
574	echo "if [ ! -f /tmp/.world_done ]; then" >> ${_MK}
575	echo "	cd /usr/src"			>> ${_MK}
576	echo "	${CROSSMAKE} ${WORLD_FLAGS} -DNO_CLEAN buildworld && \\" >> ${_MK}
577	echo "	touch /tmp/.world_done || exit 1" >> ${_MK}
578	echo "fi"				>> ${_MK}
579	echo "if [ ! -f /tmp/.skip_ports_index ]; then" >> ${_MK}
580	echo "	echo \">>> make index started on \`LC_ALL=C TZ=GMT date\`\"" >> ${_MK}
581	echo "	for i in ${MAKEINDEXPORTS}"	>> ${_MK}
582	echo "	do"			>> ${_MK}
583	echo "		cd /usr/ports/\$${i}"	>> ${_MK}
584	echo "		env -i HTTP_PROXY=$${HTTP_PROXY} FTP_PROXY=$${FTP_PROXY} FTP_PASSIVE_MODE=$${FTP_PASSIVE_MODE:-no} PATH=$${PATH} \\" >> ${_MK}
585	echo "		make all install clean BATCH=yes FORCE_PKG_REGISTER=yes" >> ${_MK}
586	echo "	done"				>> ${_MK}
587	echo "	cd /usr/ports"			>> ${_MK}
588	echo "	rm -f INDEX*"			>> ${_MK}
589	echo "	make index -DINDEX_PRISTINE"	>> ${_MK}
590	echo "	rm -f INDEX*.tmp"		>> ${_MK}
591	echo "	touch /tmp/.skip_ports_index"	>> ${_MK}
592	echo "	echo \">>> make index finished on \`LC_ALL=C TZ=GMT date\`\"" >> ${_MK}
593	echo "fi"				>> ${_MK}
594	echo "cd /usr/src/release"		>> ${_MK}
595	echo "make obj"				>> ${_MK}
596	echo "make \$${_RELTARGET}"		>> ${_MK}
597	echo "echo \">>> make ${.TARGET} for ${TARGET} finished on \`LC_ALL=C TZ=GMT date\`\"" >> ${_MK}
598	chmod 755 ${_MK}
599.if defined(NOPORTS)
600	touch ${CHROOTDIR}/tmp/.skip_ports_index
601.endif
602	# Ensure md.ko is loaded if md(4) is not statically compiled into 
603	# the kernel
604	-mdconfig 2>/dev/null
605	env -i /usr/sbin/chroot `dirname ${_MK}` /`basename ${_MK}`
606
607clean:
608	rm -rf ${CRUNCH_TARGETS:S/$/_crunch/} release.[0-8] ${EXTRAS}
609
610fetch-distfiles:
611	@for i in ${MAKEINDEXPORTS}; do \
612		cd ${CHROOTDIR}/usr/ports/$$i && \
613			make PORTSDIR=${CHROOTDIR}/usr/ports BATCH=yes \
614			checksum-recursive ; \
615	done
616	@for i in ${DOCPORTS}; do \
617		cd ${CHROOTDIR}/usr/ports/$$i && \
618			make PORTSDIR=${CHROOTDIR}/usr/ports BATCH=yes \
619			WITHOUT_X11=yes JADETEX=no WITHOUT_PYTHON=yes \
620			checksum-recursive ; \
621	done
622
623# Clean out ${_R} and make the directory structure.
624release.1:
625	mkdir -p ${_R}
626	-rm -rf ${_R}/* 2> /dev/null
627	-chflags -R noschg ${_R}/.
628	rm -rf ${_R}/*
629	mkdir ${RD}
630.if defined(MAKE_FLOPPIES)
631	mkdir ${RD}/floppies
632.endif
633	mkdir ${RD}/trees
634	for i in ${DISTRIBUTIONS}; do \
635		mkdir ${RD}/trees/$$i && \
636		mtree -deU -f ${MTREEFILES}/BSD.root.dist \
637		    -p ${RD}/trees/$$i > /dev/null && \
638		mtree -deU -f ${MTREEFILES}/BSD.usr.dist \
639		    -p ${RD}/trees/$$i/usr > /dev/null && \
640		mtree -deU -f ${MTREEFILES}/BSD.include.dist \
641		    -p ${RD}/trees/$$i/usr/include > /dev/null && \
642		mtree -deU -f ${MTREEFILES}/BSD.var.dist \
643		    -p ${RD}/trees/$$i/var > /dev/null ; \
644	done
645	mkdir ${RD}/kernels
646	for i in ${KERNELS_BASE} ${KERNELS}; do \
647		mkdir -p ${RD}/kernels/$${i}; \
648	done
649	touch ${.TARGET}
650
651# Install the system into the various distributions.
652release.2:
653	cd ${.CURDIR}/.. && ${CROSSMAKE} distrib-dirs DESTDIR=${RD}/trees/base
654	cd ${.CURDIR}/.. && ${CROSSMAKE} ${WORLD_FLAGS} distributeworld \
655	    DISTDIR=${RD}/trees
656	sh ${.CURDIR}/scripts/mm-mtree.sh -F "${CROSSENV}" -D "${RD}/trees/base"
657	touch ${.TARGET}
658
659# Make and install the generic kernel(s).
660release.3:
661.for kernel in ${KERNELS_BASE} ${KERNELS}
662	cd ${.CURDIR}/..; \
663	${CROSSMAKE} ${KERNEL_FLAGS} \
664 	    KERNCONF=${kernel} kernel \
665 	    DESTDIR=${RD}/kernels KODIR=/${kernel}
666.endfor
667	touch ${.TARGET}
668
669# Make and install the three crunched binaries which live on the floppies.
670# You are not supposed to like this :-)
671release.4:
672	rm -rf ${RD}/crunch
673	mkdir -p ${RD}/crunch
674.for j in ${CRUNCH_TARGETS}
675.if exists(${.CURDIR}/${TARGET}/${j}_crunch.conf)
676	rm -rf ${j}_crunch
677	mkdir ${j}_crunch
678	cd ${j}_crunch; ${WMAKEENV} MAKEFLAGS="-m ${.CURDIR}/../share/mk" \
679	    NO_WERROR= crunchgen -o \
680	    ${.CURDIR}/${TARGET}/${j}_crunch.conf
681	cd ${j}_crunch; ${WMAKE} -f ${j}_crunch.mk subclean
682	cd ${.CURDIR}/..; ${BINMAKE} -f Makefile.inc1 _build-tools
683	cd ${j}_crunch; CFLAGS="-Os -pipe" ${WMAKE} -f ${j}_crunch.mk \
684	    -DNO_CPU_CFLAGS all
685	${WMAKEENV} strip -R .comment ${j}_crunch/${j}_crunch
686	mv ${j}_crunch/${j}_crunch ${RD}/crunch/${j}
687.endif
688.endfor
689	touch ${.TARGET}
690
691#
692# --==## Fix up the distributions. ##==--
693#
694release.5:
695	# Create any "synthetic dists" now.
696	@for i in ${DISTRIBUTIONS}; do \
697		if [ -f ${.CURDIR}/scripts/$${i}-make.sh ]; then \
698			echo -n "Running $$i dist creation script... "; \
699			env RD=${RD} sh ${.CURDIR}/scripts/$${i}-make.sh || echo "$$i distribution script returned bad status."; \
700			echo "Done."; \
701		fi \
702	done \
703
704	# Remove all the directories we don't need.
705	-cd ${RD}/trees && \
706		(find ${OTHER_DISTS} -path '*/var/empty' | xargs chflags noschg; \
707		find ${OTHER_DISTS} -depth -type d -empty -delete)
708	touch ${.TARGET}
709
710#
711# --==## Package up the tarballs from assembled trees ##==--
712#
713release.6:
714	rm -rf ${RD}/dists
715	mkdir -p ${RD}/dists
716	@for i in ${DISTRIBUTIONS} ; \
717	do \
718		if [ -d ${RD}/trees/$${i} ] ; then \
719			cd ${.CURDIR} && $(MAKE) doTARBALL \
720				SD=${RD}/trees/$${i} \
721				TN=$$i TD=$$i ARG="." && \
722			echo "$${i} distribution is finished."; \
723		fi ; \
724	done
725	@for i in ${KERNELS_BASE} ${KERNELS} ; \
726	do \
727		if [ -d ${RD}/kernels/$${i} ] ; then \
728			cd ${.CURDIR} && $(MAKE) doTARBALL \
729				SD=${RD}/kernels \
730				TN=$$i TD=kernels ARG="$$i" && \
731			echo "$${i} distribution is finished."; \
732		fi ; \
733	done
734.if !defined(NOPORTS)
735	# XXX: Inline stripped version of doTARBALL
736	@rm -rf ${RD}/dists/ports/ports*
737	@mkdir -p ${RD}/dists/ports
738	@echo rolling ports/ports tarball
739	@tar --exclude CVS --exclude .svn --exclude 'ports/distfiles/*' \
740	  -czf ${RD}/dists/ports/ports.tgz -C /usr ports
741	@cp ${.CURDIR}/scripts/ports-install.sh ${RD}/dists/ports/install.sh
742	@(cd ${RD}/dists/ports; \
743	  rm -f CHECKSUM.MD5 CHECKSUM.SHA256; \
744	  md5 * > .CHECKSUM.MD5; \
745	  sha256 * > .CHECKSUM.SHA256; \
746	  mv .CHECKSUM.MD5 CHECKSUM.MD5; \
747	  mv .CHECKSUM.SHA256 CHECKSUM.SHA256)
748	@echo "ports distribution is finished."
749.endif
750	touch ${.TARGET}
751
752
753#
754# --==## Make source dists ##==--
755#
756release.7:
757.if !defined(NOSRC)
758	@cd ${.CURDIR} && $(MAKE) doTARBALL SD=/usr/src \
759		TD=src TN=sbase ARG="[A-Z]*"
760	@for i in `cd /usr/src && echo [a-z]*` ; do \
761		if [ -d /usr/src/$$i ] ; then \
762			cd ${.CURDIR} && $(MAKE) doTARBALL \
763				TN=`echo s$$i | tr -d '.' | \
764				    sed -e 's/usr/u/' \
765					-e 's/kerberos5/krb5/'` \
766				SD=/usr/src TD=src ARG="$$i" ; \
767		fi ; \
768	done
769.if defined(EXTRA_SRC)
770	@set ${EXTRA_SRC} && \
771	while [ $$# -ge 2 ] ; do \
772		if [ -d /usr/src/$$1 ] ; then \
773			cd ${.CURDIR} && $(MAKE) doTARBALL \
774				SD=/usr/src TN="s$$2" TD=src ARG="$$1" ; \
775		fi && shift && shift ; \
776	done
777.endif
778	(cd ${RD}/dists/src; \
779	  rm -f CHECKSUM.MD5 CHECKSUM.SHA256; \
780	  md5 * > .CHECKSUM.MD5; \
781	  sha256 * > .CHECKSUM.SHA256; \
782	  mv .CHECKSUM.MD5 CHECKSUM.MD5; \
783	  mv .CHECKSUM.SHA256 CHECKSUM.SHA256)
784	@echo "src distribution is finished."
785.endif
786	touch ${.TARGET}
787
788# Build the memory root filesystem.
789release.8:
790	cp ${RD}/trees/base/etc/disktab /etc
791	rm -rf ${RD}/mfsfd
792	mkdir ${RD}/mfsfd
793	cd ${RD}/mfsfd && \
794		mkdir -p etc/defaults dev mnt stand/etc/defaults stand/help \
795		var/empty
796	@cd ${.CURDIR} && $(MAKE) installCRUNCH CRUNCH=boot \
797		DIR=${RD}/mfsfd/stand ZIP=false
798	( cd ${RD}/mfsfd && \
799	  for dir in bin sbin ; do \
800		ln -sf /stand $$dir; \
801	  done )
802	cp ${RD}/trees/base/sbin/dhclient-script ${RD}/mfsfd/stand
803	cp ${.CURDIR}/../etc/master.passwd ${RD}/mfsfd/etc/master.passwd
804	cp ${RD}/trees/base/etc/*pwd.db ${RD}/mfsfd/etc/
805	( for F in defaults/rc.conf netconfig protocols ; do \
806		sed -e '/^#.*$$/d' -e 's/[:space:]*#.*$$//g' \
807		${RD}/trees/base/etc/$$F > ${RD}/mfsfd/stand/etc/$$F ; \
808	  done )
809	grep -E '^(ftp|nameserver|domain|sunrpc|cmd|nfsd)[^-\w]' \
810	    ${RD}/trees/base/etc/services | \
811	    sed -e '/^#.*$$/d' -e 's/[:space:]*#.*$$//g' \
812	    > ${RD}/mfsfd/stand/etc/services
813	grep 'operator' ${RD}/trees/base/etc/group \
814	    > ${RD}/mfsfd/stand/etc/group
815	ln ${RD}/mfsfd/stand/etc/services ${RD}/mfsfd/etc/services
816	ln ${RD}/mfsfd/stand/etc/group ${RD}/mfsfd/etc/group
817	ln ${RD}/mfsfd/stand/etc/netconfig ${RD}/mfsfd/etc/netconfig
818	cp ${RD}/trees/base/COPYRIGHT ${RD}/mfsfd/stand/help/COPYRIGHT.hlp
819.if !defined(NODOC)
820	@for i in ${DIST_DOCS_ARCH_INDEP}; do \
821	  cp ${RND}/${RELNOTES_LANG}/$$i/article.txt \
822	      ${RD}/mfsfd/stand/help/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
823	done
824	@for i in ${DIST_DOCS_ARCH_DEP}; do \
825	  cp ${RND}/${RELNOTES_LANG}/$$i/${TARGET}/article.txt \
826	      ${RD}/mfsfd/stand/help/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
827	done
828.endif
829	-test -f ${.CURDIR}/install.cfg \
830	    && cp ${.CURDIR}/install.cfg ${RD}/mfsfd
831	@mkdir -p ${RD}/mfsfd/boot
832.if ${TARGET_ARCH} != "ia64" && ${TARGET_ARCH} != "powerpc"
833	@cp ${RD}/trees/base/boot/boot* ${RD}/mfsfd/boot
834.endif
835.if ${TARGET} == "i386" || ${TARGET_ARCH} == "amd64"
836	@cp ${RD}/trees/base/boot/mbr ${RD}/mfsfd/boot
837.endif
838	@tar --exclude CVS --exclude .svn -cf - \
839		-C ${.CURDIR}/../usr.sbin/sysinstall help | \
840		tar xf - -C ${RD}/mfsfd/stand
841	@mkdir -p ${RD}/mfsroot
842	sh -e ${DOFS_SH} ${RD}/mfsroot/mfsroot ${RD} ${MNT} \
843	    ${MFSSIZE} ${RD}/mfsfd ${MFSINODE} ${MFSLABEL}
844	@${ZIPPER} -fv ${RD}/mfsroot/mfsroot
845	touch ${.TARGET}
846
847KERNFLOPPYSET=		${RD}/floppyset/kern/kernel.gz
848.if defined(SMALLFLOPPYSIZE)
849SMALLKERNFLOPPYSET=	${RD}/floppyset/kern-small/kernel.gz
850.endif
851.if defined(SPLIT_MFSROOT)
852MFSROOTFLOPPYSET=	${RD}/floppyset/mfsroot/mfsroot.gz
853.if defined(SMALLFLOPPYSIZE)
854SMALLMFSROOTFLOPPYSET=	${RD}/floppyset/mfsroot-small/mfsroot.gz
855.endif
856.endif
857
858# Build boot and install floppies.
859floppies.1:
860	@${ZIPPER} -c ${RD}/kernels/${KERN_GENERIC}/kernel > ${RD}/kernels/kernel.gz
861	@echo "Making the kernel boot floppies..."
862	@cd ${.CURDIR} && ${MAKE} makeFloppySet FLOPPYBASE=kern \
863	    FLOPPYDESC="Kernel" SPLITFILE=${RD}/kernels/kernel.gz
864.if defined(SMALLFLOPPYSIZE)
865	@echo "Making the small kernel boot floppies..."
866	@cd ${.CURDIR} && ${MAKE} makeFloppySet FLOPPYBASE=kern-small \
867	    FLOPPYDESC="Kernel" SPLITFILE=${RD}/kernels/kernel.gz \
868	    FDSIZE="SMALL"
869.endif
870.if defined(SPLIT_MFSROOT)
871	@echo "Making the mfsroot boot floppies..."
872	@cd ${.CURDIR} && ${MAKE} makeFloppySet FLOPPYBASE=mfsroot \
873	    FLOPPYDESC="Memory Filesystem" SPLITFILE=${RD}/mfsroot/mfsroot.gz
874.if defined(SMALLFLOPPYSIZE)
875	@echo "Making the small mfsroot boot floppies..."
876	@cd ${.CURDIR} && ${MAKE} makeFloppySet FLOPPYBASE=mfsroot-small \
877	    FLOPPYDESC="Memory Filesystem" SPLITFILE=${RD}/mfsroot/mfsroot.gz \
878	    FDSIZE="SMALL"
879.endif
880	@cd ${.CURDIR} && ${MAKE} buildBootFloppy FSIMAGE="boot" \
881	    KERNFILE="${KERNFLOPPYSET}.split ${KERNFLOPPYSET}.boot" \
882	    MFSROOTFILE="${MFSROOTFLOPPYSET}.split ${MFSROOTFLOPPYSET}.boot"
883.if defined(SMALLFLOPPYSIZE)
884	@cd ${.CURDIR} && ${MAKE} buildBootFloppy FSIMAGE="boot-small" \
885	    KERNFILE="${SMALLKERNFLOPPYSET}.split ${SMALLKERNFLOPPYSET}.boot" \
886	    MFSROOTFILE="${SMALLMFSROOTFLOPPYSET}.split ${SMALLMFSROOTFLOPPYSET}.boot" \
887	    FDSIZE="SMALL"
888.endif
889.else	# !SPLIT_MFSROOT
890	@cd ${.CURDIR} && ${MAKE} buildBootFloppy FSIMAGE="boot" \
891	    KERNFILE="${KERNFLOPPYSET}.split ${KERNFLOPPYSET}.boot" \
892	    MFSROOTFILE=${RD}/mfsroot/mfsroot.gz
893.if defined(SMALLFLOPPYSIZE)
894	@cd ${.CURDIR} && ${MAKE} buildBootFloppy FSIMAGE="boot-small" \
895	    KERNFILE="${SMALLKERNFLOPPYSET}.split ${SMALLKERNFLOPPYSET}.boot" \
896	    MFSROOTFILE=${RD}/mfsroot/mfsroot.gz \
897	    FDSIZE="SMALL"
898.endif
899.endif	# SPLIT_MFSROOT
900	touch ${.TARGET}
901
902# Build fixit floppy.
903floppies.2:
904	@echo "Making fixit floppy."
905	@rm -rf ${RD}/fixitfd
906	@mkdir ${RD}/fixitfd
907	@cd ${RD}/fixitfd && \
908	    mkdir -p dev stand bin sbin etc mnt mnt1 mnt2 mnt3 mnt4 tmp \
909	    usr/share/misc
910	@cp ${RD}/trees/base/etc/spwd.db ${RD}/trees/base/etc/group \
911	    ${RD}/fixitfd/etc
912	@sed -e 's/#.*//' ${RD}/trees/base/etc/protocols \
913	    > ${RD}/fixitfd/etc/protocols
914	@sed -e 's/#.*//' ${RD}/trees/base/usr/share/misc/scsi_modes \
915	    > ${RD}/fixitfd/usr/share/misc/scsi_modes
916	@cp ${.CURDIR}/fixit.profile ${RD}/fixitfd/.profile
917	@cp ${.CURDIR}/fixit.services ${RD}/fixitfd/etc/services
918	@cp ${.CURDIR}/scripts/tar.sh ${RD}/fixitfd/stand/tar
919	@chmod 555 ${RD}/fixitfd/stand/tar
920.if defined(SMALLFLOPPYSIZE)
921	@cd ${.CURDIR} && ${MAKE} installCRUNCH CRUNCH=fixit-small \
922	    DIR=${RD}/fixitfd/stand ZIP=false
923	@sh -e ${DOFS_SH} ${RD}/floppies/fixit-small.flp ${RD} ${MNT} \
924	    ${SMALLFLOPPYSIZE} ${RD}/fixitfd ${FLOPPYINODE} ${SMALLFLOPPYLABEL}
925	@rm -rf ${RD}/fixitfd/stand
926	@mkdir ${RD}/fixitfd/stand
927.endif
928	@cd ${.CURDIR} && ${MAKE} installCRUNCH CRUNCH=fixit \
929	    DIR=${RD}/fixitfd/stand ZIP=false
930	@sh -e ${DOFS_SH} ${RD}/floppies/fixit.flp ${RD} ${MNT} \
931	    ${FLOPPYSIZE} ${RD}/fixitfd ${FLOPPYINODE} ${FLOPPYLABEL}
932	touch ${.TARGET}
933
934# Do our last minute floppies directory setup
935floppies.3:
936	@(cd ${RD}/floppies; md5 *.flp > CHECKSUM.MD5)
937	@(cd ${RD}/floppies; sha256 *.flp > CHECKSUM.SHA256)
938	touch ${.TARGET}
939
940#
941# --==## Setup a suitable ftp-area ##==--
942#
943ftp.1:
944	@echo "Setting up FTP distribution area"
945	@mkdir -p ${FD}
946	-@ln -s . ${FD}/${BUILDNAME}
947.if defined(MAKE_FLOPPIES)
948	@cd ${RD} && find floppies -print | cpio -dumpl ${FD}
949.endif
950	@cd ${RD}/dists && find . -print | cpio -dumpl ${FD}
951.if !defined(NODOC)
952	@for i in ${DIST_DOCS_ARCH_INDEP}; do \
953		cp ${RND}/${RELNOTES_LANG}/$$i/article.txt \
954		    ${FD}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
955		cp ${RND}/${RELNOTES_LANG}/$$i/article.html \
956		    ${FD}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \
957	done
958	@for i in ${DIST_DOCS_ARCH_DEP}; do \
959		cp ${RND}/${RELNOTES_LANG}/$$i/${TARGET}/article.txt \
960		    ${FD}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
961		cp ${RND}/${RELNOTES_LANG}/$$i/${TARGET}/article.html \
962		    ${FD}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \
963	done
964	@cp ${RND}/${RELNOTES_LANG}/readme/docbook.css ${FD}
965.endif
966	@echo "CD_VERSION = ${BUILDNAME}" > ${FD}/cdrom.inf
967	touch ${.TARGET}
968
969# Build a live filesystem cdrom image
970cdrom.1:
971	@echo "Building CDROM live filesystem image"
972	@mkdir -p ${CD_LIVEFS}
973	@for i in ${DISTRIBUTIONS} ; \
974	do \
975		if [ -d ${RD}/trees/$${i} ] ; then \
976			chflags -R noschg ${RD}/trees/$${i} || true ; \
977			( cd ${RD}/trees/$${i} && \
978			    find . -depth -print | cpio -dumpl ${CD_LIVEFS} ) ; \
979		fi \
980	done
981.if defined(MAKE_DVD)
982	@echo "Building DVD filesystem image as well as CDROM"
983	@mkdir -p ${CD_DVD1}/${BUILDNAME}
984	@for i in ${DISTRIBUTIONS} ; \
985	do \
986		if [ -d ${RD}/trees/$${i} ] ; then \
987			chflags -R noschg ${RD}/trees/$${i} || true ; \
988			( cd ${RD}/trees/$${i} && \
989			    find . -depth -print | cpio -dumpl ${CD_DVD1} ) ; \
990		fi \
991	done
992.endif
993	@echo "Copy GENERIC kernel to boot area"
994	@cp -Rp ${RD}/kernels/${KERN_GENERIC}/ ${CD_LIVEFS}/boot/kernel
995	@rm -f ${CD_LIVEFS}/boot/kernel/*.symbols
996	@rm -f ${CD_LIVEFS}/.profile
997	@cp ${.CURDIR}/fixit.profile ${CD_LIVEFS}/.profile
998	@ln -sf /rescue ${CD_LIVEFS}/stand
999	@echo "Setting up CDROM boot area"
1000	@rm -f ${CD_LIVEFS}/boot/loader.conf
1001	@cp ${RD}/mfsroot/mfsroot.gz ${CD_LIVEFS}/boot/mfsroot.gz
1002	@echo 'mfsroot_load="YES"' > ${CD_LIVEFS}/boot/loader.conf
1003	@echo 'mfsroot_type="mfs_root"' >> ${CD_LIVEFS}/boot/loader.conf
1004	@echo 'mfsroot_name="/boot/mfsroot"' >> ${CD_LIVEFS}/boot/loader.conf
1005.if exists(${RD}/trees/base/boot/device.hints)
1006	# Break the link to device.hints so we can modify it
1007	@rm -f ${CD_LIVEFS}/boot/device.hints
1008	@cp ${RD}/trees/base/boot/device.hints ${CD_LIVEFS}/boot/device.hints
1009.endif
1010	@echo "CD_VERSION = ${BUILDNAME}" > ${CD_LIVEFS}/cdrom.inf
1011.if defined(MAKE_DVD)
1012	@cp -Rp ${RD}/kernels/${KERN_GENERIC}/ ${CD_DVD1}/boot/kernel
1013	@rm -f ${CD_DVD1}/boot/kernel/*.symbols
1014	@rm -f ${CD_DVD1}/.profile
1015	@cp ${.CURDIR}/fixit.profile ${CD_DVD1}/.profile
1016	@ln -sf /rescue ${CD_DVD1}/stand
1017	@echo "CD_VERSION = ${BUILDNAME}" > ${CD_DVD1}/cdrom.inf
1018	@rm -f ${CD_DVD1}/boot/loader.conf
1019	@cp ${RD}/mfsroot/mfsroot.gz ${CD_DVD1}/boot/mfsroot.gz
1020	@echo 'mfsroot_load="YES"' > ${CD_DVD1}/boot/loader.conf
1021	@echo 'mfsroot_type="mfs_root"' >> ${CD_DVD1}/boot/loader.conf
1022	@echo 'mfsroot_name="/boot/mfsroot"' >> ${CD_DVD1}/boot/loader.conf
1023.if exists(${RD}/trees/base/boot/device.hints)
1024	@rm -f ${CD_DVD1}/boot/device.hints
1025	@cp ${RD}/trees/base/boot/device.hints ${CD_DVD1}/boot/device.hints
1026.endif
1027.endif
1028	touch ${.TARGET}
1029
1030# Build disc1 and disc2 cdrom images
1031cdrom.2:
1032	@echo "Building CDROM disc1 filesystem image"
1033	@mkdir -p ${CD_DISC1}/${BUILDNAME}
1034.if defined(MAKE_FLOPPIES)
1035	@cd ${RD} && find floppies -print | cpio -dumpl ${CD_DISC1}
1036.endif
1037	@cd ${RD}/dists && find . -print | cpio -dumpl ${CD_DISC1}/${BUILDNAME}
1038.if !defined(NODOC)
1039	@for i in ${DIST_DOCS_ARCH_INDEP}; do \
1040	  cp ${RND}/${RELNOTES_LANG}/$$i/article.txt \
1041	      ${CD_DISC1}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
1042	  cp ${RND}/${RELNOTES_LANG}/$$i/article.html \
1043	      ${CD_DISC1}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \
1044	done
1045	@for i in ${DIST_DOCS_ARCH_DEP}; do \
1046	  cp ${RND}/${RELNOTES_LANG}/$$i/${TARGET}/article.txt \
1047	      ${CD_DISC1}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
1048	  cp ${RND}/${RELNOTES_LANG}/$$i/${TARGET}/article.html \
1049	      ${CD_DISC1}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \
1050	done
1051	@cp ${RND}/${RELNOTES_LANG}/readme/docbook.css ${CD_DISC1}
1052.endif
1053.if defined(SEPARATE_LIVEFS)
1054	@cp -Rp ${CD_LIVEFS}/boot ${CD_DISC1}
1055	@echo "CD_VERSION = ${BUILDNAME}" > ${CD_DISC1}/cdrom.inf
1056.endif
1057	@echo "CD_VOLUME = 1" >> ${CD_DISC1}/cdrom.inf
1058	@echo "Building CDROM disc2 filesystem image"
1059	@mkdir -p ${CD_DISC2}
1060	@echo "CD_VERSION = ${BUILDNAME}" > ${CD_DISC2}/cdrom.inf
1061	@echo "CD_VOLUME = 2" >> ${CD_DISC2}/cdrom.inf
1062.if defined(MAKE_DVD)
1063.if defined(MAKE_FLOPPIES)
1064	@cd ${RD} && find floppies -print | cpio -dumpl ${CD_DVD1}
1065.endif
1066	@cd ${RD}/dists && find . -print | cpio -dumpl ${CD_DVD1}/${BUILDNAME}
1067.if !defined(NODOC)
1068	@for i in ${DIST_DOCS_ARCH_INDEP}; do \
1069	  cp ${RND}/${RELNOTES_LANG}/$$i/article.txt \
1070	      ${CD_DVD1}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
1071	  cp ${RND}/${RELNOTES_LANG}/$$i/article.html \
1072	      ${CD_DVD1}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \
1073	done
1074	@for i in ${DIST_DOCS_ARCH_DEP}; do \
1075	  cp ${RND}/${RELNOTES_LANG}/$$i/${TARGET}/article.txt \
1076	      ${CD_DVD1}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
1077	  cp ${RND}/${RELNOTES_LANG}/$$i/${TARGET}/article.html \
1078	      ${CD_DVD1}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \
1079	done
1080	@cp ${RND}/${RELNOTES_LANG}/readme/docbook.css ${CD_DVD1}
1081.endif
1082	@echo "CD_VERSION = ${BUILDNAME}" > ${CD_DVD1}/cdrom.inf
1083	@echo "CD_VOLUME = 1" >> ${CD_DVD1}/cdrom.inf
1084.endif
1085.if !defined(NODOC)
1086	@echo "Building CDROM docs filesystem image"
1087	@mkdir -p ${CD_DOCS}
1088	@echo "CD_VERSION = ${BUILDNAME}" > ${CD_DOCS}/cdrom.inf
1089	@echo "CD_VOLUME = 3" >> ${CD_DOCS}/cdrom.inf
1090.endif
1091	touch ${.TARGET}
1092
1093#
1094# --==## Setup a suitable cdrom-area ##==--
1095#
1096cdrom.3:
1097.if defined(CD_BOOT)
1098	@echo "Building bootonly CDROM filesystem image"
1099	@mkdir -p ${CD_BOOT}
1100	@cp -Rp ${CD_LIVEFS}/boot ${CD_BOOT}
1101	@echo "CD_VERSION = ${BUILDNAME}" > ${CD_BOOT}/cdrom.inf
1102.if defined(MINIROOT)
1103	@echo "Building bootonly UFS filesystem image"
1104	@mkdir -p ${FD}/miniroot
1105	@sh -e ${DOFS_SH} ${FD}/miniroot/miniroot.ufs \
1106	    ${RD} ${MNT} 0 ${CD_BOOT} 8192 auto
1107	@${ZIPPER} -v ${FD}/miniroot/miniroot.ufs
1108.endif
1109.endif
1110	touch ${.TARGET}
1111
1112.if make(iso.1)
1113.if defined(CD_PACKAGE_TREE)
1114.if exists(${CD_PACKAGE_TREE}/disc1)
1115CD_DISC1_PKGS=	${CD_PACKAGE_TREE}/disc1
1116.endif
1117.if exists(${CD_PACKAGE_TREE}/disc2)
1118CD_DISC2_PKGS=	${CD_PACKAGE_TREE}/disc2
1119.endif
1120# scripts/package-trees.sh names all discs according to the "discX"
1121# scheme where X is the number of the disc
1122.if exists(${CD_PACKAGE_TREE}/disc3)
1123CD_DOCS_PKGS=	${CD_PACKAGE_TREE}/disc3
1124.endif
1125.if exists(${CD_PACKAGE_TREE}/dvd1)
1126CD_DVD1_PKGS=	${CD_PACKAGE_TREE}/dvd1
1127.endif
1128.endif
1129.endif
1130
1131iso.1:
1132.if exists(${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh)
1133	@echo "Creating ISO images..."
1134.if defined(CD_BOOT)
1135	@sh ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh ${BOOTABLE} \
1136	    FreeBSD_bootonly \
1137	    ${CD}/FreeBSD-${BUILDNAME}-${TARGET}-bootonly.iso ${CD_BOOT}
1138.endif
1139	@sh ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh ${BOOTABLE} \
1140	    FreeBSD_Install \
1141	    ${CD}/FreeBSD-${BUILDNAME}-${TARGET}-disc1.iso ${CD_DISC1} \
1142	    ${CD_DISC1_PKGS}
1143	@sh ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh \
1144	    FreeBSD_Packages \
1145	    ${CD}/FreeBSD-${BUILDNAME}-${TARGET}-disc2.iso ${CD_DISC2} \
1146	    ${CD_DISC2_PKGS}
1147.if defined(MAKE_DVD)
1148	@sh ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh ${BOOTABLE} \
1149	    FreeBSD_Install \
1150	    ${CD}/FreeBSD-${BUILDNAME}-${TARGET}-dvd1.iso ${CD_DVD1} \
1151	    ${CD_DVD1_PKGS}
1152.endif
1153.if !defined(NODOC)
1154	@sh ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh \
1155	    FreeBSD_Documentation \
1156	    ${CD}/FreeBSD-${BUILDNAME}-${TARGET}-disc3.iso ${CD_DOCS} \
1157	    ${CD_DOCS_PKGS}
1158.endif
1159.if defined(SEPARATE_LIVEFS)
1160	@sh ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh ${BOOTABLE} \
1161	    FreeBSD_LiveFS \
1162	    ${CD}/FreeBSD-${BUILDNAME}-${TARGET}-livefs.iso ${CD_LIVEFS}
1163.endif
1164	@echo "Generating MD5 and SHA256 sums..."
1165	@(cd ${CD} && md5 *.iso > FreeBSD-${BUILDNAME}-${TARGET}-iso.CHECKSUM.MD5)
1166	@(cd ${CD} && sha256 *.iso > FreeBSD-${BUILDNAME}-${TARGET}-iso.CHECKSUM.SHA256)
1167	touch ${.TARGET}
1168.else
1169	@echo "Do not know how to create an ISO for ${TARGET_ARCH}."
1170.endif
1171
1172#
1173# --==## Documentation Project tools required to build the release notes ##==--
1174#
1175doc.1:
1176	@echo "Making docproj tools..."
1177	@for i in ${DOCPORTS}; do \
1178	    cd /usr/ports/$$i && \
1179	    env -i FTP_PASSIVE_MODE=$${FTP_PASSIVE_MODE:-no} PATH=$${PATH} \
1180		make all install clean BATCH=yes WITHOUT_X11=yes JADETEX=no \
1181		WITHOUT_PYTHON=yes FORCE_PKG_REGISTER=yes; \
1182	done
1183	touch ${.TARGET}
1184
1185#
1186# --==## RELNOTESng:  Next-generation replacements for *.TXT files ##==--
1187#
1188doc.2:
1189	@echo "Making release documentation..."
1190	@cd ${.CURDIR}/doc && make all install clean 'FORMATS=html txt' \
1191	    INSTALL_COMPRESSED='' URLS_ABSOLUTE=YES DOCDIR=${RND}
1192	touch ${.TARGET}
1193
1194# Various "subroutine" and other supporting targets.
1195
1196# RD=
1197# SD=
1198# TD=
1199# ARG=
1200doTARBALL:
1201.if !defined(SD)
1202	@echo "SD undefined in doTARBALL" && exit 1
1203.endif
1204.if !defined(TD)
1205	@echo "TD undefined in doTARBALL" && exit 1
1206.endif
1207.if !defined(ARG)
1208	@echo "ARG undefined in doTARBALL" && exit 1
1209.endif
1210	@rm -rf ${RD}/dists/${TD}/${TN}*
1211	@mkdir -p ${RD}/dists/${TD}
1212	@( cd ${SD} && \
1213		tn=`echo ${TN} | tr 'A-Z' 'a-z'` && \
1214		echo rolling ${TD}/$$tn tarball &&\
1215		tar --exclude CVS --exclude .svn --exclude obj --exclude BOOTMFS -cf - ${ARG} | \
1216		${ZIPNSPLIT} ${RD}/dists/${TD}/$$tn. && \
1217		sh ${.CURDIR}/scripts/info.sh ${RD}/dists/${TD}/$$tn \
1218		    > ${RD}/dists/${TD}/$$tn.inf && \
1219		if [ -f ${.CURDIR}/scripts/$${TD}-install.sh ]; then \
1220			cp -p ${.CURDIR}/scripts/$${TD}-install.sh \
1221			    ${RD}/dists/${TD}/install.sh && \
1222			chmod +x ${RD}/dists/${TD}/install.sh; \
1223		fi && \
1224		if [ "${SD}" != "/usr/src" ]; then \
1225			mtree -c -i -p ${SD}/${ARG} \
1226			  -k gname,md5digest,mode,nlink,uname,size,link,type \
1227			  > ${RD}/dists/${TD}/$$tn.mtree ; \
1228		else \
1229			true; \
1230		fi; \
1231		( cd ${RD}/dists/${TD}; \
1232		rm -f CHECKSUM.MD5 CHECKSUM.SHA256; \
1233		md5 * > .CHECKSUM.MD5; \
1234		sha256 * > .CHECKSUM.SHA256; \
1235		mv .CHECKSUM.MD5 CHECKSUM.MD5; \
1236		mv .CHECKSUM.SHA256 CHECKSUM.SHA256) \
1237	)
1238
1239doRELEASE: release.1 release.2 ${DOCREL} release.3 release.4 \
1240    release.5 release.6 release.7 release.8 ${EXTRAS}
1241	@echo "Release done"
1242
1243floppies:
1244	@rm -f release.4 release.8 floppies.[123]
1245	@cd ${.CURDIR} && ${MAKE} release.4 release.8 floppies.1 floppies.2 \
1246	    floppies.3
1247	@cd ${RD} && find floppies -print | cpio -dumpl ${FD}
1248
1249installCRUNCH:
1250.if !defined(CRUNCH)
1251	@echo "CRUNCH undefined in installCRUNCH" && exit 1
1252.endif
1253.if !defined(DIR)
1254	@echo "DIR undefined in installCRUNCH" && exit 1
1255.endif
1256.if !defined(ZIP)
1257	@echo "ZIP undefined in installCRUNCH" && exit 1
1258.endif
1259	@if ${ZIP} ; then \
1260		${ZIPPER} < ${RD}/crunch/${CRUNCH} > ${DIR}/${CRUNCH}_crunch ; \
1261	else \
1262		ln -f ${RD}/crunch/${CRUNCH} ${DIR}/${CRUNCH}_crunch ; \
1263	fi
1264	@chmod 555 ${DIR}/${CRUNCH}_crunch
1265	@if [ -f ${.CURDIR}/${TARGET}/${CRUNCH}_crunch.conf ] ; then \
1266		for i in `crunchgen -l ${.CURDIR}/${TARGET}/${CRUNCH}_crunch.conf` ; do \
1267			ln -f ${DIR}/${CRUNCH}_crunch ${DIR}/$$i ; \
1268		done \
1269	else \
1270		for i in `crunchgen -l ${.CURDIR}/${CRUNCH}_crunch.conf` ; do \
1271			ln -f ${DIR}/${CRUNCH}_crunch ${DIR}/$$i ; \
1272		done \
1273	fi
1274
1275#
1276# --==## Build a floppy set for a splitfs file ##==--
1277#
1278# FLOPPYBASE - basename of floppy image files
1279# FLOPPYDESC - description of floppy set
1280# SPLITFILE - filename of the file to split
1281# FDSIZE - if specified and "small", small floppy is created
1282
1283.if make(makeFloppySet)
1284SPLITDIR=	${RD}/floppyset/${FLOPPYBASE}
1285.if defined(FDSIZE) && ${FDSIZE} == "SMALL"
1286FLPSPLITSIZE=	${SMALLFLOPPYSPLITSIZE}
1287FLPSIZE=	${SMALLFLOPPYSIZE}
1288FLPLABEL=	${SMALLFLOPPYLABEL}
1289.else
1290FLPSPLITSIZE=	${FLOPPYSPLITSIZE}
1291FLPSIZE=	${FLOPPYSIZE}
1292FLPLABEL=	${FLOPPYLABEL}
1293.endif
1294.endif
1295
1296makeFloppySet:
1297.if !defined(FLOPPYBASE)
1298	@echo "FLOPPYBASE undefined in ${.TARGET}" && exit 1
1299.endif
1300.if !defined(FLOPPYDESC)
1301	@echo "FLOPPYDESC undefined in ${.TARGET}" && exit 1
1302.endif
1303.if !defined(SPLITFILE)
1304	@echo "SPLITFILE undefined in ${.TARGET}" && exit 1
1305.endif
1306	sh ${.CURDIR}/scripts/split-file.sh ${SPLITFILE} \
1307	    ${RD}/floppyset/${FLOPPYBASE} ${FLPSPLITSIZE} "${FLOPPYDESC}"
1308	( splitfile=${SPLITDIR}/`basename ${SPLITFILE}`.split ; \
1309	lines=`cat $${splitfile} | wc -l`; \
1310	lines=$$(($$lines - 1)) ; \
1311	for line in `jot $$lines`; do \
1312		file=`head -n $$(($${line} + 1)) $${splitfile} | tail -1 | cut -f 1 -d ' '` ; \
1313		sh -e ${DOFS_SH} ${RD}/floppies/${FLOPPYBASE}$${line}.flp \
1314		${RD} ${MNT} ${FLPSIZE} ${SPLITDIR}/$${file} \
1315		${BOOTINODE} ${FLPLABEL}; \
1316	done )
1317
1318#
1319# --==## Build a boot floppy ##==--
1320#
1321# FSIMAGE - base floppy image name
1322# FDSIZE - if specified and "small", small floppy is created
1323# KERNFILE - path to kernel split file
1324# MFSROOTFILE - path to mfsroot split file
1325
1326.if make(buildBootFloppy)
1327IMAGEDIR=	${RD}/image.${FSIMAGE}
1328BOOTDIR=	${RD}/trees/base/boot
1329HINTSFILE=	${BOOTDIR}/device.hints
1330ACPI_KO=	${RD}/kernels/${KERN_GENERIC}/acpi.ko
1331IMAGEFILE=	${RD}/floppies/${FSIMAGE}.flp
1332.if defined(FDSIZE) && ${FDSIZE} == "SMALL"
1333FLPSIZE=	${SMALLFLOPPYSIZE}
1334FLPLABEL=	${SMALLFLOPPYLABEL}
1335.else
1336FLPSIZE=	${FLOPPYSIZE}
1337FLPLABEL=	${FLOPPYLABEL}
1338.endif
1339.endif
1340
1341buildBootFloppy:
1342.if !defined(FSIMAGE)
1343	@echo "FSIMAGE undefined in ${.TARGET}" && exit 1
1344.endif
1345.if !defined(KERNFILE)
1346	@echo "KERNFILE undefined in ${.TARGET}" && exit 1
1347.endif
1348.if !defined(MFSROOTFILE)
1349	@echo "MFSROOTFILE undefined in ${.TARGET}" && exit 1
1350.endif
1351	@echo "Running ${.TARGET} for ${FSIMAGE}"
1352	@rm -rf ${IMAGEDIR}
1353	@mkdir ${IMAGEDIR}
1354	@echo "Setting up /boot directory for ${FSIMAGE} floppy"
1355	@mkdir -p ${IMAGEDIR}/boot
1356.if ${TARGET_ARCH} == "i386"
1357	@${WMAKEENV} kgzip -v -l ${RD}/trees/base/usr/lib/kgzldr.o -o \
1358	    ${IMAGEDIR}/boot/loader ${BOOTDIR}/loader
1359.else
1360	@cp ${BOOTDIR}/loader ${IMAGEDIR}/boot
1361.endif
1362	@cp -Rp ${BOOTDIR}/*.4th ${BOOTDIR}/defaults ${BOOTDIR}/loader.help \
1363	    ${BOOTDIR}/loader.rc ${IMAGEDIR}/boot
1364.if exists(${HINTSFILE})
1365	@cp ${HINTSFILE} ${IMAGEDIR}/boot/device.hints
1366	@${ZIPPER} ${IMAGEDIR}/boot/device.hints
1367.endif
1368	@${ZIPPER} ${IMAGEDIR}/boot/*.4th ${IMAGEDIR}/boot/loader.help \
1369	    ${IMAGEDIR}/boot/defaults/loader.conf
1370	@echo 'bootfile="/kernel"' > ${IMAGEDIR}/boot/loader.conf
1371.if exists(${ACPI_KO})
1372	@${ZIPPER} -c ${ACPI_KO} > ${IMAGEDIR}/acpi.ko.gz
1373	@echo 'acpi_load="YES"' >> ${IMAGEDIR}/boot/loader.conf
1374	@echo 'acpi_name="/acpi.ko"' >> ${IMAGEDIR}/boot/loader.conf
1375	@echo 'acpi_before="read -p \"Insert boot floppy and press Enter\""' >> ${IMAGEDIR}/boot/loader.conf
1376.endif
1377	@echo 'mfsroot_load="YES"' >> ${IMAGEDIR}/boot/loader.conf
1378	@echo 'mfsroot_type="mfs_root"' >> ${IMAGEDIR}/boot/loader.conf
1379	@echo 'mfsroot_name="/mfsroot"' >> ${IMAGEDIR}/boot/loader.conf
1380.if !exists(${ACPI_KO})
1381	@echo 'mfsroot_before="read -p \"Insert boot floppy and press Enter\""' >> ${IMAGEDIR}/boot/loader.conf
1382.endif
1383.if defined(SPLIT_MFSROOT)
1384	@echo 'mfsroot_after="read -p \"Insert boot floppy and press Enter\""' >> ${IMAGEDIR}/boot/loader.conf
1385.endif
1386.if ${TARGET_ARCH} == "i386" || ${TARGET_ARCH} == "amd64"
1387.if ${AUTO_KEYBOARD_DETECT}
1388	@echo "-P" >> ${IMAGEDIR}/boot.config
1389.endif
1390.endif
1391	@rm -f ${IMAGEFILE}
1392	@cp ${KERNFILE} ${MFSROOTFILE} ${IMAGEDIR}
1393	sh -e ${DOFS_SH} ${IMAGEFILE} ${RD} ${MNT} ${FLPSIZE} ${IMAGEDIR} \
1394	    ${BOOTINODE} ${FLPLABEL}
1395	@echo "Created ${RD}/floppies/${FSIMAGE}.flp"
1396
1397.if make(package-split)
1398# Targets related to making a package split
1399#
1400# PKG_COPY instructs the script to copy the actual package files rather than
1401#     make hard links
1402# PKG_TREE is the path to the package tree to be split
1403# PKG_DEST is the path to the destination tree to create the split in
1404# PKG_VERBOSE asks for verbose output of the layout process
1405# PKG_INDEX is the path to the INDEX file. By default ${PKG_TREE}/INDEX.
1406
1407.if defined(PKG_COPY)
1408PKG_DO_COPY=	cp
1409.else
1410PKG_DO_COPY=	ln
1411.endif
1412PKG_WRKIDX=	${PKG_DEST}/INDEX.master
1413PKG_ENV?=
1414.if defined(TARGET_ARCH)
1415PKG_ENV+=	PKG_ARCH=${TARGET_ARCH}
1416.endif
1417.if defined(PKG_VERBOSE)
1418PKG_ENV+=	PKG_VERBOSE=1
1419.endif
1420PKG_INDEX?=	${PKG_TREE}/INDEX
1421
1422package-split:
1423.if !defined(PKG_TREE)
1424	@echo "PKG_TREE must be defined" && exit 1
1425.endif
1426.if !defined(PKG_DEST)
1427	@echo "PKG_DEST must be defined" && exit 1
1428.endif
1429	@env ${PKG_ENV} python ${.CURDIR}/scripts/package-split.py \
1430	    ${PKG_INDEX} ${PKG_WRKIDX}
1431	@env ${PKG_ENV} sh ${.CURDIR}/scripts/package-trees.sh ${PKG_DO_COPY} \
1432	    ${PKG_WRKIDX} ${PKG_TREE} ${PKG_DEST}
1433.endif
1434
1435.include <bsd.obj.mk>
1436