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