]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - release/Makefile
MF22: Optimize DOC bootstrap.
[FreeBSD/FreeBSD.git] / release / Makefile
1 #       $Id: Makefile,v 1.340 1998/02/01 06:35:44 pst Exp $
2 #
3 # make release CHROOTDIR=/some/dir BUILDNAME=somename [ RELEASETAG=tag ]
4 #
5 # Where "/some/dir" is the pathname of a directory on a some
6 # filesystem with at least 600MB of free space, "somename" is what
7 # you want the release to call itself and, optionally, which CVS "tag"
8 # name should be used when checking out the sources to build the release
9 # (default is HEAD).
10 #
11 # Please note: the vn driver must also be compiled into your kernel,
12 # otherwise the target 'release.8' and possibly others will fail.
13 #
14 # Set these, release builder!
15 #
16 # Fixed version:
17 #BUILDNAME=2.2-RELEASE
18 #
19 # Automatic SNAP versioning:
20 DATE != date +%y%m%d
21 BASE = 3.0
22 BUILDNAME?=${BASE}-${DATE}-SNAP
23 #
24 #CHROOTDIR=/junk/release
25 # If this is a RELEASE, then set
26 #RELEASETAG=RELENG_2_2
27
28 # Uncomment this to disable the doc.1 target.  It is also an ERROR
29 # to set NOPORTS and not set NODOC since docs depend on ports.
30 #NODOC=  YES
31 DOCPORTS= archivers/unzip lang/perl5 textproc/jade textproc/iso8879 \
32           textproc/linuxdoc textproc/docbook textproc/sgmlformat
33
34 # Things which without too much trouble can be considered variables
35 # BIN_DISTS are special in that they get full /etc installation sets.
36 #
37 COMPAT_DISTS?=  compat1x compat20 compat21
38 OTHER_DISTS?=   manpages catpages games proflibs dict info doc
39 CRYPTO_DISTS?=  krb des
40 BIN_DISTS?=     bin
41 DISTRIBUTIONS?= ${BIN_DISTS} ${OTHER_DISTS} ${COMPAT_DISTS} ${CRYPTO_DISTS}
42 KERNELS?=       GENERIC
43
44 # Extra source tarballs; each argument is a pair of source dir and
45 # distribution name.  The dist name should not exceed 7 characters
46 # (another "s" for "source" will be prepended).
47 EXTRA_SRC+=     usr.sbin/sendmail/cf smailcf
48
49 BOOT1=  etc/protocols etc/rc.conf
50
51 # mountpoint for filesystems.
52 MNT=                    /mnt
53
54 # other floppy parameters.
55 FDSIZE=                 1440
56 FDLABEL=                fd1440
57
58 ZIPNSPLIT=              gzip --no-name -9 -c | split -b 240640 -
59
60 # Upper size for the mfs in the boot.flp kernel.
61 # These are adjusted down to the minimum needed by doFS.sh.
62 BOOTMFSSIZE=            1440
63 MFSINODE=               7000
64 FIXITINODE=             2000
65 BOOTINODE=              100000
66
67 # Things which may get you into trouble if you change them
68 MTREEFILES=             ${.CURDIR}/../etc/mtree
69 RD=                     /R/stage
70 FD=                     /R/ftp
71 CD=                     /R/cdrom
72 CD_DISC1=               ${CD}/disc1
73 CD_DISC2=               ${CD}/disc2
74
75 # Where the bootstrap ports (see DOCPORTS) get installed.
76 LOCALDIR=               /usr/local/bin
77
78 # ${BOOTSTRAPDIR} is for those utilities that refer to the hosting
79 # environment, rather than the target environment.  This is specifically
80 # intended for kernel-dependent utilities that are used during the build.
81 #
82 # ${BOOTSTRAPDIR} is actually being used by prepending it to the normal
83 # ${PATH}.  Thus, it's also available to outside utilities like doFS.sh.
84 BOOTSTRAPDIR=   /bootstrap
85 #
86 # The mount subsystem has been changed between 2.2 and 3.0 by the
87 # Lite2 import.
88 BOOTSTRAPUTILS= /sbin/mount /sbin/umount
89 #
90 # 3.0 cpio tries to reference lchown(2) which is not available in 2.2
91 BOOTSTRAPUTILS+= /usr/bin/cpio
92
93 .if !defined(CRUNCH_TARGETS)
94 CRUNCH_TARGETS= boot fixit
95 .endif
96
97 EXTRAS= cdrom.1 ftp.1
98
99 .if !defined(NODOC)
100 DOCREL= doc.1
101 .endif
102
103 REDO?=          sysinstall
104 REDOSED=        sed -e 's/dirs/release.1/' -e 's/trees/release.2/' \
105                     -e 's/kerns/release.3/' -e 's/sysinstall/release.4/' \
106                     -e 's/fixup/release.5/' -e 's/tarbin/release.6/' \
107                     -e 's/tarsrc/release.7/' -e 's/boot\.flp/release.8/' \
108                     -e 's/fixit\.flp/release.9/' -e 's/ftp/ftp.1/' \
109                     -e 's/cdrom/cdrom.1/'
110
111 REDOREDO!=      echo ${REDO} | ${REDOSED}
112
113 rerelease release:
114 .if !defined(CHROOTDIR) || !defined(BUILDNAME) || !defined(CVSROOT)
115         @echo "To make a release you must set CHROOTDIR, BUILDNAME and CVSROOT" && false
116 .endif
117 .if make(release)
118 .if exists(${CHROOTDIR})
119         chflags -R noschg ${CHROOTDIR}/.
120         -rm -rf ${CHROOTDIR}
121 .endif
122         -mkdir -p ${CHROOTDIR}
123         cd ${.CURDIR}/../etc && ${MAKE} distrib-dirs DESTDIR=${CHROOTDIR}
124         cd ${.CURDIR}/../etc && ${MAKE} distribution DESTDIR=${CHROOTDIR}
125         cd ${.CURDIR}/.. && ${MAKE} install DESTDIR=${CHROOTDIR} NOMAN=1
126         mkdir ${CHROOTDIR}/${BOOTSTRAPDIR}
127         for i in ${BOOTSTRAPUTILS} ; do \
128                 cp -p ${CHROOTDIR}$$i ${CHROOTDIR}/${BOOTSTRAPDIR} ; \
129         done
130 .if !defined(RELEASETAG)
131         cd ${CHROOTDIR}/usr && rm -rf src && \
132                 cvs -d ${CVSROOT} co -P src
133 .else
134         cd ${CHROOTDIR}/usr && rm -rf src && \
135                 cvs -d ${CVSROOT} co -P -r ${RELEASETAG} src
136 .endif
137 .if defined(LOCAL_PATCHES) && exists(${LOCAL_PATCHES})
138         cd ${CHROOTDIR}/usr/src && patch --silent < ${LOCAL_PATCHES}
139 .endif
140 .if !defined(NOPORTS)
141         cd ${CHROOTDIR}/usr && rm -rf ports && cvs -d ${CVSROOT} co -P ports && cd ports && make readmes
142 .endif
143 .if !defined(NODOC)
144         cd ${CHROOTDIR}/usr && rm -rf doc && cvs -d ${CVSROOT} co -P doc
145         cd ${CHROOTDIR}/usr/ports && for i in ${DOCPORTS}; do \
146           (cd $$i; make fetch MASTER_SITE_OVERRIDE=file:/usr/ports/distfiles/ \
147             DISTDIR=${CHROOTDIR}/usr/ports/distfiles ); \
148         done
149 .endif
150 .endif
151 .if make(rerelease)
152 .if !defined(RELEASENOUPDATE)
153 .if !defined(RELEASETAG)
154         cd ${CHROOTDIR}/usr/src && cvs -q update -P -d
155 .else
156         cd ${CHROOTDIR}/usr/src && cvs -q update -P -d -r ${RELEASETAG}
157 .endif
158 .if !defined(NOPORTS)
159         cd ${CHROOTDIR}/usr/ports && cvs -q update -P -d
160 .endif
161 .if !defined(NODOC)
162         cd ${CHROOTDIR}/usr/doc && cvs -q update -P -d
163 .endif
164 .endif
165 .endif
166         # Add version information to those things that need it.
167         ( cd ${CHROOTDIR}/usr/src/sys/conf && \
168           mv newvers.sh foo && \
169           sed "s/^RELEASE=.*/RELEASE=${BUILDNAME}/" foo > newvers.sh&& rm foo )
170         ( cd ${CHROOTDIR}/usr/src/release/sysinstall && \
171           sed "s/__RELEASE/${BUILDNAME}/" version.h > version.h.new && \
172           mv version.h.new version.h && \
173           echo XXXX )
174         -test -f install.cfg && cp install.cfg ${CHROOTDIR}/usr/src/release
175         echo "#!/bin/sh"                        > ${CHROOTDIR}/mk
176         echo "set -ex"                          >> ${CHROOTDIR}/mk
177         echo "export CFLAGS='-O2 -pipe'"        >> ${CHROOTDIR}/mk
178         echo "export DISTRIBUTIONS=\"${DISTRIBUTIONS}\"" >> ${CHROOTDIR}/mk
179         echo "export BUILDNAME=${BUILDNAME}"    >> ${CHROOTDIR}/mk
180 .if defined(RELEASETAG)
181         echo "export RELEASETAG=${RELEASETAG}"  >> ${CHROOTDIR}/mk
182 .endif
183 .if defined(NOPORTS)
184         echo "export NOPORTS=${NOPORTS}"        >> ${CHROOTDIR}/mk
185 .endif
186 .if defined(NODOC)
187         echo "export NODOC=${NODOC}"            >> ${CHROOTDIR}/mk
188 .endif
189 .if defined(NOSRC)
190         echo "export NOSRC=${NOSRC}"            >> ${CHROOTDIR}/mk
191 .endif
192 .if defined(NOSHARED)
193         echo "export NOSHARED=${NOSHARED}"      >> ${CHROOTDIR}/mk
194 .endif
195 .if defined(BOOT_CONFIG)
196         echo "export BOOT_CONFIG=\"${BOOT_CONFIG}\"">> ${CHROOTDIR}/mk
197 .endif
198         # Don't remove this, or the build will fall over!
199         echo "export RELEASEDIR=/R"             >> ${CHROOTDIR}/mk
200         echo "export PATH=${BOOTSTRAPDIR}:$${PATH}:${LOCALDIR}" >> ${CHROOTDIR}/mk
201         echo "cd /usr/src"                      >> ${CHROOTDIR}/mk
202 .if make(release)
203         # This eases bootstrapping from a more recent hosting environment:
204         echo "mkdir -p /usr/lib/compat"         >> ${CHROOTDIR}/mk
205         echo "chflags noschg /usr/lib/lib*.so.*" >> ${CHROOTDIR}/mk
206         echo "mv /usr/lib/lib*.so.* /usr/lib/compat" >> ${CHROOTDIR}/mk
207         echo "ldconfig /usr/lib /usr/lib/compat" >> ${CHROOTDIR}/mk
208         echo "(cd include; make all install)"   >> ${CHROOTDIR}/mk
209         echo "(cd etc; make distrib-dirs distribution)" >> ${CHROOTDIR}/mk
210         echo "make world"                       >> ${CHROOTDIR}/mk
211         echo "(cd etc; make distribution)"      >> ${CHROOTDIR}/mk
212         # Now we've got our own shared libs, remove the bootstrapping
213         # libs again.
214         echo "rm -f /usr/lib/compat/*"          >> ${CHROOTDIR}/mk
215         echo "ldconfig /usr/lib"                >> ${CHROOTDIR}/mk
216 .endif
217 .if make(rerelease)
218         echo "make all install"                 >> ${CHROOTDIR}/mk
219 .endif
220         echo "cd /usr/src/release/sysinstall"   >> ${CHROOTDIR}/mk
221         echo "make obj"                         >> ${CHROOTDIR}/mk
222         echo "cd /usr/src/release"              >> ${CHROOTDIR}/mk
223         echo "make objlink"                     >> ${CHROOTDIR}/mk
224         echo "(cd obj; rm -f ${REDOREDO})"      >> ${CHROOTDIR}/mk
225         echo "make doRELEASE"                   >> ${CHROOTDIR}/mk
226         echo "echo make ${.TARGET} Finished"    >> ${CHROOTDIR}/mk
227         chmod 755 ${CHROOTDIR}/mk
228         chroot ${CHROOTDIR} /mk
229
230 clean:
231         rm -rf boot_crunch release.[0-9]
232
233 # Clean out /R and make the directory structure.
234 release.1:
235         -mkdir /R
236         chflags -R noschg /R/.
237         rm -rf /R/*
238         mkdir ${RD}
239         mkdir ${RD}/floppies
240         mkdir ${RD}/trees
241         mkdir ${RD}/dists
242         mkdir ${RD}/kernels
243         for i in ${DISTRIBUTIONS} ; do \
244                 mkdir ${RD}/trees/$$i && \
245                 mkdir ${RD}/dists/$$i && \
246                 mtree -deU -f ${MTREEFILES}/BSD.root.dist \
247                     -p ${RD}/trees/$$i > /dev/null && \
248                 mtree -deU -f ${MTREEFILES}/BSD.usr.dist \
249                     -p ${RD}/trees/$$i/usr > /dev/null && \
250                 mtree -deU -f ${MTREEFILES}/BSD.include.dist \
251                     -p ${RD}/trees/$$i/usr/include > /dev/null && \
252                 mtree -deU -f ${MTREEFILES}/BSD.var.dist \
253                     -p ${RD}/trees/$$i/var > /dev/null ; \
254         done
255         touch release.1
256
257 # Install the system into the various distributions.
258 release.2:
259         cd ${.CURDIR}/../etc && make distrib-dirs DESTDIR=${RD}/trees/bin
260         cd ${.CURDIR}/.. && make distribute DISTDIR=${RD}/trees
261 .if exists(${.CURDIR}/../kerberosIV) && !defined(NOKERBEROS)
262         cd ${.CURDIR}/../kerberosIV && ( \
263                 make bootstrap &&\
264                 make obj all help-distribute DISTDIR=${RD}/trees &&\
265                 make kprog \
266         )
267 .endif
268         chflags -R noschg ${RD}/trees
269         touch release.2
270
271 # Make and install the generic kernel(s).
272 release.3:
273 .for kernel in ${KERNELS}
274         rm -f ${RD}/kernels/${kernel}
275         rm -rf ${.CURDIR}/../sys/compile/${kernel}
276         cd ${.CURDIR} && ${MAKE} doKERNEL KERNEL=${kernel}
277         rm -rf ${.CURDIR}/../sys/compile/${kernel}
278         ln -f ${RD}/kernels/${kernel} ${RD}/trees/bin/kernel.${kernel}
279 .endfor
280         touch release.3
281
282 # Make and install the three crunched binaries which live on the floppies.
283 # You are not supposed to like this :-)
284 #
285 # NB: the "RELEASE_BUILD_FIXIT" magic prevents vi from including the
286 # Tcl and Perl APIs.  See also /usr/src/usr.bin/vi/Makefile.
287 release.4:
288         @mkdir -p /stand
289         cd ${.CURDIR}/sysinstall && make obj depend all install
290         rm -rf ${RD}/crunch
291         mkdir -p ${RD}/crunch
292         export RELEASE_BUILD_FIXIT=noway ; \
293         for j in ${CRUNCH_TARGETS} ; do \
294                 rm -rf $${j}_crunch && \
295                 mkdir $${j}_crunch && \
296                 ( cd $${j}_crunch && \
297                 crunchgen ${.CURDIR}/$${j}_crunch.conf && \
298                 ${MAKE} -DRELEASE_CRUNCH -f $${j}_crunch.mk subclean all \
299                     NOCRYPT=yes "CFLAGS=${CFLAGS} -DCRUNCHED_BINARY") && \
300                 mv $${j}_crunch/$${j}_crunch ${RD}/crunch/$${j} && \
301                 true || { rm -rf $${j}_crunch ; false ; } ; \
302         done
303         touch release.4
304
305 #
306 # --==## Fix up the distributions. ##==--
307 #
308 release.5:
309         # Handle some grief caused by the munition braindeadness.
310         for i in sbin/init bin/ed ; do \
311                 ( cd ${.CURDIR}/../$$i; \
312                   make -DNOCRYPT clean all distribute DISTDIR=${RD}/trees ) ; \
313         done
314
315         # Create any "synthetic dists" now.
316         @for i in ${DISTRIBUTIONS}; do \
317                 if [ -f ${.CURDIR}/scripts/$${i}-make.sh ]; then \
318                         echo -n "Running $$i dist creation script... "; \
319                         env RD=${RD} sh ${.CURDIR}/scripts/$${i}-make.sh || echo "$$i distribution script returned bad status."; \
320                         echo "Done."; \
321                 fi \
322         done \
323
324         # Create symlinks for the MD5-based crypt lib, too.  The
325         # automatically created links still point to the DES stuff,
326         # which went into its own distribution.
327         for i in ${RD}/trees/bin/usr/lib/libscrypt* ; do \
328                 c=`echo $$i | sed -e 's/libscrypt/libcrypt/'` ; \
329                 rm -f $$c ; \
330                 ln -s `basename $$i` $$c ; \
331         done
332
333         # Remove all the directories we don't need.
334         -cd ${RD}/trees && \
335                 find ${OTHER_DISTS} ${COMPAT_DISTS} ${CRYPTO_DISTS} -depth -type d -print | xargs rmdir
336         touch release.5
337
338 #
339 # --==## Package up the tarballs from assembled trees ##==--
340 #
341 release.6:
342         rm -rf ${RD}/dists
343         mkdir -p ${RD}/dists
344         @for i in ${DISTRIBUTIONS} ; \
345         do \
346                 if [ -d ${RD}/trees/$${i} ] ; then \
347                         cd ${.CURDIR} && $(MAKE) doTARBALL \
348                                 SD=${RD}/trees/$${i} \
349                                 TN=$$i TD=$$i ARG="." && \
350                         echo "$${i} distribution is finished."; \
351                 fi ; \
352         done
353         # More munition braindeadness.
354         ( cd ${RD}/dists && \
355                 if [ -f krb/krb.aa ] ; then mv krb/* des && rmdir krb ; fi )
356         touch release.6
357
358
359 #
360 # --==## Make source dists ##==--
361 #
362 release.7:
363 .if !defined(NOSRC)
364         @cd ${.CURDIR} && $(MAKE) doTARBALL SD=/usr/src \
365                 TD=src TN=sbase ARG="[A-Z]*"
366         @for i in `cd /usr/src && echo [a-z]*` ; do \
367                 if [ -d /usr/src/$$i ] ; then \
368                         cd ${.CURDIR} && $(MAKE) doTARBALL \
369                                 TN=`echo s$$i | tr -d '.' | sed 's/usr/u/'` \
370                                 SD=/usr/src TD=src ARG="$$i" ; \
371                 fi ; \
372         done
373 .if defined(EXTRA_SRC)
374         @set ${EXTRA_SRC} && \
375         while [ $$# -ge 2 ] ; do \
376                 if [ -d /usr/src/$$1 ] ; then \
377                         cd ${.CURDIR} && $(MAKE) doTARBALL \
378                                 SD=/usr/src TN="s$$2" TD=src ARG="$$1" ; \
379                 fi && shift && shift ; \
380         done
381 .endif
382         ( cd ${RD}/dists/src && \
383                 if [ -f ssecure.aa ] ; then mv ssecure.* ../des ; fi && \
384                 if [ -f scrypto.aa ] ; then mv scrypto.* ../des ; fi && \
385                 if [ -f skerbero.aa ] ; then mv skerbero.* ../des ; fi ; )
386         @echo "src distribution is finished."
387 .endif
388         touch release.7
389
390 # Complete the bootfd
391 #
392 # Now, just to get this picture down once and for all:
393 #
394 # +------------------------------------------------------------------------+
395 # |boot.flp                                                                |
396 # +-----+-----+------------------------------------------------------------+
397 # |boot1|boot2|floppy filesystem "bootfd"                                  |
398 # +-----+-----+-+--------------------------------------------------------+-+
399 #               |kernel                                                  |
400 #               +------------+-----------------------------------------+-+
401 #                            |mfs filesystem "mfsfd"                   |
402 #                            +-----------------------------------------+
403 #
404
405 release.8: write_mfs_in_kernel dumpnlist
406         rm -rf ${RD}/mfsfd
407         mkdir ${RD}/mfsfd
408         cd ${RD}/mfsfd && \
409                 mkdir -p etc dev mnt stand/help
410         @cp ${.CURDIR}/../sys/i386/boot/biosboot/boot.help ${RD}/mfsfd/stand
411         @cd ${.CURDIR} && $(MAKE) installCRUNCH CRUNCH=boot \
412                 DIR=${RD}/mfsfd/stand ZIP=false
413         ( cd ${RD}/trees/bin/dev && \
414                 ls console tty ttyv0 ttyv1 ttyv2 ttyv3 null zero \
415                 *[swo]d* cuaa[01] cuaa[23] fd[01] rfd[01] \
416                 cd0a mcd0a scd0a matcd0a wcd0c rst0 rft0 rwt0 | \
417         cpio -dump ${RD}/mfsfd/dev )
418         ( cd ${RD}/mfsfd/dev && rm -f *[swo]d*[bdefgh] )
419         cd ${RD}/trees/bin && ls ${BOOT1} | cpio -dump ${RD}/mfsfd/stand
420         echo "nameserver      42/tcp name"      > ${RD}/mfsfd/stand/etc/services
421         echo "ftp             21/tcp"           >> ${RD}/mfsfd/stand/etc/services
422         echo "domain          53/tcp          nameserver" >> ${RD}/mfsfd/stand/etc/services
423         echo "domain          53/udp          nameserver" >> ${RD}/mfsfd/stand/etc/services
424         echo "cmd             514/tcp    shell" >> ${RD}/mfsfd/stand/etc/services
425         gzip -c ${.CURDIR}/../COPYRIGHT > ${RD}/mfsfd/stand/help/COPYRIGHT.hlp.gz
426         -test -f ${.CURDIR}/install.cfg && cp ${.CURDIR}/install.cfg ${RD}/mfsfd
427         @echo "Making the regular boot floppy."
428         tar --exclude CVS -cf - -C ${.CURDIR}/sysinstall help | \
429                 tar xvf - -C ${RD}/mfsfd/stand
430         @echo "Compressing doc files..."
431         @gzip -9 ${RD}/mfsfd/stand/help/*.hlp
432         sh -e ${.CURDIR}/doFS.sh ${RD} ${MNT} ${BOOTMFSSIZE} ${RD}/mfsfd \
433                 ${MFSINODE} minimum
434         mv fs-image fs-image.std
435         mv fs-image.size fs-image.std.size
436         cd ${.CURDIR} && ${MAKE} doMFSKERN FSIMAGE=std
437         mv ${RD}/floppies/bootstd.flp ${RD}/floppies/boot.flp
438         @echo "Regular boot floppy made."
439         touch release.8
440
441 #
442 # --==## Create a fixit floppy ##==--
443 #
444 release.9:
445         rm -rf ${RD}/fixitfd
446         mkdir ${RD}/fixitfd
447         cd ${RD}/fixitfd && \
448                 mkdir -p dev stand bin sbin etc mnt mnt1 mnt2 mnt3 mnt4 tmp \
449                 usr/share/misc usr/mdec
450         @cd ${.CURDIR} && $(MAKE) installCRUNCH CRUNCH=fixit \
451                 DIR=${RD}/fixitfd/stand ZIP=false
452         ( cd ${RD}/fixitfd/dev && \
453                 sed -e '/^PATH/s/^/#/' ${RD}/trees/bin/dev/MAKEDEV > MAKEDEV && \
454                 chmod 755 MAKEDEV && \
455                 sh MAKEDEV all )
456         cp ${RD}/trees/bin/etc/spwd.db ${RD}/trees/bin/etc/group \
457                 ${RD}/trees/bin/etc/protocols ${RD}/fixitfd/etc
458         cp ${RD}/trees/bin/usr/share/misc/scsi_modes \
459                 ${RD}/fixitfd/usr/share/misc
460         cp ${RD}/trees/bin/usr/mdec/boot[12] ${RD}/fixitfd/usr/mdec
461         for type in fd od sd wd ; do \
462                 ( cd ${RD}/fixitfd/usr/mdec && ln -s boot1 $${type}boot && \
463                         ln -s boot2 boot$${type} ) ; \
464         done
465         cp ${.CURDIR}/fixit.profile ${RD}/fixitfd/.profile
466         cp ${.CURDIR}/fixit.services ${RD}/fixitfd/etc/services
467         cp ${.CURDIR}/tar.sh ${RD}/fixitfd/stand/tar
468         chmod 555 ${RD}/fixitfd/stand/tar
469         sh -e ${.CURDIR}/doFS.sh ${RD} ${MNT} ${FDSIZE} ${RD}/fixitfd \
470                 ${FIXITINODE} ${FDLABEL}
471         mv fs-image ${RD}/floppies/fixit.flp
472 # Do our last minute floppies directory setup in a convenient place.
473         cp ${.CURDIR}/README.TXT ${RD}/floppies/README.TXT
474         @(cd ${RD}/floppies; md5 * > CHECKSUM.MD5)
475         touch release.9
476
477 #
478 # --==## Setup a suitable ftp-area ##==--
479 #
480 ftp.1:
481         mkdir -p ${FD}
482         cd ${RD} && find floppies -print | cpio -dumpl ${FD}
483         cd ${RD}/dists && find . -print | cpio -dumpl ${FD}
484         cp ${.CURDIR}/ABOUT.TXT ${FD}/ABOUT.TXT
485         cp ${.CURDIR}/sysinstall/help/readme.hlp ${FD}/README.TXT
486         cp ${.CURDIR}/sysinstall/help/hardware.hlp ${FD}/HARDWARE.TXT
487         cp ${.CURDIR}/sysinstall/help/install.hlp ${FD}/INSTALL.TXT
488         cp ${.CURDIR}/sysinstall/help/relnotes.hlp ${FD}/RELNOTES.TXT
489         echo "CD_VERSION = ${BUILDNAME}" > ${FD}/cdrom.inf
490 .if !defined(NOPORTS)
491         tar -cBf - -C ${CD_DISC1} ports | tar -xBf - -C ${FD}
492 .endif
493
494 #
495 # --==## Setup a suitable cdrom-area ##==--
496 #
497 cdrom.1:
498         mkdir -p ${CD_DISC1} ${CD_DISC2}
499         cd ${RD} && find floppies -print | cpio -dumpl ${CD_DISC1}
500         cd ${RD}/dists && find . -print | cpio -dumpl ${CD_DISC1}
501         ln -f ${RD}/kernels/MFSKERNEL.std ${CD_DISC1}/kernel
502         ln -f ${RD}/trees/bin/usr/mdec/fbsdboot.exe ${CD_DISC1}
503         for i in ${DISTRIBUTIONS} ; \
504         do \
505                 if [ -d ${RD}/trees/$${i} ] ; then \
506                         chflags -R noschg ${RD}/trees/$${i} ; \
507                         ( cd ${RD}/trees/$${i} && \
508                         find . -depth -print | cpio -dumpl ${CD_DISC2} ) ; \
509                 fi \
510         done
511         rm -f ${CD_DISC2}/.profile
512         cp ${.CURDIR}/fixit.profile ${CD_DISC2}/.profile
513         echo "CD_VERSION = ${BUILDNAME}" > ${CD_DISC1}/cdrom.inf
514         echo "CD_VERSION = ${BUILDNAME}" > ${CD_DISC2}/cdrom.inf
515         cp ${.CURDIR}/ABOUT.TXT ${CD_DISC1}/ABOUT.TXT
516         cp ${.CURDIR}/sysinstall/help/readme.hlp ${CD_DISC1}/README.TXT
517         cp ${.CURDIR}/sysinstall/help/hardware.hlp ${CD_DISC1}/HARDWARE.TXT
518         cp ${.CURDIR}/sysinstall/help/install.hlp ${CD_DISC1}/INSTALL.TXT
519         cp ${.CURDIR}/sysinstall/help/relnotes.hlp ${CD_DISC1}/RELNOTES.TXT
520 .if !defined(NOPORTS)
521         tar -cBf - -C /usr ports | tar xBpf - -C ${CD_DISC2} && \
522           mkdir -p ${CD_DISC1}/ports && \
523           tar -czf ${CD_DISC1}/ports/ports.tgz -C /usr ports && \
524           cp ${.CURDIR}/scripts/ports-install.sh ${CD_DISC1}/ports/install.sh && \
525                 (cd ${CD_DISC1}/ports; md5 * > CHECKSUM.MD5)
526         ln -s ../ports ${CD_DISC2}/usr/ports
527 .endif
528
529 doc.1:
530         for i in ${DOCPORTS}; do \
531           cd /usr/ports/$$i && make all install clean FORCE_PKG_REGISTER=yes; \
532         done
533         cd /usr/doc && make all distribute DISTDIR=${RD}/trees
534
535 # Various "subroutine" and other supporting targets.
536
537 doTARBALL:
538 .if !defined(SD)
539         @echo "SD undefined in doTARBALL" && exit 1
540 .endif
541 .if !defined(TD)
542         @echo "TB undefined in doTARBALL" && exit 1
543 .endif
544 .if !defined(ARG)
545         @echo "ARG undefined in doTARBALL" && exit 1
546 .endif
547         rm -rf ${RD}/dists/${TD}/${TN}*
548         mkdir -p ${RD}/dists/${TD}
549         ( cd ${SD} && \
550                 tn=`echo ${TN} | tr '[A-Z]' '[a-z]' | cut -c1-8` && \
551                 echo rolling ${TD}/$$tn tarball &&\
552                 tar --exclude CVS --exclude obj --exclude BOOTMFS -cf - ${ARG} | \
553                 ${ZIPNSPLIT} ${RD}/dists/${TD}/$$tn. && \
554                 sh ${.CURDIR}/info.sh ${RD}/dists/${TD}/$$tn > \
555                    ${RD}/dists/${TD}/$$tn.inf && \
556                 if [ -f ${.CURDIR}/scripts/$${TD}-install.sh ]; then \
557                   cp -p ${.CURDIR}/scripts/$${TD}-install.sh ${RD}/dists/${TD}/install.sh; \
558                 fi && \
559                 if [ "${SD}" != "/usr/src" ]; then \
560                         mtree -c -i -p ${SD}/${ARG} \
561                           -k gname,md5digest,mode,nlink,uname,size,link,type \
562                           > ${RD}/dists/${TD}/$$tn.mtree ; \
563                 else \
564                         true; \
565                 fi; \
566                 (cd ${RD}/dists/${TD}; \
567                    rm -f CHECKSUM.MD5; \
568                    md5 * > CHECKSUM.MD5) \
569         )
570
571 doRELEASE:  release.1 release.2 ${DOCREL} release.3 release.4 release.5 \
572                 release.6 release.7 release.8 release.9
573         cd ${.CURDIR} && ${MAKE} ${EXTRAS}
574         @echo "Release done"
575
576 floppies:
577         cd ${.CURDIR} && ${MAKE} boot.flp
578         cd ${.CURDIR} && ${MAKE} fixit.flp
579         cd ${RD} && find floppies -print | cpio -dumpl ${FD}
580
581 boot.flp:
582         rm -f release.4 release.8
583         cd ${.CURDIR} && ${MAKE} release.4 release.8 CRUNCH_TARGETS=boot
584
585 fixit.flp:
586         rm -f release.4 release.9
587         cd ${.CURDIR} && ${MAKE} release.4 release.9 CRUNCH_TARGETS=fixit
588
589 write_mfs_in_kernel:    ${.CURDIR}/write_mfs_in_kernel.c
590         ${CC} ${CFLAGS} -o write_mfs_in_kernel ${.CURDIR}/write_mfs_in_kernel.c
591
592 dumpnlist:      ${.CURDIR}/dumpnlist.c
593         ${CC} ${CFLAGS} -o dumpnlist ${.CURDIR}/dumpnlist.c
594
595 installCRUNCH:
596 .if !defined(CRUNCH)
597         @echo "CRUNCH undefined in installCRUNCH" && exit 1
598 .endif
599 .if !defined(DIR)
600         @echo "DIR undefined in installCRUNCH" && exit 1
601 .endif
602 .if !defined(ZIP)
603         @echo "ZIP undefined in installCRUNCH" && exit 1
604 .endif
605         if ${ZIP} ; then \
606                 gzip -9 < ${RD}/crunch/${CRUNCH} > ${DIR}/${CRUNCH}_crunch ; \
607         else \
608                 ln -f ${RD}/crunch/${CRUNCH} ${DIR}/${CRUNCH}_crunch ; \
609         fi
610         chmod 555 ${DIR}/${CRUNCH}_crunch
611         for i in `crunchgen -l ${.CURDIR}/${CRUNCH}_crunch.conf` ; do \
612                 ln -f ${DIR}/${CRUNCH}_crunch ${DIR}/$$i ; \
613         done
614
615 #
616 # --==## Compile a kernel by name ${KERNEL} ##==--
617 #
618 # We don't erase the sys/compile/${KERNEL} directory, since somebody
619 # may want to reuse it (release.8 presently)
620 #
621 doKERNEL:
622         rm -f ${RD}/kernels/${KERNEL}
623         cd ${.CURDIR}/../sys/i386/conf && config -n ${KERNEL}
624         cd ${.CURDIR}/../sys/compile/${KERNEL} && \
625                         make  depend && \
626                         make  kernel && \
627                         cp kernel ${RD}/kernels/${KERNEL}
628
629 #
630 # --==## Put a filesystem into a BOOTMFS kernel ##==--
631 #
632 doMFSKERN:
633         @rm -f ${RD}/kernels/BOOTMFS.${FSIMAGE}
634         @rm -f /sys/compile/BOOTMFS/mfs_vfsops.o
635         @cd ${.CURDIR}/../sys/i386/conf && \
636           sed   -e '/SYSV/d' \
637                 -e '/pty/d' \
638                 -e '/PROCFS/d' \
639                 -e '/KTRACE/d' \
640                 -e 's/GENERIC/BOOTMFS/g' \
641                 -e '/maxusers/s/10/4/' < GENERIC > BOOTMFS && \
642           echo "options  MFS" >> BOOTMFS && \
643           echo "options  NFS_NOSERVER" >> BOOTMFS && \
644           echo 'options  "MAXCONS=4"' >> BOOTMFS && \
645           echo "options  USERCONFIG_BOOT" >> BOOTMFS
646         @echo "options \"MFS_ROOT=`cat fs-image.${FSIMAGE}.size`\"" >> \
647           ${.CURDIR}/../sys/i386/conf/BOOTMFS
648         cd ${.CURDIR} && ${MAKE} doKERNEL KERNEL=BOOTMFS
649         @rm -rf ${RD}/boot.${FSIMAGE}
650         @mkdir  ${RD}/boot.${FSIMAGE}
651         @mv ${RD}/kernels/BOOTMFS ${RD}/kernels/BOOTMFS.${FSIMAGE}
652         @cp ${RD}/kernels/BOOTMFS.${FSIMAGE} ${RD}/boot.${FSIMAGE}/kernel
653 .if defined(BOOT_CONFIG)
654         @echo "${BOOT_CONFIG}" >${RD}/boot.${FSIMAGE}/boot.config
655 .endif
656         @vnconfig /dev/vn0 fs-image.${FSIMAGE}
657         @mkdir -p /tmp/mnt_xx
658         @mount /dev/vn0 /tmp/mnt_xx
659         ./dumpnlist ${RD}/boot.${FSIMAGE}/kernel > /tmp/mnt_xx/stand/symbols
660         @umount /tmp/mnt_xx
661         @vnconfig -u /dev/vn0
662         @rmdir /tmp/mnt_xx
663         ./write_mfs_in_kernel ${RD}/boot.${FSIMAGE}/kernel \
664                 fs-image.${FSIMAGE}
665         kzip -v ${RD}/boot.${FSIMAGE}/kernel
666         @mv ${RD}/boot.${FSIMAGE}/kernel ${RD}/kernels/MFSKERNEL.${FSIMAGE}
667         @mv ${RD}/boot.${FSIMAGE}/kernel.kz ${RD}/boot.${FSIMAGE}/kernel
668         @cp ${.CURDIR}/../sys/i386/boot/biosboot/boot.help ${RD}/boot.${FSIMAGE}
669         @touch ${RD}/boot.${FSIMAGE}/boot.config
670         @touch ${RD}/boot.${FSIMAGE}/kernel.config
671         @rm -f ${RD}/floppies/boot${FSIMAGE}.flp
672         sh -e ${.CURDIR}/doFS.sh ${RD} ${MNT} ${FDSIZE} ${RD}/boot.${FSIMAGE} \
673                 ${BOOTINODE} ${FDLABEL}
674         mv fs-image ${RD}/floppies/boot${FSIMAGE}.flp
675
676 .include <bsd.prog.mk>