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