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