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