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