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