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