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