]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - release/Makefile
This commit was generated by cvs2svn to compensate for changes in r108794,
[FreeBSD/FreeBSD.git] / release / Makefile
1 # $FreeBSD$
2 #
3 # make release CHROOTDIR=/some/dir BUILDNAME=somename 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 compiled into your kernel
13 # or available as a kld(4)-style kernel module,
14 # otherwise the target 'release.9' and possibly others will fail.
15 #
16 # Note:  "/some/dir" cannot reside on a filesystem mounted with
17 # the "nodev" option, otherwise the chrooted "buildworld" will likely
18 # fail.
19 #
20 # Note: If you add options to this file, please keep release(7) updated!
21 #
22 # Set these, release builder!
23 #
24 # Fixed version:
25 #BUILDNAME=5.0-RELEASE
26 #
27 # Automatic SNAP versioning:
28 DATE != date +%Y%m%d
29 BASE = 5.0
30 BUILDNAME?=${BASE}-${DATE}-SNAP
31 #
32 #CHROOTDIR=/junk/release
33 # If this is a -stable snapshot, then set
34 #RELEASETAG=RELENG_4
35 #
36 # To add other options to the CVS subcommands (co,up), set
37 #CVSCMDARGS="-D '01/01/2002 00:00:00 UTC'"
38 #
39 # To add other options to the CVS command, set
40 #CVSARGS="-lfq"
41 #
42 # To prefix the cvs command
43 #CVSPREFIX="/usr/bin/time"
44 #
45 # Non-zero if ${RELEASETAG} is in the form "RELENG_ver_RELEASE"; we
46 # are building an official release.  Otherwise, we are building for
47 # a branch.
48 .if defined(RELEASETAG)
49 ISRELEASE!=     expr "${RELEASETAG}" : '^RELENG_.*_RELEASE$$' || true
50 .if ${ISRELEASE} != 0
51 # Convert "RELENG_ver_RELEASE" to "RELEASE_ver" for ports and doc trees.
52 AUXRELEASETAG!= echo ${RELEASETAG} | sed -e 's/^RELENG_/RELEASE_/' -e 's/_RELEASE$$//'
53 DOCRELEASETAG?=         ${AUXRELEASETAG}
54 PORTSRELEASETAG?=       ${AUXRELEASETAG}
55 .endif
56 .endif
57
58 # If you want to pass flags to the world build such as -j X, use
59 # WORLD_FLAGS.  Similarly, you can specify make flags for kernel
60 # builds via KERNEL_FLAGS.
61 #WORLD_FLAGS=-j4
62 #KERNEL_FLAGS=-j4
63
64 TARGET_ARCH?=   ${MACHINE_ARCH}
65 .if ${TARGET_ARCH} == ${MACHINE_ARCH}
66 TARGET?=        ${MACHINE}
67 .else
68 TARGET?=        ${TARGET_ARCH}
69 .endif
70 CROSSMAKE=      ${MAKE} TARGET_ARCH=${TARGET_ARCH} TARGET=${TARGET}
71 NATIVEMAKE=     ${MAKE} TARGET_ARCH=${MACHINE_ARCH} TARGET=${MACHINE}
72
73 # If you are using a local CVS repository with components stored in 
74 # non-standard modules, override these on the make commandline or
75 # in the environment.
76 RELEASESRCMODULE?=      src
77 RELEASEDOCMODULE?=      doc
78 RELEASEPORTSMODULE?=    ports
79
80 # Uncomment this to disable the doc.1 target.  Docs normally require
81 # the ports tree, so NOPORTS can be set together with NODOC in order
82 # to have neither ports or docs.  If only NOPORTS is set to YES, but
83 # docs are still desired, the DOMINIMALDOCPORTS logic below will only
84 # install the ports that are minimally required for the docs.  This is
85 # intended as a compromise, less disk space is required than for using
86 # the entire ports collection (and much less time due to the huge number
87 # of directories it would create), but still quite a bit as well as some
88 # CPU cycles (some of the programs are C++, and things like ghostscript
89 # belong to the required ports nevertheless).
90 #
91 # Setting this also disables building of release note documentation
92 # (RELNOTESng).
93 #NODOC=  YES
94 #NOPORTS=  YES
95
96 # Modify this definition if you want the release notes 
97 # and other release documentation in a language other than English.
98 RELNOTES_LANG?= en_US.ISO8859-1
99
100 # As an alternative to installing the entire ports collection (which
101 # can take a huge amount of time, in particular on slower disks),
102 # setting ${MINIMALDOCPORTS} allows to install and build just those
103 # ports that are really required for getting the docs up & running.
104 .if defined(NOPORTS) && !defined(NODOC)
105 DOMINIMALDOCPORTS=      YES
106 .include "Makefile.inc.docports"
107 RELEASEPORTSMODULE=     ${MINIMALDOCPORTS}
108 .endif
109
110 # Helper variable
111 .if defined(NOPORTS)
112 .if !defined(DOMINIMALDOCPORTS) || ${DOMINIMALDOCPORTS} != "YES"
113 NOPORTSATALL=   YES
114 .endif
115 .endif
116
117 # By default, documentation (Handbook, FAQ, etc.) is built for all
118 # the languages.  To speed up building, set the DOC_LANG to just
119 # the languages you need.  (The language for the release notes is
120 # controlled by the RELNOTES_LANG variable above.)
121 #DOC_LANG=      en_US.ISO8859-1
122 DOCPORTS=       textproc/docproj
123 # Set this to wherever the distfiles required by release procedures.
124 .if defined(DOCDISTFILES)
125 # Respect DOCDISTFILES which is used before.
126 RELEASEDISTFILES?=      ${DOCDISTFILES}
127 .else
128 RELEASEDISTFILES?=      ${.CURDIR}/../../ports/distfiles
129 .endif
130 # Set this to 1 if you want -P to be used for automatic keyboard detection
131 # on the boot floppy.  WARNING: Breaks on some Athlon (K7) motherboards.
132 AUTO_KEYBOARD_DETECT?= 0
133
134 .if !defined(NODOC)
135 DIST_DOCS_ARCH_INDEP=   readme errata early-adopter
136 DIST_DOCS_ARCH_DEP=     installation relnotes hardware
137 .endif
138
139 # Things which without too much trouble can be considered variables
140 # BASE_DISTS are special in that they get full /etc installation sets.
141 #
142 .if ${TARGET_ARCH} == "i386"
143 COMPAT_DISTS?=  compat1x compat20 compat21 compat22 compat3x compat4x
144 .elif ${TARGET_ARCH} != "ia64"
145 COMPAT_DISTS?=  compat4x
146 .endif
147 OTHER_DISTS?=   catpages manpages games proflibs dict info doc
148 CRYPTO_DISTS?=  crypto krb4 krb5
149 BASE_DISTS?=    base
150 DISTRIBUTIONS?= ${BASE_DISTS} ${OTHER_DISTS} ${COMPAT_DISTS} ${CRYPTO_DISTS}
151
152 # mountpoint for filesystems.
153 MNT=                    /mnt
154
155 # Various floppy image parameters.
156 #
157
158 .if ${TARGET_ARCH} == "i386"
159 .if ${TARGET} == "pc98"
160 SMALLBOOTSIZE=          1200
161 BOOTSIZE=               1440
162 SMALLFIXITSIZE=         1200
163 FIXITSIZE=              1440
164 MFSSIZE=                4320
165 BOOTINODE=              80000
166 FIXITINODE=             40000
167 MFSINODE=               8000
168 SMALLBOOTLABEL=         fd1200
169 BOOTLABEL=              fd1440
170 SMALLFIXITLABEL=        fd1200
171 FIXITLABEL=             fd1440
172 MFSLABEL=               minimum3
173 .else
174 DRIVERSIZE=             1440
175 BOOTSIZE=               1440
176 FIXITSIZE=              1440
177 MFSSIZE=                4320
178 BIGBOOTSIZE=            2880
179 DRIVERINODE=            40000
180 BOOTINODE=              80000
181 FIXITINODE=             40000
182 MFSINODE=               8000
183 DRIVERLABEL=            fd1440
184 BOOTLABEL=              fd1440
185 FIXITLABEL=             fd1440
186 MFSLABEL=               minimum3
187 BIGBOOTLABEL=           minimum2
188 .endif
189 .elif ${TARGET_ARCH} == "alpha"
190 DRIVERSIZE=             1440
191 BOOTSIZE=               1440
192 FIXITSIZE=              2880
193 MFSSIZE=                4320
194 BIGBOOTSIZE=            2880
195 DRIVERINODE=            80000
196 BOOTINODE=              80000
197 FIXITINODE=             40000
198 MFSINODE=               8000
199 DRIVERLABEL=            fd1440
200 BOOTLABEL=              fd1440
201 FIXITLABEL=             minimum2
202 MFSLABEL=               auto
203 BIGBOOTLABEL=           minimum2
204 .elif ${TARGET_ARCH} == "sparc64"
205 BIGBOOTSIZE=            4096
206 MFSSIZE=                4096
207 BOOTINODE=              8192
208 MFSINODE=               8192
209 BIGBOOTLABEL=           auto
210 MFSLABEL=               auto
211 .elif ${TARGET_ARCH} == "ia64"
212 BIGBOOTLABEL=           efi
213 BIGBOOTSIZE=            5154
214 BOOTINODE=              15872
215 MFSINODE=               8192
216 MFSLABEL=               auto
217 MFSSIZE=                8192
218 .endif
219
220 ZIPNSPLIT=              gzip --no-name -9 -c | split -b 1423k -
221
222 # Things that need to be recompiled with Kerberos support.
223 .if exists(${.CURDIR}/../kerberosIV) && exists(${.CURDIR}/../crypto) && !defined(NOKERBEROS)
224 K4PROGS!=       cd ${.CURDIR}/../kerberosIV; ${MAKE} -V KPROGS
225 .endif
226 .if exists(${.CURDIR}/../kerberos5) && exists(${.CURDIR}/../crypto) && !defined(NOKERBEROS)
227 K5PROGS!=       cd ${.CURDIR}/../kerberos5; ${MAKE} -V KPROGS
228 .endif
229
230 # Things that need to be compiled without crypto support in releases
231 .if !defined(FIXCRYPTO)
232 FIXCRYPTO=      bin/ed usr.sbin/ppp usr.sbin/pppd usr.sbin/tcpdump/tcpdump \
233                 lib/libfetch usr.bin/fetch
234 .if !defined(NO_SENDMAIL)
235 FIXCRYPTO+=     usr.sbin/sendmail
236 .endif
237 .endif
238
239
240 # Things which may get you into trouble if you change them
241 MTREEFILES=             ${.CURDIR}/../etc/mtree
242 _R?=                    /R
243 RD=                     ${_R}/stage
244 RND=                    ${RD}/release.doc
245 FD=                     ${_R}/ftp
246 CD=                     ${_R}/cdrom
247 CD_DISC1=               ${CD}/disc1
248 CD_DISC2=               ${CD}/disc2
249
250 # Where the bootstrap ports (see DOCPORTS) get installed.
251 LOCALDIR=               /usr/local/bin
252
253 # ia64 is different enough that we want our own doFS.sh.
254 .if ${TARGET_ARCH} == "ia64"
255 DOFS_SH=        ${.CURDIR}/ia64/doFS.sh
256 .else
257 DOFS_SH=        ${.CURDIR}/scripts/doFS.sh
258 .endif
259
260 .if ${TARGET_ARCH} == "sparc64"
261 CRUNCH_TARGETS= boot
262 FIXIT_TARGET=
263 .elif ${TARGET_ARCH} == "ia64"
264 CRUNCH_TARGETS= boot
265 FIXIT_TARGET=
266 .elif ${TARGET} == "pc98"
267 CRUNCH_TARGETS= boot fixit fixit-small
268 .endif
269
270 .if !defined(CRUNCH_TARGETS)
271 CRUNCH_TARGETS= boot fixit
272 .endif
273
274 .if !defined(FIXIT_TARGET)
275 FIXIT_TARGET= release.10
276 .endif
277
278 EXTRAS= ftp.1
279 .if !defined(NOCDROM)
280 EXTRAS+= cdrom.1
281 .if defined(MAKE_ISOS)
282 EXTRAS+= iso.1
283 .if ${TARGET} != "pc98"
284 BOOTABLE="-b"
285 .endif
286 .endif
287 .endif
288
289 .if !defined(NODOC)
290 DOCREL= doc.1 doc.2
291 .endif
292
293 .if !defined(NOPORTREADMES)
294 MAKEREADMES=    make readmes PORTSDIR=${CHROOTDIR}/usr/ports
295 .else
296 MAKEREADMES=    true
297 .endif
298
299 TMAKE!=         echo MAKEFLAGS=\"-m ${.CURDIR}/../share/mk\"; \
300                 cd ${.CURDIR}/..; ${MAKE} -f Makefile.inc1 -V TMAKE
301 WMAKEENV!=      echo MAKEFLAGS=\"-m ${.CURDIR}/../share/mk\"; \
302                 cd ${.CURDIR}/..; ${CROSSMAKE} -f Makefile.inc1 -V WMAKEENV
303 WMAKE=          ${WMAKEENV} ${MAKE}
304
305 CVS_SRCARGS=    -P
306 .if defined(RELEASETAG)
307 CVS_SRCARGS+=   -r ${RELEASETAG}
308 .endif
309
310 CVS_DOCARGS=    -P
311 .if defined(DOCRELEASETAG)
312 CVS_DOCARGS+=   -r ${DOCRELEASETAG}
313 .endif
314
315 CVS_PORTSARGS=  -P
316 .if defined(PORTSRELEASETAG)
317 CVS_PORTSARGS+= -r ${PORTSRELEASETAG}
318 .endif
319
320 rerelease release:
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 make(release)
330 .if exists(${CHROOTDIR})
331 # The first command will fail on a handful of files that have their schg
332 # flags set.  But it greatly speeds up the next two commands.
333         # NB: clear any vestigal devfs mount, just in case
334         -umount ${CHROOTDIR}/dev > /dev/null 2>&1
335         -rm -rf ${CHROOTDIR} 2>/dev/null
336         -chflags -R noschg ${CHROOTDIR}/.
337         -rm -rf ${CHROOTDIR}
338 .endif
339         mkdir -p ${CHROOTDIR}
340         @echo ">>> make release for ${TARGET} started on `LC_ALL=C TZ=GMT date`"
341         cd ${.CURDIR}/.. && ${NATIVEMAKE} -DNOGAMES -DNOHTML -DNOINFO -DNOMAN \
342             -DNOPROFILE installworld DESTDIR=${CHROOTDIR}
343         cd ${.CURDIR}/../etc && ${NATIVEMAKE} distribution DESTDIR=${CHROOTDIR}
344         if [ -f /etc/resolv.conf ]; then \
345                 cp -p /etc/resolv.conf ${CHROOTDIR}/etc; \
346         fi
347 .if defined(EXTLOCALDIR)
348         rm -rf ${CHROOTDIR}/usr/local
349         cd ${CHROOTDIR}/usr && cp -R ${EXTLOCALDIR} local
350 .endif
351         rm -rf ${CHROOTDIR}/usr/src
352 .if defined(EXTSRCDIR)
353         cd ${CHROOTDIR}/usr && \
354                 cp -R ${EXTSRCDIR} src
355 .else
356         cd ${CHROOTDIR}/usr && \
357                 ${CVSPREFIX} cvs -R ${CVSARGS} -d ${CVSROOT} co ${CVSCMDARGS} ${CVS_SRCARGS} ${RELEASESRCMODULE}
358 .endif
359 .if defined(LOCAL_PATCHES) && exists(${LOCAL_PATCHES})
360         cd ${CHROOTDIR}/usr/src && patch ${PATCH_FLAGS} < ${LOCAL_PATCHES}
361 .endif
362 .if defined(LOCAL_SCRIPT) && exists(${LOCAL_SCRIPT})
363         cd ${CHROOTDIR} && env CHROOTDIR=${CHROOTDIR} BUILDNAME=${BUILDNAME} RELEASETAG=${RELEASETAG} ${LOCAL_SCRIPT}
364 .endif
365         rm -rf ${CHROOTDIR}/usr/ports
366 .if !defined(NOPORTSATALL)
367         cd ${CHROOTDIR}/usr && ${CVSPREFIX} cvs -R ${CVSARGS} -d ${CVSROOT} co ${CVSCMDARGS} ${CVS_PORTSARGS} ${RELEASEPORTSMODULE}
368 .endif
369 .if !defined(NOPORTS)
370         cd ${CHROOTDIR}/usr/ports && ${MAKEREADMES}
371 .endif
372 .if !defined(NODOC)
373         rm -rf ${CHROOTDIR}/usr/doc
374 .if defined(EXTDOCDIR)
375         cd ${CHROOTDIR}/usr && cp -R ${EXTDOCDIR} doc
376 .else
377         cd ${CHROOTDIR}/usr && ${CVSPREFIX} cvs -R ${CVSARGS} -d ${CVSROOT} co ${CVSCMDARGS} ${CVS_DOCARGS} ${RELEASEDOCMODULE}
378 .endif
379         if [ -d ${RELEASEDISTFILES}/ ]; then \
380                 cp -rp ${RELEASEDISTFILES} ${CHROOTDIR}/usr/ports/distfiles; \
381         else \
382                 mkdir -p ${CHROOTDIR}/usr/ports/distfiles; \
383         fi
384 .if defined(PREFETCHDISTFILES)
385         @for i in ${DOCPORTS}; do \
386                 cd ${CHROOTDIR}/usr/ports/$$i && \
387                         make PORTSDIR=${CHROOTDIR}/usr/ports BATCH=yes \
388                         WITHOUT_X11=yes JADETEX=no WITHOUT_PYTHON=yes \
389                         fetch-recursive ; \
390         done
391 .endif
392 .endif
393 .endif
394 .if make(rerelease)
395 .if !defined(RELEASENOUPDATE)
396 .if !defined(RELEASETAG)
397         cd ${CHROOTDIR}/usr/src && ${CVSPREFIX} cvs -R ${CVSARGS} -q update ${CVSCMDARGS} -P -d -A
398 .else
399         cd ${CHROOTDIR}/usr/src && ${CVSPREFIX} cvs -R ${CVSARGS} -q update ${CVSCMDARGS} -P -d -r ${RELEASETAG}
400 .endif
401 .if !defined(NOPORTS)
402         cd ${CHROOTDIR}/usr/ports && ${CVSPREFIX} cvs -R ${CVSARGS} -q update ${CVSCMDARGS} -P -d
403 .endif
404 .if defined(DOMINIMALDOCPORTS) && ${DOMINIMALDOCPORTS} == "YES"
405         for i in ${MINIMALDOCPORTS}; do \
406                 ( cd ${CHROOTDIR}/usr/$$i && ${CVSPREFIX} cvs -R ${CVSARGS} -q update ${CVSCMDARGS} -P -d ) ; \
407         done
408 .endif
409 .if !defined(NODOC)
410         cd ${CHROOTDIR}/usr/doc && ${CVSPREFIX} cvs -R ${CVSARGS} -q update ${CVSCMDARGS} -P -d
411 .endif
412 .endif
413 .endif
414         # Add version information to those things that need it.
415         ( cd ${CHROOTDIR}/usr/src/sys/conf && \
416           mv newvers.sh foo && \
417           sed "s/^RELEASE=.*/RELEASE=${BUILDNAME}/" foo > newvers.sh && rm foo )
418         -test -f install.cfg && cp install.cfg ${CHROOTDIR}/usr/src/release
419         echo "#!/bin/sh"                        > ${CHROOTDIR}/mk
420         echo "set -ex"                          >> ${CHROOTDIR}/mk
421         echo "trap 'umount /dev || true' 0"     >> ${CHROOTDIR}/mk
422         echo "_RELTARGET=\$${1:-doRELEASE}"     >> ${CHROOTDIR}/mk
423 .for var in \
424         AUTO_KEYBOARD_DETECT \
425         BOOT_CONFIG \
426         BUILDNAME \
427         CD_EXTRA_BITS \
428         DISTRIBUTIONS \
429         DOC_LANG \
430         DOMINIMALDOCPORTS \
431         EXTRA_SRC \
432         FIXCRYPTO \
433         KERNELS \
434         KERNEL_FLAGS \
435         MAKE_ISOS \
436         NOCDROM \
437         NODOC \
438         NOKERBEROS \
439         NOPORTS \
440         NOSHARED \
441         NOSRC \
442         NO_CPU_CFLAGS \
443         NO_CPU_COPTFLAGS \
444         NO_FLOPPIES \
445         NO_SENDMAIL \
446         RELEASETAG \
447         RELNOTES_LANG \
448         TARGET \
449         TARGET_ARCH \
450         WORLD_FLAGS
451 .if defined(${var})
452         echo "export ${var}=\"${${var}}\""      >> ${CHROOTDIR}/mk
453 .endif
454 .endfor
455         # Don't remove this, or the build will fall over!
456         echo "export RELEASEDIR=${_R}"          >> ${CHROOTDIR}/mk
457         echo "export PATH=/bin:/usr/bin:/sbin:/usr/sbin:${LOCALDIR}"    >> ${CHROOTDIR}/mk
458         echo "export MANBUILDCAT=YES"           >> ${CHROOTDIR}/mk
459         # NB: these may fail if the host is running w/o devfs
460         echo "umount /dev >/dev/null 2>&1 || true" >> ${CHROOTDIR}/mk
461         echo "mount -t devfs devfs /dev >/dev/null 2>&1 || true" \
462                                                 >> ${CHROOTDIR}/mk
463         echo "if [ ! -f /tmp/.world_done ]; then" >> ${CHROOTDIR}/mk
464         echo "  cd /usr/src"                    >> ${CHROOTDIR}/mk
465         echo "  ${CROSSMAKE} ${WORLD_FLAGS} -DNOCLEAN buildworld && \\" >> ${CHROOTDIR}/mk
466         echo "  touch /tmp/.world_done"         >> ${CHROOTDIR}/mk
467         echo "fi"                               >> ${CHROOTDIR}/mk
468         echo "cd /usr/src/release"              >> ${CHROOTDIR}/mk
469         echo "make obj"                         >> ${CHROOTDIR}/mk
470         echo "make \$${_RELTARGET}"             >> ${CHROOTDIR}/mk
471         echo "echo \">>> make ${.TARGET} for ${TARGET} finished on \`LC_ALL=C TZ=GMT date\`\"" >> ${CHROOTDIR}/mk
472         chmod 755 ${CHROOTDIR}/mk
473         env -i /usr/sbin/chroot ${CHROOTDIR} /mk
474
475 clean:
476         rm -rf boot_crunch release.[0-9]
477
478 # Clean out ${_R} and make the directory structure.
479 release.1:
480         mkdir -p ${_R}
481         -rm -rf ${_R}/* 2> /dev/null
482         -chflags -R noschg ${_R}/.
483         rm -rf ${_R}/*
484         mkdir ${RD}
485         mkdir ${RD}/floppies
486         mkdir ${RD}/trees
487         mkdir ${RD}/kernels
488         for i in ${DISTRIBUTIONS} ; do \
489                 mkdir ${RD}/trees/$$i && \
490                 mtree -deU -f ${MTREEFILES}/BSD.root.dist \
491                     -p ${RD}/trees/$$i > /dev/null && \
492                 mtree -deU -f ${MTREEFILES}/BSD.usr.dist \
493                     -p ${RD}/trees/$$i/usr > /dev/null && \
494                 mtree -deU -f ${MTREEFILES}/BSD.include.dist \
495                     -p ${RD}/trees/$$i/usr/include > /dev/null && \
496                 mtree -deU -f ${MTREEFILES}/BSD.var.dist \
497                     -p ${RD}/trees/$$i/var > /dev/null ; \
498         done
499         touch release.1
500
501 # Install the system into the various distributions.
502 release.2:
503         cd ${.CURDIR}/../etc && make distrib-dirs DESTDIR=${RD}/trees/base
504         cd ${.CURDIR}/.. && ${CROSSMAKE} distributeworld DISTDIR=${RD}/trees
505         touch release.2
506
507 # Build and install crypto, krb4 and krb5 distributions.
508 release.3:
509         # Handle some grief caused by the munition braindeadness.
510         cd ${.CURDIR}/..; \
511         ${CROSSMAKE} ${WORLD_FLAGS} -DNO_MAKEDB_RUN -DNOCRYPT \
512             SUBDIR_OVERRIDE="${FIXCRYPTO}" \
513             buildworld distributeworld DISTDIR=${RD}/trees
514 .if exists(${.CURDIR}/../kerberosIV) && exists(${.CURDIR}/../crypto) && !defined(NOKERBEROS)
515         cd ${.CURDIR}/..; \
516         ${CROSSMAKE} ${WORLD_FLAGS} -DNO_MAKEDB_RUN -DMAKE_KERBEROS4 \
517             SUBDIR_OVERRIDE="kerberosIV ${K4PROGS}" \
518             buildworld distributeworld DISTDIR=${RD}/trees
519 .endif
520 .if exists(${.CURDIR}/../kerberos5) && exists(${.CURDIR}/../crypto) && !defined(NOKERBEROS)
521         cd ${.CURDIR}/..; \
522         ${CROSSMAKE} ${WORLD_FLAGS} -DNO_MAKEDB_RUN -DMAKE_KERBEROS5 \
523             SUBDIR_OVERRIDE="kerberos5 ${K5PROGS}" \
524             buildworld distributeworld DISTDIR=${RD}/trees
525         rm -f ${RD}/trees/krb5/usr/share/info/dir
526 .endif
527         -chflags -R noschg ${RD}/trees
528         touch release.3
529
530 # Make and install the generic kernel(s).
531 release.4:
532 .for kernel in ${KERNELS}
533         cd ${.CURDIR}/..; \
534         ${CROSSMAKE} ${KERNEL_FLAGS} -DNO_MODULES \
535             KERNCONF=${kernel} INSTKERNNAME=${kernel} kernel \
536             DESTDIR=${RD}/trees/base
537 .endfor
538         # Install a standard boot kernel+modules.
539         cd ${.CURDIR}/..; \
540         ${CROSSMAKE} ${KERNEL_FLAGS} \
541             kernel \
542             DESTDIR=${RD}/trees/base; \
543         cd ${.CURDIR}/..; \
544         ${CROSSMAKE} ${KERNEL_FLAGS} -DNO_MODULES \
545             reinstallkernel -DINSTALL_DEBUG \
546             DESTDIR=${RD}/trees/base
547         touch release.4
548
549 # Make and install the three crunched binaries which live on the floppies.
550 # You are not supposed to like this :-)
551 release.5:
552         rm -rf ${RD}/crunch
553         mkdir -p ${RD}/crunch
554 .for j in ${CRUNCH_TARGETS}
555         rm -rf ${j}_crunch
556         mkdir ${j}_crunch
557 .if exists(${.CURDIR}/${TARGET}/${j}_crunch.conf)
558         cd ${j}_crunch; ${WMAKEENV} crunchgen -o ${.CURDIR}/${TARGET}/${j}_crunch.conf
559 .else
560         cd ${j}_crunch; ${WMAKEENV} crunchgen -o ${.CURDIR}/${j}_crunch.conf
561 .endif
562         cd ${j}_crunch; ${WMAKE} -f ${j}_crunch.mk subclean
563         cd ${.CURDIR}/..; ${TMAKE} build-tools
564         cd ${j}_crunch; ${WMAKE} -f ${j}_crunch.mk \
565             CFLAGS="-Os -pipe" -DNO_CPU_CFLAGS all
566         strip -R .comment ${j}_crunch/${j}_crunch
567         mv ${j}_crunch/${j}_crunch ${RD}/crunch/${j}
568 .endfor
569         touch release.5
570
571 #
572 # --==## Fix up the distributions. ##==--
573 #
574 release.6:
575         # Create any "synthetic dists" now.
576         @for i in ${DISTRIBUTIONS}; do \
577                 if [ -f ${.CURDIR}/scripts/$${i}-make.sh ]; then \
578                         echo -n "Running $$i dist creation script... "; \
579                         env RD=${RD} sh ${.CURDIR}/scripts/$${i}-make.sh || echo "$$i distribution script returned bad status."; \
580                         echo "Done."; \
581                 fi \
582         done \
583
584         # Remove all the directories we don't need.
585         -cd ${RD}/trees && \
586                 find ${OTHER_DISTS} ${COMPAT_DISTS} ${CRYPTO_DISTS} -depth -type d -print | xargs rmdir
587         touch release.6
588
589 #
590 # --==## Package up the tarballs from assembled trees ##==--
591 #
592 release.7:
593         rm -rf ${RD}/dists
594         mkdir -p ${RD}/dists
595         @for i in ${DISTRIBUTIONS} ; \
596         do \
597                 if [ -d ${RD}/trees/$${i} ] ; then \
598                         cd ${.CURDIR} && $(MAKE) doTARBALL \
599                                 SD=${RD}/trees/$${i} \
600                                 TN=$$i TD=$$i ARG="." && \
601                         echo "$${i} distribution is finished."; \
602                 fi ; \
603         done
604         # More munition braindeadness.
605         ( cd ${RD}/dists && \
606                 if [ -f krb4/krb4.aa ] ; then \
607                         mv krb4/krb4.* crypto && \
608                         cat krb4/CHECKSUM.MD5 >> crypto/CHECKSUM.MD5 && \
609                         rm -r krb4; \
610                 fi )
611         ( cd ${RD}/dists && \
612                 if [ -f krb5/krb5.aa ] ; then \
613                         mv krb5/krb5.* crypto && \
614                         cat krb5/CHECKSUM.MD5 >> crypto/CHECKSUM.MD5 && \
615                         rm -r krb5; \
616                 fi )
617         touch release.7
618
619
620 #
621 # --==## Make source dists ##==--
622 #
623 release.8:
624 .if !defined(NOSRC)
625         @cd ${.CURDIR} && $(MAKE) doTARBALL SD=/usr/src \
626                 TD=src TN=sbase ARG="[A-Z]*"
627         @for i in `cd /usr/src && echo [a-z]*` ; do \
628                 if [ -d /usr/src/$$i ] ; then \
629                         cd ${.CURDIR} && $(MAKE) doTARBALL \
630                                 TN=`echo s$$i | tr -d '.' | \
631                                     sed -e 's/usr/u/' \
632                                         -e 's/kerberosIV/krb4/' \
633                                         -e 's/kerberos5/krb5/'` \
634                                 SD=/usr/src TD=src ARG="$$i" ; \
635                 fi ; \
636         done
637 .if defined(EXTRA_SRC)
638         @set ${EXTRA_SRC} && \
639         while [ $$# -ge 2 ] ; do \
640                 if [ -d /usr/src/$$1 ] ; then \
641                         cd ${.CURDIR} && $(MAKE) doTARBALL \
642                                 SD=/usr/src TN="s$$2" TD=src ARG="$$1" ; \
643                 fi && shift && shift ; \
644         done
645 .endif
646         if [ -d ${RD}/dists/crypto ] ; then ( cd ${RD}/dists/src && \
647                 if [ -f ssecure.aa ] ; then mv ssecure.* ../crypto ; fi && \
648                 if [ -f scrypto.aa ] ; then mv scrypto.* ../crypto ; fi && \
649                 if [ -f skrb4.aa ] ; then mv skrb4.* ../crypto ; fi && \
650                 if [ -f skrb5.aa ] ; then mv skrb5.* ../crypto ; fi ; \
651                 cd ${RD}/dists/crypto; rm -f CHECKSUM.MD5; \
652                 md5 * > CHECKSUM.MD5 ) ; fi
653         (cd ${RD}/dists/src; rm -f CHECKSUM.MD5; md5 * > CHECKSUM.MD5)
654         @echo "src distribution is finished."
655 .endif
656         touch release.8
657
658 # Complete the bootfd
659 #
660 # Now, just to get this picture down once and for all:
661 #
662 # +------------------------------------------------------------------------+
663 # |boot.flp                                                                |
664 # +-----+-----+------------------------------------------------------------+
665 # |boot1|boot2|floppy filesystem "bootfd"                                  |
666 # +-----+-----+-+----------------------+---------------------------------+-+
667 #               |kernel.gz             |mfsroot.gz                       |
668 #               +----------------------+---------------------------------+
669 #
670
671 release.9:
672 .if ${TARGET_ARCH} != "ia64" || ${TARGET_ARCH} == ${MACHINE_ARCH}
673         rm -rf ${RD}/mfsfd
674         mkdir ${RD}/mfsfd
675         cd ${RD}/mfsfd && \
676                 mkdir -p etc/defaults dev mnt stand/etc/defaults stand/help
677         @cd ${.CURDIR} && $(MAKE) installCRUNCH CRUNCH=boot \
678                 DIR=${RD}/mfsfd/stand ZIP=false
679         ( cd ${RD}/mfsfd && \
680           for dir in bin sbin ; do \
681                 ln -sf /stand $$dir; \
682           done )
683         cp ${RD}/trees/base/sbin/dhclient-script ${RD}/mfsfd/stand
684 .if ${TARGET} == "pc98"
685         cp ${.CURDIR}/../etc/defaults/pccard.conf ${RD}/mfsfd/etc/defaults/pccard.conf
686 .endif
687         cp ${.CURDIR}/../etc/usbd.conf ${RD}/mfsfd/etc/usbd.conf
688         ( for F in defaults/rc.conf netconfig protocols ; do \
689                 sed -e '/^#.*$$/d' -e 's/[:space:]*#.*$$//g' \
690                 ${RD}/trees/base/etc/$$F > ${RD}/mfsfd/stand/etc/$$F ; \
691           done )
692         grep -E '^(ftp|nameserver|domain|sunrpc|cmd|nfsd)[^-\w]' \
693             ${RD}/trees/base/etc/services | \
694             sed -e '/^#.*$$/d' -e 's/[:space:]*#.*$$//g' \
695             > ${RD}/mfsfd/stand/etc/services
696         ln ${RD}/mfsfd/stand/etc/services ${RD}/mfsfd/etc/services
697         ln ${RD}/mfsfd/stand/etc/netconfig ${RD}/mfsfd/etc/netconfig
698         cp ${RD}/trees/base/COPYRIGHT ${RD}/mfsfd/stand/help/COPYRIGHT.hlp
699 .if !defined(NODOC)
700         @for i in ${DIST_DOCS_ARCH_INDEP}; do \
701           cp ${RND}/${RELNOTES_LANG}/$$i/article.txt ${RD}/mfsfd/stand/help/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
702         done
703         @for i in ${DIST_DOCS_ARCH_DEP}; do \
704           cp ${RND}/${RELNOTES_LANG}/$$i/${TARGET}/article.txt ${RD}/mfsfd/stand/help/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
705         done
706         @mv ${RD}/mfsfd/stand/help/INSTALLATION.TXT ${RD}/mfsfd/stand/help/INSTALL.TXT
707         @mv ${RD}/mfsfd/stand/help/EARLY-ADOPTER.TXT ${RD}/mfsfd/stand/help/EARLY.TXT
708 .endif
709         -test -f ${.CURDIR}/install.cfg && cp ${.CURDIR}/install.cfg ${RD}/mfsfd
710         @mkdir -p ${RD}/mfsfd/boot
711 .if ${TARGET_ARCH} != "ia64"
712         @cp ${RD}/trees/base/boot/boot* ${RD}/mfsfd/boot
713 .endif
714 .if ${TARGET} == "i386"
715         @cp ${RD}/trees/base/boot/mbr ${RD}/mfsfd/boot
716 .endif
717         @echo "Making the regular boot floppy."
718         @tar --exclude CVS -cf - -C ${.CURDIR}/../usr.sbin/sysinstall help | \
719                 tar xf - -C ${RD}/mfsfd/stand
720 .if ${TARGET_ARCH} == "alpha" && !defined(NO_FLOPPIES)
721         rm -rf ${RD}/mfsfd/stand/help/*
722 .endif
723 .if defined(SMALLBOOTSIZE)
724 .if exists(${.CURDIR}/${TARGET}/drivers-small.conf)
725         @rm -rf ${RD}/mfsfd/modules
726         @mkdir -p ${RD}/mfsfd/modules
727         @awk -f  ${.CURDIR}/scripts/driver-copy2.awk 2 \
728             ${.CURDIR}/${TARGET}/drivers-small.conf \
729             ${RD}/trees/base/boot/kernel ${RD}/mfsfd/modules
730 .endif
731         sh -e ${DOFS_SH} -s mfsroot ${RD} ${MNT} \
732                 ${MFSSIZE} ${RD}/mfsfd ${MFSINODE} ${MFSLABEL}
733         @gzip -9vc mfsroot > mfsroot.gz
734         @sh -e ${DOFS_SH} ${RD}/floppies/mfsroot-small.flp \
735                 ${RD} ${MNT} ${SMALLBOOTSIZE} mfsroot.gz \
736                 ${BOOTINODE} ${SMALLBOOTLABEL}
737 .endif
738 .if exists(${.CURDIR}/${TARGET}/drivers.conf)
739         @rm -rf ${RD}/mfsfd/modules
740         @mkdir -p ${RD}/mfsfd/modules
741         @awk -f  ${.CURDIR}/scripts/driver-copy2.awk 2 \
742             ${.CURDIR}/${TARGET}/drivers.conf \
743             ${RD}/trees/base/boot/kernel ${RD}/mfsfd/modules
744         @rm -rf ${RD}/driversfd
745         @mkdir ${RD}/driversfd
746         @awk -f  ${.CURDIR}/scripts/driver-copy2.awk 3 \
747             ${.CURDIR}/${TARGET}/drivers.conf \
748             ${RD}/trees/base/boot/kernel ${RD}/driversfd
749         -@rmdir ${RD}/driversfd
750         if [ -d ${RD}/driversfd ]; then \
751             sh -e ${DOFS_SH} \
752                 ${RD}/floppies/drivers.flp ${RD} ${MNT} ${DRIVERSIZE} \
753                 ${RD}/driversfd ${DRIVERINODE} ${DRIVERLABEL}; \
754             cd ${RD}/driversfd && awk -f  ${.CURDIR}/scripts/driver-desc.awk \
755                 *.dsc >> ${RD}/floppies/DRIVERS.TXT; \
756         fi
757 .endif
758         sh -e ${DOFS_SH} -s mfsroot ${RD} ${MNT} \
759                 ${MFSSIZE} ${RD}/mfsfd ${MFSINODE} ${MFSLABEL}
760         @gzip -9vc mfsroot > mfsroot.gz
761         @mkdir -p ${RD}/mfsroot
762         @cp mfsroot.gz ${RD}/mfsroot
763 .if !defined(NO_FLOPPIES)
764 .if defined(BOOTSIZE)
765         @sh -e ${DOFS_SH} ${RD}/floppies/mfsroot.flp \
766                 ${RD} ${MNT} ${BOOTSIZE} mfsroot.gz ${BOOTINODE} ${BOOTLABEL}
767         @cd ${.CURDIR} && ${MAKE} doMFSKERN FSIMAGE=kern
768 .endif
769 .if defined(SMALLBOOTSIZE)
770         @cd ${.CURDIR} && ${MAKE} doMFSKERN FSIMAGE=kern-small FDSIZE=SMALL
771 .endif
772 .if defined(BIGBOOTSIZE)
773         @cd ${.CURDIR} && ${MAKE} doMFSKERN FSIMAGE=boot FDSIZE=BIG
774 .endif
775 .endif
776         @rm mfsroot mfsroot.gz
777         @echo "Regular and MFS boot floppies made."
778 .endif
779         touch release.9
780
781 #
782 # --==## Create a fixit floppy ##==--
783 #
784 release.10:
785 .if !defined(NO_FLOPPIES)
786         @echo "Making fixit floppy."
787         @rm -rf ${RD}/fixitfd
788         @mkdir ${RD}/fixitfd
789         @cd ${RD}/fixitfd && \
790                 mkdir -p dev stand bin sbin etc mnt mnt1 mnt2 mnt3 mnt4 tmp \
791                 usr/share/misc
792         @cp ${RD}/trees/base/etc/spwd.db ${RD}/trees/base/etc/group \
793                 ${RD}/trees/base/etc/protocols ${RD}/fixitfd/etc
794         @cp ${RD}/trees/base/usr/share/misc/scsi_modes \
795                 ${RD}/fixitfd/usr/share/misc
796         @cp ${.CURDIR}/fixit.profile ${RD}/fixitfd/.profile
797         @cp ${.CURDIR}/fixit.services ${RD}/fixitfd/etc/services
798         @cp ${.CURDIR}/scripts/tar.sh ${RD}/fixitfd/stand/tar
799         @chmod 555 ${RD}/fixitfd/stand/tar
800 .if defined(SMALLFIXITSIZE)
801         @cd ${.CURDIR} && ${MAKE} installCRUNCH CRUNCH=fixit-small \
802                 DIR=${RD}/fixitfd/stand ZIP=false
803         @sh -e ${DOFS_SH} ${RD}/floppies/fixit-small.flp \
804                 ${RD} ${MNT} ${SMALLFIXITSIZE} ${RD}/fixitfd ${FIXITINODE} \
805                 ${SMALLFIXITLABEL}
806         @rm -rf ${RD}/fixitfd/stand
807         @mkdir ${RD}/fixitfd/stand
808 .endif
809         @cd ${.CURDIR} && ${MAKE} installCRUNCH CRUNCH=fixit \
810                 DIR=${RD}/fixitfd/stand ZIP=false
811         @sh -e ${DOFS_SH} ${RD}/floppies/fixit.flp ${RD} \
812                 ${MNT} ${FIXITSIZE} ${RD}/fixitfd ${FIXITINODE} ${FIXITLABEL}
813 # Do our last minute floppies directory setup in a convenient place.
814 .if !defined(NODOC)
815         @cp ${RND}/${RELNOTES_LANG}/installation/${TARGET}/article.txt \
816                 ${RD}/floppies/README.TXT
817         @(cd ${RD}/floppies; md5 README.TXT *.flp > CHECKSUM.MD5)
818 .else
819         @(cd ${RD}/floppies; md5 *.flp > CHECKSUM.MD5)
820 .endif
821 .endif
822         touch release.10
823
824 #
825 # --==## Setup a suitable ftp-area ##==--
826 #
827 ftp.1:
828         @echo "Setting up FTP distribution area"
829         @mkdir -p ${FD}
830         -@ln -s . ${FD}/${BUILDNAME}
831         @cd ${RD} && find floppies -print | cpio -dumpl ${FD}
832         @cd ${RD}/dists && find . -print | cpio -dumpl ${FD}
833 .if !defined(NODOC)
834         @for i in ${DIST_DOCS_ARCH_INDEP}; do \
835           cp ${RND}/${RELNOTES_LANG}/$$i/article.txt ${FD}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
836           cp ${RND}/${RELNOTES_LANG}/$$i/article.html ${FD}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \
837         done
838         @for i in ${DIST_DOCS_ARCH_DEP}; do \
839           cp ${RND}/${RELNOTES_LANG}/$$i/${TARGET}/article.txt ${FD}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
840           cp ${RND}/${RELNOTES_LANG}/$$i/${TARGET}/article.html ${FD}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \
841         done
842         @cp ${RND}/${RELNOTES_LANG}/readme/docbook.css ${FD}
843         @mv ${FD}/INSTALLATION.TXT ${FD}/INSTALL.TXT
844         @mv ${FD}/INSTALLATION.HTM ${FD}/INSTALL.HTM
845         @mv ${FD}/EARLY-ADOPTER.TXT ${FD}/EARLY.TXT
846         @mv ${FD}/EARLY-ADOPTER.HTM ${FD}/EARLY.HTM
847 .endif
848         @echo "CD_VERSION = ${BUILDNAME}" > ${FD}/cdrom.inf
849 .if !defined(NOPORTS)
850         @tar --exclude CVS -cBf - -C ${CD_DISC1} ports | tar -xBf - -C ${FD}
851 .endif
852         touch ftp.1
853
854 #
855 # --==## Setup a suitable cdrom-area ##==--
856 #
857 cdrom.1:
858         @echo "Setting up CDROM distribution area"
859         @mkdir -p ${CD_DISC1} ${CD_DISC2}
860         -@ln -s . ${CD_DISC1}/${BUILDNAME}
861         @cd ${RD} && find floppies -print | cpio -dumpl ${CD_DISC1}
862         @cd ${RD}/dists && find . -print | cpio -dumpl ${CD_DISC1}
863         @for i in ${DISTRIBUTIONS} ; \
864         do \
865                 if [ -d ${RD}/trees/$${i} ] ; then \
866                         chflags -R noschg ${RD}/trees/$${i} || true ; \
867                         ( cd ${RD}/trees/$${i} && \
868                         find . -depth -print | cpio -dumpl ${CD_DISC2} ) ; \
869                 fi \
870         done
871         @rm -f ${CD_DISC2}/.profile
872         @cp ${.CURDIR}/fixit.profile ${CD_DISC2}/.profile
873         @echo "CD_VERSION = ${BUILDNAME}" > ${CD_DISC1}/cdrom.inf
874         @echo "CD_VERSION = ${BUILDNAME}" > ${CD_DISC2}/cdrom.inf
875 .if !defined(NODOC)
876         @for i in ${DIST_DOCS_ARCH_INDEP}; do \
877           cp ${RND}/${RELNOTES_LANG}/$$i/article.txt ${CD_DISC1}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
878           cp ${RND}/${RELNOTES_LANG}/$$i/article.html ${CD_DISC1}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \
879         done
880         @for i in ${DIST_DOCS_ARCH_DEP}; do \
881           cp ${RND}/${RELNOTES_LANG}/$$i/${TARGET}/article.txt ${CD_DISC1}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
882           cp ${RND}/${RELNOTES_LANG}/$$i/${TARGET}/article.html ${CD_DISC1}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \
883         done
884         @cp ${RND}/${RELNOTES_LANG}/readme/docbook.css ${CD_DISC1}
885         @mv ${CD_DISC1}/INSTALLATION.TXT ${CD_DISC1}/INSTALL.TXT
886         @mv ${CD_DISC1}/INSTALLATION.HTM ${CD_DISC1}/INSTALL.HTM
887         @mv ${CD_DISC1}/EARLY-ADOPTER.TXT ${CD_DISC1}/EARLY.TXT
888         @mv ${CD_DISC1}/EARLY-ADOPTER.HTM ${CD_DISC1}/EARLY.HTM
889 .endif
890 .if ${TARGET} != "pc98"
891         @echo "Setting up /boot"
892         @rm -f ${CD_DISC2}/boot/loader.conf
893         @cp ${RD}/mfsroot/mfsroot.gz ${CD_DISC2}/boot/mfsroot.gz
894         @echo 'mfsroot_load="YES"' > ${CD_DISC2}/boot/loader.conf
895         @echo 'mfsroot_type="mfs_root"' >> ${CD_DISC2}/boot/loader.conf
896         @echo 'mfsroot_name="/boot/mfsroot"' >> ${CD_DISC2}/boot/loader.conf
897         @cp -Rp ${CD_DISC2}/boot ${CD_DISC1}
898 .endif
899 .if ${TARGET} == "i386"
900         @mkdir -p ${CD_DISC2}/floppies
901         @cp ${CD_DISC1}/floppies/boot.flp ${CD_DISC2}/floppies
902 .endif
903 .if !defined(NOPORTS)
904         @mkdir -p ${CD_DISC1}/ports && \
905           tar --exclude CVS --exclude 'ports/distfiles/*' -czf \
906           ${CD_DISC1}/ports/ports.tgz -C /usr ports && \
907           cp ${.CURDIR}/scripts/ports-install.sh ${CD_DISC1}/ports/install.sh \
908           && (cd ${CD_DISC1}/ports; md5 * > CHECKSUM.MD5)
909 .endif
910         touch cdrom.1
911
912 iso.1:
913         @if [ -r ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh ]; then \
914                 echo "Creating ISO images..."; \
915                 sh ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh ${BOOTABLE} \
916                   fbsd_miniinst ${CD}/${BUILDNAME}-${TARGET}-miniinst.iso ${CD_DISC1}; \
917                 sh ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh ${BOOTABLE} \
918                   fbsd_livefs ${CD}/${BUILDNAME}-${TARGET}-disc2.iso ${CD_DISC2}; \
919                 if [ "x${CD_EXTRA_BITS}" != "x" ]; then \
920                         sh ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh ${BOOTABLE} \
921                           fbsd_boot ${CD}/${BUILDNAME}-${TARGET}-disc1.iso ${CD_DISC1} ${CD_EXTRA_BITS} \
922                             && false; \
923                 fi \
924         else \
925                 echo "Do not know how to create an ISO for ${TARGET_ARCH}."; \
926         fi
927         touch iso.1
928
929 #
930 # --==## Documentation Project files such as the Handbook and FAQ ##==--
931 #
932 doc.1:
933         @echo "Making docs..."
934         @for i in ${DOCPORTS}; do \
935             cd /usr/ports/$$i && \
936             env -i PATH=$${PATH} make all install clean \
937                 BATCH=yes WITHOUT_X11=yes JADETEX=no WITHOUT_PYTHON=yes \
938                 FORCE_PKG_REGISTER=yes; \
939         done
940         @cd /usr/doc && make all install 'FORMATS=html html-split txt' INSTALL_COMPRESSED='' DOCDIR=${RD}/trees/base/usr/share/doc
941         touch doc.1
942
943 #
944 # --==## RELNOTESng:  Next-generation replacements for *.TXT files ##==--
945 #
946 doc.2:
947         @echo "Making release documentation..."
948         @cd ${.CURDIR}/doc && make all install clean 'FORMATS=html txt' INSTALL_COMPRESSED='' DOCDIR=${RND}
949         touch doc.2
950
951 # Various "subroutine" and other supporting targets.
952
953 # RD=
954 # SD=
955 # TD=
956 # ARG=
957 doTARBALL:
958 .if !defined(SD)
959         @echo "SD undefined in doTARBALL" && exit 1
960 .endif
961 .if !defined(TD)
962         @echo "TD undefined in doTARBALL" && exit 1
963 .endif
964 .if !defined(ARG)
965         @echo "ARG undefined in doTARBALL" && exit 1
966 .endif
967         @rm -rf ${RD}/dists/${TD}/${TN}*
968         @mkdir -p ${RD}/dists/${TD}
969         @( cd ${SD} && \
970                 tn=`echo ${TN} | tr '[A-Z]' '[a-z]' | cut -c1-8` && \
971                 echo rolling ${TD}/$$tn tarball &&\
972                 tar --exclude CVS --exclude obj --exclude BOOTMFS -cf - ${ARG} | \
973                 ${ZIPNSPLIT} ${RD}/dists/${TD}/$$tn. && \
974                 sh ${.CURDIR}/scripts/info.sh ${RD}/dists/${TD}/$$tn > \
975                    ${RD}/dists/${TD}/$$tn.inf && \
976                 if [ -f ${.CURDIR}/scripts/$${TD}-install.sh ]; then \
977                   cp -p ${.CURDIR}/scripts/$${TD}-install.sh ${RD}/dists/${TD}/install.sh; \
978                 fi && \
979                 if [ "${SD}" != "/usr/src" ]; then \
980                         mtree -c -i -p ${SD}/${ARG} \
981                           -k gname,md5digest,mode,nlink,uname,size,link,type \
982                           > ${RD}/dists/${TD}/$$tn.mtree ; \
983                 else \
984                         true; \
985                 fi; \
986                 (cd ${RD}/dists/${TD}; \
987                    rm -f CHECKSUM.MD5; \
988                    md5 * > CHECKSUM.MD5) \
989         )
990
991 doRELEASE:  release.1 release.2 release.3 ${DOCREL} release.4 release.5 \
992                 release.6 release.7 release.8 release.9 ${FIXIT_TARGET}
993         @cd ${.CURDIR} && ${MAKE} ${EXTRAS}
994         @echo "Release done"
995
996 floppies:
997         @cd ${.CURDIR} && ${MAKE} boot.flp
998         @cd ${.CURDIR} && ${MAKE} fixit.flp
999         @cd ${RD} && find floppies -print | cpio -dumpl ${FD}
1000
1001 boot.flp:
1002         @rm -f release.5 release.9
1003         @cd ${.CURDIR} && ${MAKE} release.5 release.9 CRUNCH_TARGETS=boot
1004
1005 fixit.flp:
1006         @rm -f release.5 release.10
1007         @cd ${.CURDIR} && ${MAKE} release.5 release.10 CRUNCH_TARGETS=fixit
1008
1009 installCRUNCH:
1010 .if !defined(CRUNCH)
1011         @echo "CRUNCH undefined in installCRUNCH" && exit 1
1012 .endif
1013 .if !defined(DIR)
1014         @echo "DIR undefined in installCRUNCH" && exit 1
1015 .endif
1016 .if !defined(ZIP)
1017         @echo "ZIP undefined in installCRUNCH" && exit 1
1018 .endif
1019         @if ${ZIP} ; then \
1020                 gzip -9 < ${RD}/crunch/${CRUNCH} > ${DIR}/${CRUNCH}_crunch ; \
1021         else \
1022                 ln -f ${RD}/crunch/${CRUNCH} ${DIR}/${CRUNCH}_crunch ; \
1023         fi
1024         @chmod 555 ${DIR}/${CRUNCH}_crunch
1025         @if [ -f ${.CURDIR}/${TARGET}/${CRUNCH}_crunch.conf ] ; then \
1026                 for i in `crunchgen -l ${.CURDIR}/${TARGET}/${CRUNCH}_crunch.conf` ; do \
1027                         ln -f ${DIR}/${CRUNCH}_crunch ${DIR}/$$i ; \
1028                 done \
1029         else \
1030                 for i in `crunchgen -l ${.CURDIR}/${CRUNCH}_crunch.conf` ; do \
1031                         ln -f ${DIR}/${CRUNCH}_crunch ${DIR}/$$i ; \
1032                 done \
1033         fi
1034
1035 #
1036 # --==## Put a filesystem into a BOOTMFS kernel ##==--
1037 #
1038 doMFSKERN:
1039         @echo "Running ${.TARGET} for ${FSIMAGE}"
1040         @rm -f ${RD}/kernels/BOOTMFS ${RD}/kernels/BOOTMFS.${FSIMAGE}
1041         @cd ${.CURDIR}/../sys/${TARGET}/conf && \
1042             sh ${.CURDIR}/${TARGET}/dokern.sh ${FDSIZE} < GENERIC > BOOTMFS && \
1043             [ -r GENERIC.hints ] && cp GENERIC.hints BOOTMFS.hints
1044 .if defined(FDSIZE) && ${FDSIZE} == "SMALL" && \
1045     exists(${.CURDIR}/${TARGET}/drivers-small.conf)
1046         @awk -f ${.CURDIR}/scripts/driver-remove.awk \
1047                 ${.CURDIR}/${TARGET}/drivers-small.conf \
1048                 ${.CURDIR}/../sys/${TARGET}/conf/BOOTMFS
1049 .elif exists(${.CURDIR}/${TARGET}/drivers.conf)
1050         @awk -f ${.CURDIR}/scripts/driver-remove.awk \
1051                 ${.CURDIR}/${TARGET}/drivers.conf \
1052                 ${.CURDIR}/../sys/${TARGET}/conf/BOOTMFS
1053 .endif
1054         cd ${.CURDIR}/..; \
1055         KERNEL_KO=BOOTMFS KODIR= \
1056             ${CROSSMAKE} ${KERNEL_FLAGS} -DNO_MODULES -DNO_KERNELCLEAN \
1057             KERNCONF=BOOTMFS COPTFLAGS="-Os -pipe" -DNO_CPU_COPTFLAGS \
1058             buildkernel reinstallkernel \
1059             DESTDIR=${RD}/kernels
1060         [ -r ${.CURDIR}/../sys/${TARGET}/conf/BOOTMFS.hints ] && \
1061         cp ${.CURDIR}/../sys/${TARGET}/conf/BOOTMFS.hints ${RD}/kernels
1062         @rm -rf ${RD}/image.${FSIMAGE}
1063         @mkdir ${RD}/image.${FSIMAGE}
1064         @cd ${RD}/kernels && \
1065           (chflags noschg BOOTMFS || true) && \
1066           ${WMAKEENV} strip BOOTMFS && \
1067           cp BOOTMFS BOOTMFS.${FSIMAGE} && \
1068           [ -r BOOTMFS.hints ] && mv BOOTMFS.hints BOOTMFS.${FSIMAGE}.hints
1069         mv ${RD}/kernels/BOOTMFS ${RD}/image.${FSIMAGE}/kernel
1070         @echo "Setting up /boot directory for ${FSIMAGE} floppy"
1071         @mkdir -p ${RD}/image.${FSIMAGE}/boot
1072 .if ${TARGET} == "i386"
1073         @kgzip -vo ${RD}/image.${FSIMAGE}/boot/loader ${RD}/trees/base/boot/loader
1074 .elif ${TARGET_ARCH} == "ia64"
1075         @cp ${RD}/trees/base/boot/loader.efi ${RD}/image.${FSIMAGE}/boot
1076 .else
1077         @cp ${RD}/trees/base/boot/loader ${RD}/image.${FSIMAGE}/boot
1078 .endif
1079         @[ -r ${RD}/kernels/BOOTMFS.${FSIMAGE}.hints ] && \
1080           sed -e '/^hint/s/^/set /' -e '/^#/d' \
1081             ${RD}/kernels/BOOTMFS.${FSIMAGE}.hints > \
1082             ${RD}/image.${FSIMAGE}/boot/device.hints && \
1083           echo "include /boot/device.hints" > ${RD}/image.${FSIMAGE}/boot/loader.rc
1084         @echo "load /kernel" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
1085 .if !defined(FDSIZE) || ${FDSIZE} != "BIG"
1086         @echo "echo \\007\\007" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
1087         @echo "echo Please insert MFS root floppy and press enter:" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
1088         @echo "read" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
1089 .endif
1090         @echo "load -t mfs_root /mfsroot" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
1091 .if ${TARGET_ARCH} != "ia64"
1092         @echo "set hint.acpi.0.disabled=1" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
1093 .endif
1094         @echo "set module_path=\"/modules;/dist\"" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
1095         @echo "echo \\007\\007" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
1096         @echo "autoboot 10" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
1097 .if ${TARGET_ARCH} == "i386" && ${AUTO_KEYBOARD_DETECT}
1098         @echo "-P" >> ${RD}/image.${FSIMAGE}/boot.config
1099 .endif
1100         @gzip -9v ${RD}/image.${FSIMAGE}/kernel
1101         @rm -f ${RD}/floppies/${FSIMAGE}.flp
1102 .if defined(FDSIZE) && ${FDSIZE} == "BIG"
1103         @cp mfsroot.gz ${RD}/image.${FSIMAGE}
1104         sh -e ${DOFS_SH} ${RD}/floppies/${FSIMAGE}.flp \
1105                 ${RD} ${MNT} ${BIGBOOTSIZE} ${RD}/image.${FSIMAGE} \
1106                 ${BOOTINODE} ${BIGBOOTLABEL}
1107 .elif defined(FDSIZE) && ${FDSIZE} == "SMALL"
1108         sh -e ${DOFS_SH} ${RD}/floppies/${FSIMAGE}.flp \
1109                 ${RD} ${MNT} ${SMALLBOOTSIZE} ${RD}/image.${FSIMAGE} \
1110                 ${BOOTINODE} ${SMALLBOOTLABEL}
1111 .else
1112         sh -e ${DOFS_SH} ${RD}/floppies/${FSIMAGE}.flp \
1113                 ${RD} ${MNT} ${BOOTSIZE} ${RD}/image.${FSIMAGE} \
1114                 ${BOOTINODE} ${BOOTLABEL}
1115 .endif
1116         @echo "Created ${RD}/floppies/${FSIMAGE}.flp"
1117
1118 .include <bsd.prog.mk>