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