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