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