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