]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - release/Makefile
This commit was generated by cvs2svn to compensate for changes in r124861,
[FreeBSD/FreeBSD.git] / release / Makefile
1 # $FreeBSD$
2 #
3 # make release [BUILDNAME=somename] CHROOTDIR=/some/dir CVSROOT=/cvs/dir \
4 #     [RELEASETAG=tag]
5 #
6 # Where "/some/dir" is the pathname of a directory on a some filesystem with
7 # at least 1000MB of free space, "somename" is what you want the release to
8 # call itself, "/cvs/dir" is where our source repo resides and, optionally,
9 # which CVS "tag" name should be used when checking out the sources to build
10 # the release (default is HEAD).
11 #
12 # Please note: the md(4) driver must be present in the kernel
13 # (either by being compiled in or available as a kld(4) module),
14 # otherwise the target 'release.9' and possibly others will fail.
15 #
16 # Note: If you add options to this file, please keep release(7) updated!
17 #
18 # Set these, release builder!
19 #
20 # Fixed version:
21 #BUILDNAME=5.2-RELEASE
22 #
23 # Automatic SNAP versioning:
24 DATE != date +%Y%m%d
25 BASE = 5.2
26 BUILDNAME?=${BASE}-${DATE}-SNAP
27 #
28 #CHROOTDIR=/junk/release
29 # If this is a -stable snapshot, then set
30 #RELEASETAG=RELENG_4
31 #
32 # To test a release with a source tree containing patches and
33 # other work. This tree will get copied instead of getting the
34 # src/ tree from a CVS checkout. For "rerelease", this will NOT
35 # be copied; cvs update will be used instead.
36 #EXTSRCDIR=/usr/src
37 #
38 # To add other options to the CVS subcommands (co,up), set
39 #CVSCMDARGS="-D '01/01/2002 00:00:00 UTC'"
40 #
41 # To add other options to the CVS command, set
42 #CVSARGS="-lfq"
43 #
44 # To prefix the cvs command
45 #CVSPREFIX="/usr/bin/time"
46 #
47 # Where the CVS repository is
48 #CVSROOT="/home/ncvs"
49 #
50 # Non-zero if ${RELEASETAG} is in the form "RELENG_ver_RELEASE"; we
51 # are building an official release.  Otherwise, we are building for
52 # a branch.
53 .if defined(RELEASETAG)
54 ISRELEASE!=     expr "${RELEASETAG}" : '^RELENG_.*_RELEASE$$' || true
55 .if ${ISRELEASE} != 0
56 # Convert "RELENG_ver_RELEASE" to "RELEASE_ver" for ports and doc trees.
57 AUXRELEASETAG!= echo ${RELEASETAG} | sed -e 's/^RELENG_/RELEASE_/' -e 's/_RELEASE$$//'
58 DOCRELEASETAG?=         ${AUXRELEASETAG}
59 PORTSRELEASETAG?=       ${AUXRELEASETAG}
60 .endif
61 .endif
62
63 # If you want to pass flags to the world build such as -j X, use
64 # WORLD_FLAGS.  Similarly, you can specify make flags for kernel
65 # builds via KERNEL_FLAGS.
66 # Similarly, you can specify make flags for make readmes via PORTREADMES_FLAGS.
67 #WORLD_FLAGS=-j4
68 #KERNEL_FLAGS=-j4
69 #PORTREADMES_FLAGS=-j4
70
71 TARGET_ARCH?=   ${MACHINE_ARCH}
72 .if ${TARGET_ARCH} == ${MACHINE_ARCH}
73 TARGET?=        ${MACHINE}
74 .else
75 TARGET?=        ${TARGET_ARCH}
76 .endif
77 CROSSENV=       TARGET_ARCH=${TARGET_ARCH} TARGET=${TARGET}
78 CROSSMAKE=      ${MAKE} ${CROSSENV}
79 NATIVEMAKE=     ${MAKE} TARGET_ARCH=${MACHINE_ARCH} TARGET=${MACHINE}
80
81 # If you are using a local CVS repository with components stored in 
82 # non-standard modules, override these on the make commandline or
83 # in the environment.
84 RELEASESRCMODULE?=      src
85 RELEASEDOCMODULE?=      doc
86 RELEASEPORTSMODULE?=    ports
87
88 # Uncomment this to disable the doc.1 target.  Docs normally require
89 # the ports tree, so NOPORTS can be set together with NODOC in order
90 # to have neither ports or docs.  If only NOPORTS is set to YES, but
91 # docs are still desired, the DOMINIMALDOCPORTS logic below will only
92 # install the ports that are minimally required for the docs.  This is
93 # intended as a compromise, less disk space is required than for using
94 # the entire ports collection (and much less time due to the huge number
95 # of directories it would create), but still quite a bit as well as some
96 # CPU cycles (some of the programs are C++, and things like ghostscript
97 # belong to the required ports nevertheless).
98 #
99 # Setting this also disables building of release note documentation
100 # (RELNOTESng).
101 #NODOC=  YES
102 #NOPORTS=  YES
103
104 # Modify this definition if you want the release notes 
105 # and other release documentation in a language other than English.
106 RELNOTES_LANG?= en_US.ISO8859-1
107
108 # As an alternative to installing the entire ports collection (which
109 # can take a huge amount of time, in particular on slower disks),
110 # setting ${MINIMALDOCPORTS} allows to install and build just those
111 # ports that are really required for getting the docs up & running.
112 .if defined(NOPORTS) && !defined(NODOC)
113 DOMINIMALDOCPORTS=      YES
114 .include "Makefile.inc.docports"
115 RELEASEPORTSMODULE=     ${MINIMALDOCPORTS}
116 .endif
117
118 # Helper variable
119 .if defined(NOPORTS)
120 .if !defined(DOMINIMALDOCPORTS) || ${DOMINIMALDOCPORTS} != "YES"
121 NOPORTSATALL=   YES
122 .endif
123 .endif
124
125 # By default, documentation (Handbook, FAQ, etc.) is built for all
126 # the languages.  To speed up building, set the DOC_LANG to just
127 # the languages you need.  (The language for the release notes is
128 # controlled by the RELNOTES_LANG variable above.)
129 #DOC_LANG=      en_US.ISO8859-1
130 DOCPORTS=       textproc/docproj
131 # Set this to wherever the distfiles required by release procedures.
132 .if defined(DOCDISTFILES)
133 # Respect DOCDISTFILES which is used before.
134 RELEASEDISTFILES?=      ${DOCDISTFILES}
135 .else
136 RELEASEDISTFILES?=      ${.CURDIR}/../../ports/distfiles
137 .endif
138 # Set this to 1 if you want -P to be used for automatic keyboard detection
139 # on the boot floppy.  WARNING: Breaks on some Athlon (K7) motherboards.
140 AUTO_KEYBOARD_DETECT?= 0
141
142 .if !defined(NODOC)
143 DIST_DOCS_ARCH_INDEP=   readme errata early-adopter
144 DIST_DOCS_ARCH_DEP=     installation relnotes hardware
145 .endif
146
147 # Things which without too much trouble can be considered variables
148 # BASE_DISTS are special in that they get full /etc installation sets.
149 #
150 .if ${TARGET_ARCH} == "i386"
151 COMPAT_DISTS?=  compat1x compat20 compat21 compat22 compat3x compat4x
152 .elif ${TARGET_ARCH} != "ia64"
153 COMPAT_DISTS?=  compat4x
154 .endif
155 OTHER_DISTS?=   catpages manpages games proflibs dict info doc
156 CRYPTO_DISTS?=  crypto
157 BASE_DISTS?=    base
158 DISTRIBUTIONS?= ${BASE_DISTS} ${OTHER_DISTS} ${COMPAT_DISTS} ${CRYPTO_DISTS}
159
160 # mountpoint for filesystems.
161 MNT=                    /mnt
162
163 # Various floppy image parameters.
164 #
165
166 .if ${TARGET_ARCH} == "i386"
167 .if ${TARGET} == "pc98"
168 SMALLBOOTSIZE=          1200
169 BOOTSIZE=               1440
170 SMALLFIXITSIZE=         1200
171 FIXITSIZE=              1440
172 MFSSIZE=                4320
173 BOOTINODE=              80000
174 FIXITINODE=             40000
175 MFSINODE=               8000
176 SMALLBOOTLABEL=         fd1200
177 BOOTLABEL=              fd1440
178 SMALLFIXITLABEL=        fd1200
179 FIXITLABEL=             fd1440
180 MFSLABEL=               minimum3
181 .else
182 DRIVERSIZE=             1440
183 BOOTSIZE=               1440
184 FIXITSIZE=              1440
185 MFSSIZE=                4320
186 BIGBOOTSIZE=            2880
187 DRIVERINODE=            40000
188 BOOTINODE=              80000
189 FIXITINODE=             40000
190 MFSINODE=               8000
191 DRIVERLABEL=            fd1440
192 BOOTLABEL=              fd1440
193 FIXITLABEL=             fd1440
194 MFSLABEL=               minimum3
195 BIGBOOTLABEL=           minimum2
196 .endif
197 .elif ${TARGET_ARCH} == "alpha"
198 MFSSIZE=                4320
199 MFSINODE=               8000
200 MFSLABEL=               auto
201 NO_FLOPPIES=
202 .elif ${TARGET_ARCH} == "sparc64"
203 DISKLABEL=              sunlabel
204 MFSSIZE=                4096
205 MFSINODE=               8192
206 MFSLABEL=               auto
207 MINIROOT=
208 NO_FLOPPIES=
209 .elif ${TARGET_ARCH} == "ia64"
210 MFSINODE=               8192
211 MFSLABEL=               auto
212 MFSSIZE=                8192
213 NO_FLOPPIES=
214 .elif ${TARGET_ARCH} == "amd64"
215 MFSSIZE=                4096
216 MFSINODE=               8192
217 MFSLABEL=               auto
218 NO_FLOPPIES=
219 .endif
220
221 .if exists(/sbin/bsdlabel)
222 DISKLABEL?=             bsdlabel
223 .else
224 DISKLABEL?=             disklabel
225 .endif
226
227 ZIPNSPLIT=              gzip --no-name -9 -c | split -b 1423k -
228
229 # Things that need to be compiled without crypto support in releases
230 .if !defined(FIXCRYPTO) && !make(release) && !make(rerelease)
231 FIXCRYPTO!=     cd ${.CURDIR}/../secure; ${MAKE} -V SPROGS
232 .endif
233
234 # Things which may get you into trouble if you change them
235 MTREEFILES=             ${.CURDIR}/../etc/mtree
236 _R?=                    /R
237 RD=                     ${_R}/stage
238 RND=                    ${RD}/release.doc
239 FD=                     ${_R}/ftp
240 CD=                     ${_R}/cdrom
241 .if ${TARGET} != "pc98"
242 CD_BOOT=                ${CD}/bootonly
243 .endif
244 CD_DISC1=               ${CD}/disc1
245 CD_DISC2=               ${CD}/disc2
246 _MK?=                   ${CHROOTDIR}/mk
247
248 # Where the bootstrap ports (see DOCPORTS) get installed.
249 LOCALDIR=               /usr/local/bin
250
251 .if ${TARGET} != ${MACHINE} && ${DISKLABEL} == "bsdlabel"
252 DOFS_SH=        ${.CURDIR}/scripts/doFS.sh ${DISKLABEL} ${TARGET}
253 .else
254 DOFS_SH=        ${.CURDIR}/scripts/doFS.sh ${DISKLABEL} ""
255 .endif
256
257 CRUNCH_TARGETS= boot
258 .if ${TARGET_ARCH} == "i386"
259 CRUNCH_TARGETS+=fixit
260 .if ${TARGET} == "pc98"
261 CRUNCH_TARGETS+=fixit-small
262 .endif
263 .endif
264
265 EXTRAS= ftp.1
266 .if !defined(NOCDROM)
267 EXTRAS+= cdrom.1
268 .if defined(MAKE_ISOS)
269 EXTRAS+= iso.1
270 .endif
271 .if ${TARGET} == "i386" && defined(EMUL_BOOT)
272 BOOTABLE="-eb"
273 .elif ${TARGET} == "pc98"
274 BOOTABLE=
275 .else
276 BOOTABLE="-b"
277 .endif
278 .endif
279
280 .if !defined(NODOC)
281 DOCREL= doc.1 doc.2
282 .endif
283
284 .if !make(release) && !make(rerelease)
285 BINMAKE!=       cd ${.CURDIR}/..; ${MAKE} -V BINMAKE
286 WMAKEENV!=      cd ${.CURDIR}/..; \
287                 ${BINMAKE} ${CROSSENV} -f Makefile.inc1 -V WMAKEENV
288 WMAKE=          ${WMAKEENV} ${BINMAKE}
289 .endif
290
291 CVS_SRCARGS=    -P
292 .if defined(RELEASETAG)
293 CVS_SRCARGS+=   -r ${RELEASETAG}
294 .endif
295
296 CVS_DOCARGS=    -P
297 .if defined(DOCRELEASETAG)
298 CVS_DOCARGS+=   -r ${DOCRELEASETAG}
299 .endif
300
301 CVS_PORTSARGS=  -P
302 .if defined(PORTSRELEASETAG)
303 CVS_PORTSARGS+= -r ${PORTSRELEASETAG}
304 .endif
305
306 WORLDDIR?=      ${.CURDIR}/..
307
308 release rerelease:
309 .if !defined(CHROOTDIR) || !defined(BUILDNAME) || !defined(CVSROOT)
310         @echo "To make a release you must set CHROOTDIR, BUILDNAME and CVSROOT" && false
311 .endif
312 .if defined(NOPORTSATALL) && !defined(NODOC)
313         @echo "Ports are required for building the docs.  Either set NODOC or"
314         @echo "unset NOPORTS, or set at least DOMINIMALDOCPORTS to YES!"
315         @exit 1
316 .endif
317 .if make(release)
318 .if exists(${CHROOTDIR})
319 # The first command will fail on a handful of files that have their schg
320 # flags set.  But it greatly speeds up the next two commands.
321         # NB: clear any vestigal devfs mount, just in case
322         -umount ${CHROOTDIR}/dev > /dev/null 2>&1
323         -rm -rf ${CHROOTDIR} 2>/dev/null
324         -chflags -R noschg ${CHROOTDIR}/.
325         -rm -rf ${CHROOTDIR}
326 .endif
327         mkdir -p ${CHROOTDIR}
328         @echo ">>> make release for ${TARGET} started on `LC_ALL=C TZ=GMT date`"
329         cd ${WORLDDIR} && ${NATIVEMAKE} -DNOGAMES -DNOHTML -DNOINFO -DNOMAN \
330             -DNOPROFILE installworld DESTDIR=${CHROOTDIR}
331         cd ${WORLDDIR}/etc && ${NATIVEMAKE} distribution DESTDIR=${CHROOTDIR}
332         if [ -f /etc/resolv.conf ]; then \
333                 cp -p /etc/resolv.conf ${CHROOTDIR}/etc; \
334         fi
335 .if defined(EXTLOCALDIR)
336         rm -rf ${CHROOTDIR}/usr/local
337         cd ${CHROOTDIR}/usr && cp -R -H ${EXTLOCALDIR} local
338 .endif
339         rm -rf ${CHROOTDIR}/usr/src
340 .if defined(EXTSRCDIR)
341         cd ${CHROOTDIR}/usr && \
342             cp -R -H ${EXTSRCDIR} src
343 .else
344         cd ${CHROOTDIR}/usr && \
345             ${CVSPREFIX} cvs -R ${CVSARGS} -d ${CVSROOT} \
346             co ${CVSCMDARGS} ${CVS_SRCARGS} ${RELEASESRCMODULE}
347 .endif
348 .if defined(LOCAL_PATCHES) && !empty(LOCAL_PATCHES)
349 .for p in ${LOCAL_PATCHES}
350 .if exists(${p})
351         patch -d ${CHROOTDIR}/usr/${RELEASESRCMODULE} ${PATCH_FLAGS} < ${p}
352 .endif
353 .endfor
354 .endif
355 .if defined(LOCAL_SCRIPT) && exists(${LOCAL_SCRIPT})
356         cd ${CHROOTDIR} && env CHROOTDIR=${CHROOTDIR} BUILDNAME=${BUILDNAME} \
357             RELEASETAG=${RELEASETAG} ${LOCAL_SCRIPT}
358 .endif
359         rm -rf ${CHROOTDIR}/usr/ports
360 .if !defined(NOPORTSATALL)
361         cd ${CHROOTDIR}/usr && ${CVSPREFIX} cvs -R ${CVSARGS} -d ${CVSROOT} \
362             co ${CVSCMDARGS} ${CVS_PORTSARGS} ${RELEASEPORTSMODULE}
363 .endif
364 .if !defined(NODOC)
365         rm -rf ${CHROOTDIR}/usr/doc
366 .if defined(EXTDOCDIR)
367         cd ${CHROOTDIR}/usr && cp -R -H ${EXTDOCDIR} doc
368 .else
369         cd ${CHROOTDIR}/usr && ${CVSPREFIX} cvs -R ${CVSARGS} -d ${CVSROOT} \
370             co ${CVSCMDARGS} ${CVS_DOCARGS} ${RELEASEDOCMODULE}
371 .endif
372         if [ -d ${RELEASEDISTFILES}/ ]; then \
373                 cp -rp ${RELEASEDISTFILES} ${CHROOTDIR}/usr/ports/distfiles; \
374         else \
375                 mkdir -p ${CHROOTDIR}/usr/ports/distfiles; \
376         fi
377 .if !defined(NO_PREFETCHDISTFILES)
378         @cd ${.CURDIR} && ${MAKE} fetch-distfiles
379 .endif
380 .endif
381 .endif
382 .if make(rerelease)
383 .if !defined(RELEASENOUPDATE)
384 .if !defined(RELEASETAG)
385         cd ${CHROOTDIR}/usr/src && ${CVSPREFIX} cvs -R ${CVSARGS} -q \
386             update ${CVSCMDARGS} -P -d -A
387 .else
388         cd ${CHROOTDIR}/usr/src && ${CVSPREFIX} cvs -R ${CVSARGS} -q \
389             update ${CVSCMDARGS} -P -d -r ${RELEASETAG}
390 .endif
391         rm -f ${CHROOTDIR}/tmp/.world_done 
392 .if !defined(NOPORTS)
393         cd ${CHROOTDIR}/usr/ports && ${CVSPREFIX} cvs -R ${CVSARGS} -q \
394             update ${CVSCMDARGS} -P -d
395 .endif
396 .if defined(DOMINIMALDOCPORTS) && ${DOMINIMALDOCPORTS} == "YES"
397         for i in ${MINIMALDOCPORTS}; do \
398             ( cd ${CHROOTDIR}/usr/$$i && ${CVSPREFIX} cvs -R ${CVSARGS} -q \
399                 update ${CVSCMDARGS} -P -d ) ; \
400         done
401 .endif
402 .if !defined(NODOC)
403         cd ${CHROOTDIR}/usr/doc && ${CVSPREFIX} cvs -R ${CVSARGS} -q \
404             update ${CVSCMDARGS} -P -d
405 .endif
406 .endif
407 .endif
408         # Add version information to those things that need it.
409         if [ ! -f ${CHROOTDIR}/tmp/.world_done ]; then \
410                 cd ${CHROOTDIR}/usr/src/sys/conf && \
411                 mv newvers.sh foo && \
412                 sed "s/^RELEASE=.*/RELEASE=${BUILDNAME}/" foo > newvers.sh && \
413                 rm foo; \
414         fi
415         -test -f install.cfg && cp install.cfg ${CHROOTDIR}/usr/src/release
416         echo "#!/bin/sh"                        > ${_MK}
417         echo "set -ex"                          >> ${_MK}
418         echo "trap 'umount /dev || true' 0"     >> ${_MK}
419         echo "_RELTARGET=\$${1:-doRELEASE}"     >> ${_MK}
420 .for var in \
421         AUTO_KEYBOARD_DETECT \
422         BOOT_CONFIG \
423         BUILDNAME \
424         CD_EXTRA_BITS \
425         DISTRIBUTIONS \
426         DOC_LANG \
427         DOMINIMALDOCPORTS \
428         EXTRA_SRC \
429         FIXCRYPTO \
430         FTP_PASSIVE_MODE \
431         FTP_PROXY \
432         HTTP_PROXY \
433         KERNELS \
434         KERNEL_FLAGS \
435         MAKE_ISOS \
436         NOCDROM \
437         NODOC \
438         NOPORTS \
439         NOSHARED \
440         NOSRC \
441         NO_CPU_CFLAGS \
442         NO_CPU_COPTFLAGS \
443         NO_FLOPPIES \
444         NO_SENDMAIL \
445         RELEASETAG \
446         RELNOTES_LANG \
447         TARGET \
448         TARGET_ARCH \
449         WORLD_FLAGS
450 .if defined(${var})
451         echo "export ${var}=\"${${var}}\""      >> ${_MK}
452 .endif
453 .endfor
454         # Don't remove this, or the build will fall over!
455         echo "export RELEASEDIR=${_R}"          >> ${_MK}
456         echo "export PATH=/bin:/usr/bin:/sbin:/usr/sbin:${LOCALDIR}"    >> ${_MK}
457         echo "export MANBUILDCAT=YES"           >> ${_MK}
458         # NB: these may fail if the host is running w/o devfs
459         echo "umount /dev >/dev/null 2>&1 || true" >> ${_MK}
460         echo "mount -t devfs devfs /dev >/dev/null 2>&1 || true"        >> ${_MK}
461         echo "if [ -x /etc/rc.d/ldconfig ]; then" >> ${_MK}
462         echo "  /etc/rc.d/ldconfig start"       >> ${_MK}
463         echo "else"                             >> ${_MK}
464         echo "  ldconfig /lib /usr/lib /usr/local/lib || true" >> ${_MK}
465         echo "fi"                               >> ${_MK}
466         echo "if [ ! -f /tmp/.world_done ]; then" >> ${_MK}
467         echo "  cd /usr/src"                    >> ${_MK}
468         echo "  ${CROSSMAKE} ${WORLD_FLAGS} -DNOCLEAN buildworld && \\" >> ${_MK}
469         echo "  touch /tmp/.world_done"         >> ${_MK}
470         echo "fi"                               >> ${_MK}
471         echo "if [ ! -f /tmp/.skip_ports ]; then" >> ${_MK}
472         echo "  echo \">>> make readmes started on \`LC_ALL=C TZ=GMT date\`\"" >> ${_MK}
473         echo "  cd /usr/ports"                  >> ${_MK}
474         echo "  make ${PORTREADMES_FLAGS} readmes" >> ${_MK}
475         echo "  touch /tmp/.skip_ports"         >> ${_MK}
476         echo "  echo \">>> make readmes finished on \`LC_ALL=C TZ=GMT date\`\"" >> ${_MK}
477         echo "fi"                               >> ${_MK}
478         echo "cd /usr/src/release"              >> ${_MK}
479         echo "make obj"                         >> ${_MK}
480         echo "make \$${_RELTARGET}"             >> ${_MK}
481         echo "echo \">>> make ${.TARGET} for ${TARGET} finished on \`LC_ALL=C TZ=GMT date\`\"" >> ${_MK}
482         chmod 755 ${_MK}
483 .if defined(NOPORTS) || defined(NOPORTREADMES)
484         touch ${CHROOTDIR}/tmp/.skip_ports
485 .endif
486         # Ensure md.ko is loaded if md(4) is not statically compiled into 
487         # the kernel
488         -mdconfig 2>/dev/null
489         env -i /usr/sbin/chroot `dirname ${_MK}` /`basename ${_MK}`
490
491 clean:
492         rm -rf ${CRUNCH_TARGETS:S/$/_crunch/} release.[0-9] release.10 \
493             ${EXTRAS}
494
495 fetch-distfiles:
496         @for i in ${DOCPORTS}; do \
497                 cd ${CHROOTDIR}/usr/ports/$$i && \
498                         make PORTSDIR=${CHROOTDIR}/usr/ports BATCH=yes \
499                         WITHOUT_X11=yes JADETEX=no WITHOUT_PYTHON=yes \
500                         checksum-recursive ; \
501         done
502
503 # Clean out ${_R} and make the directory structure.
504 release.1:
505         mkdir -p ${_R}
506         -rm -rf ${_R}/* 2> /dev/null
507         -chflags -R noschg ${_R}/.
508         rm -rf ${_R}/*
509         mkdir ${RD}
510 .if !defined(NO_FLOPPIES)
511         mkdir ${RD}/floppies
512 .endif
513         mkdir ${RD}/trees
514         mkdir ${RD}/kernels
515         for i in ${DISTRIBUTIONS} special; do \
516                 mkdir ${RD}/trees/$$i && \
517                 mtree -deU -f ${MTREEFILES}/BSD.root.dist \
518                     -p ${RD}/trees/$$i > /dev/null && \
519                 mtree -deU -f ${MTREEFILES}/BSD.usr.dist \
520                     -p ${RD}/trees/$$i/usr > /dev/null && \
521                 mtree -deU -f ${MTREEFILES}/BSD.include.dist \
522                     -p ${RD}/trees/$$i/usr/include > /dev/null && \
523                 mtree -deU -f ${MTREEFILES}/BSD.var.dist \
524                     -p ${RD}/trees/$$i/var > /dev/null ; \
525         done
526         touch ${.TARGET}
527
528 # Install the system into the various distributions.
529 release.2:
530         cd ${.CURDIR}/../etc && make distrib-dirs DESTDIR=${RD}/trees/base
531         cd ${.CURDIR}/.. && ${CROSSMAKE} distributeworld DISTDIR=${RD}/trees
532         touch ${.TARGET}
533
534 # Build and install non-crypto versions of some tools.
535 release.3:
536         # Handle some grief caused by the munition braindeadness.
537         cd ${.CURDIR}/..; \
538         ${CROSSMAKE} ${WORLD_FLAGS} -DNOCRYPT \
539             SUBDIR_OVERRIDE="${FIXCRYPTO}" \
540             buildworld distributeworld DISTDIR=${RD}/trees
541         -chflags -R noschg ${RD}/trees
542         touch ${.TARGET}
543
544 # Make and install the generic kernel(s).
545 release.4:
546 .for kernel in ${KERNELS}
547         cd ${.CURDIR}/..; \
548         ${CROSSMAKE} ${KERNEL_FLAGS} -DNO_MODULES \
549             KERNCONF=${kernel} INSTKERNNAME=${kernel} kernel \
550             DESTDIR=${RD}/trees/base
551 .endfor
552         # Install a standard boot kernel+modules.
553         cd ${.CURDIR}/..; \
554         ${CROSSMAKE} ${KERNEL_FLAGS} \
555             kernel \
556             DESTDIR=${RD}/trees/base; \
557         cd ${.CURDIR}/..; \
558         ${CROSSMAKE} ${KERNEL_FLAGS} -DNO_MODULES \
559             reinstallkernel.debug \
560             DESTDIR=${RD}/trees/base
561         touch ${.TARGET}
562
563 # Make and install the three crunched binaries which live on the floppies.
564 # You are not supposed to like this :-)
565 release.5:
566         rm -rf ${RD}/crunch
567         mkdir -p ${RD}/crunch
568 .for j in ${CRUNCH_TARGETS}
569 .if exists(${.CURDIR}/${TARGET}/${j}_crunch.conf)
570         rm -rf ${j}_crunch
571         mkdir ${j}_crunch
572         cd ${j}_crunch; ${WMAKEENV} crunchgen -o \
573             ${.CURDIR}/${TARGET}/${j}_crunch.conf
574         cd ${j}_crunch; ${WMAKE} -f ${j}_crunch.mk subclean
575         cd ${.CURDIR}/..; ${BINMAKE} -f Makefile.inc1 _build-tools
576         cd ${j}_crunch; ${WMAKE} -f ${j}_crunch.mk \
577             CFLAGS="-Os -pipe" -DNO_CPU_CFLAGS all
578         ${WMAKEENV} strip -R .comment ${j}_crunch/${j}_crunch
579         mv ${j}_crunch/${j}_crunch ${RD}/crunch/${j}
580 .endif
581 .endfor
582         touch ${.TARGET}
583
584 #
585 # --==## Fix up the distributions. ##==--
586 #
587 release.6:
588         # Create any "synthetic dists" now.
589         @for i in ${DISTRIBUTIONS}; do \
590                 if [ -f ${.CURDIR}/scripts/$${i}-make.sh ]; then \
591                         echo -n "Running $$i dist creation script... "; \
592                         env RD=${RD} sh ${.CURDIR}/scripts/$${i}-make.sh || echo "$$i distribution script returned bad status."; \
593                         echo "Done."; \
594                 fi \
595         done \
596
597         # Remove all the directories we don't need.
598         -cd ${RD}/trees && \
599                 find ${OTHER_DISTS} ${COMPAT_DISTS} ${CRYPTO_DISTS} -depth -type d -print | xargs rmdir
600         touch ${.TARGET}
601
602 #
603 # --==## Package up the tarballs from assembled trees ##==--
604 #
605 release.7:
606         rm -rf ${RD}/dists
607         mkdir -p ${RD}/dists
608         @for i in ${DISTRIBUTIONS} ; \
609         do \
610                 if [ -d ${RD}/trees/$${i} ] ; then \
611                         cd ${.CURDIR} && $(MAKE) doTARBALL \
612                                 SD=${RD}/trees/$${i} \
613                                 TN=$$i TD=$$i ARG="." && \
614                         echo "$${i} distribution is finished."; \
615                 fi ; \
616         done
617 .if !defined(NOPORTS)
618         # XXX: Inline stripped version of doTARBALL
619         @rm -rf ${RD}/dists/ports/ports*
620         @mkdir -p ${RD}/dists/ports
621         @echo rolling ports/ports tarball
622         @tar --exclude CVS --exclude 'ports/distfiles/*' -czf \
623           ${RD}/dists/ports/ports.tgz -C /usr ports
624         @cp ${.CURDIR}/scripts/ports-install.sh ${RD}/dists/ports/install.sh
625         @(cd ${RD}/dists/ports; \
626           rm -f CHECKSUM.MD5; \
627           md5 * > CHECKSUM.MD5)
628         @echo "ports distribution is finished."
629 .endif
630         touch ${.TARGET}
631
632
633 #
634 # --==## Make source dists ##==--
635 #
636 release.8:
637 .if !defined(NOSRC)
638         @cd ${.CURDIR} && $(MAKE) doTARBALL SD=/usr/src \
639                 TD=src TN=sbase ARG="[A-Z]*"
640         @for i in `cd /usr/src && echo [a-z]*` ; do \
641                 if [ -d /usr/src/$$i ] ; then \
642                         cd ${.CURDIR} && $(MAKE) doTARBALL \
643                                 TN=`echo s$$i | tr -d '.' | \
644                                     sed -e 's/usr/u/' \
645                                         -e 's/kerberos5/krb5/'` \
646                                 SD=/usr/src TD=src ARG="$$i" ; \
647                 fi ; \
648         done
649 .if defined(EXTRA_SRC)
650         @set ${EXTRA_SRC} && \
651         while [ $$# -ge 2 ] ; do \
652                 if [ -d /usr/src/$$1 ] ; then \
653                         cd ${.CURDIR} && $(MAKE) doTARBALL \
654                                 SD=/usr/src TN="s$$2" TD=src ARG="$$1" ; \
655                 fi && shift && shift ; \
656         done
657 .endif
658         if [ -d ${RD}/dists/crypto ] ; then ( cd ${RD}/dists/src && \
659                 if [ -f ssecure.aa ] ; then mv ssecure.* ../crypto ; fi && \
660                 if [ -f scrypto.aa ] ; then mv scrypto.* ../crypto ; fi && \
661                 if [ -f skrb5.aa ] ; then mv skrb5.* ../crypto ; fi ; \
662                 cd ${RD}/dists/crypto; rm -f CHECKSUM.MD5; \
663                 md5 * > CHECKSUM.MD5 ) ; fi
664         (cd ${RD}/dists/src; rm -f CHECKSUM.MD5; md5 * > CHECKSUM.MD5)
665         @echo "src distribution is finished."
666 .endif
667         touch ${.TARGET}
668
669 # Complete the bootfd
670 #
671 # Now, just to get this picture down once and for all:
672 #
673 # +------------------------------------------------------------------------+
674 # |boot.flp                                                                |
675 # +-----+-----+------------------------------------------------------------+
676 # |boot1|boot2|floppy filesystem "bootfd"                                  |
677 # +-----+-----+-+----------------------+---------------------------------+-+
678 #               |kernel.gz             |mfsroot.gz                       |
679 #               +----------------------+---------------------------------+
680 #
681
682 release.9:
683 .if exists(${.CURDIR}/../sys/boot/${TARGET}/loader)
684         cd ${.CURDIR}/../sys/boot/${TARGET}/loader; \
685         ${WMAKE} clean cleandepend; \
686         ${WMAKE} -DNOMAN -DNOFORTH all; \
687         ${WMAKE} -DNOMAN -DNOFORTH install DESTDIR=${RD}/trees/special
688 .endif
689         cp ${RD}/trees/base/etc/disktab /etc
690         rm -rf ${RD}/mfsfd
691         mkdir ${RD}/mfsfd
692         cd ${RD}/mfsfd && \
693                 mkdir -p etc/defaults dev mnt stand/etc/defaults stand/help
694         @cd ${.CURDIR} && $(MAKE) installCRUNCH CRUNCH=boot \
695                 DIR=${RD}/mfsfd/stand ZIP=false
696         ( cd ${RD}/mfsfd && \
697           for dir in bin sbin ; do \
698                 ln -sf /stand $$dir; \
699           done )
700         cp ${RD}/trees/base/sbin/dhclient-script ${RD}/mfsfd/stand
701 .if ${TARGET} == "pc98"
702         cp ${.CURDIR}/../etc/defaults/pccard.conf \
703             ${RD}/mfsfd/etc/defaults/pccard.conf
704 .endif
705         cp ${.CURDIR}/../etc/usbd.conf ${RD}/mfsfd/etc/usbd.conf
706         ( for F in defaults/rc.conf netconfig protocols ; do \
707                 sed -e '/^#.*$$/d' -e 's/[:space:]*#.*$$//g' \
708                 ${RD}/trees/base/etc/$$F > ${RD}/mfsfd/stand/etc/$$F ; \
709           done )
710         grep -E '^(ftp|nameserver|domain|sunrpc|cmd|nfsd)[^-\w]' \
711             ${RD}/trees/base/etc/services | \
712             sed -e '/^#.*$$/d' -e 's/[:space:]*#.*$$//g' \
713             > ${RD}/mfsfd/stand/etc/services
714         grep 'operator' ${RD}/trees/base/etc/group \
715             > ${RD}/mfsfd/stand/etc/group
716         ln ${RD}/mfsfd/stand/etc/services ${RD}/mfsfd/etc/services
717         ln ${RD}/mfsfd/stand/etc/group ${RD}/mfsfd/etc/group
718         ln ${RD}/mfsfd/stand/etc/netconfig ${RD}/mfsfd/etc/netconfig
719         cp ${RD}/trees/base/COPYRIGHT ${RD}/mfsfd/stand/help/COPYRIGHT.hlp
720 .if !defined(NODOC)
721         @for i in ${DIST_DOCS_ARCH_INDEP}; do \
722           cp ${RND}/${RELNOTES_LANG}/$$i/article.txt \
723               ${RD}/mfsfd/stand/help/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
724         done
725         @for i in ${DIST_DOCS_ARCH_DEP}; do \
726           cp ${RND}/${RELNOTES_LANG}/$$i/${TARGET}/article.txt \
727               ${RD}/mfsfd/stand/help/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
728         done
729         @mv ${RD}/mfsfd/stand/help/INSTALLATION.TXT \
730             ${RD}/mfsfd/stand/help/INSTALL.TXT
731         @mv ${RD}/mfsfd/stand/help/EARLY-ADOPTER.TXT \
732             ${RD}/mfsfd/stand/help/EARLY.TXT
733 .endif
734         -test -f ${.CURDIR}/install.cfg \
735             && cp ${.CURDIR}/install.cfg ${RD}/mfsfd
736         @mkdir -p ${RD}/mfsfd/boot
737 .if ${TARGET_ARCH} != "ia64"
738         @cp ${RD}/trees/base/boot/boot* ${RD}/mfsfd/boot
739 .endif
740 .if ${TARGET} == "i386" || ${TARGET_ARCH} == "amd64"
741         @cp ${RD}/trees/base/boot/mbr ${RD}/mfsfd/boot
742 .endif
743         @tar --exclude CVS -cf - -C ${.CURDIR}/../usr.sbin/sysinstall help | \
744                 tar xf - -C ${RD}/mfsfd/stand
745 .if defined(SMALLBOOTSIZE)
746         @mkdir -p ${RD}/mfsroot-small
747 .if exists(${.CURDIR}/${TARGET}/drivers-small.conf)
748         @mkdir -p ${RD}/mfsfd/modules
749         @awk -f  ${.CURDIR}/scripts/driver-copy2.awk 2 \
750             ${.CURDIR}/${TARGET}/drivers-small.conf \
751             ${RD}/trees/base/boot/kernel ${RD}/mfsfd/modules
752 .endif
753         sh -e ${DOFS_SH} ${RD}/mfsroot-small/mfsroot ${RD} ${MNT} \
754             ${MFSSIZE} ${RD}/mfsfd ${MFSINODE} ${MFSLABEL}
755         @gzip -9nv ${RD}/mfsroot-small/mfsroot
756         @rm -rf ${RD}/mfsfd/modules
757 .endif
758 .if exists(${.CURDIR}/${TARGET}/drivers.conf)
759         @mkdir -p ${RD}/mfsfd/modules
760         @awk -f  ${.CURDIR}/scripts/driver-copy2.awk 2 \
761             ${.CURDIR}/${TARGET}/drivers.conf \
762             ${RD}/trees/base/boot/kernel ${RD}/mfsfd/modules
763 .endif
764         @mkdir -p ${RD}/mfsroot
765         sh -e ${DOFS_SH} ${RD}/mfsroot/mfsroot ${RD} ${MNT} \
766             ${MFSSIZE} ${RD}/mfsfd ${MFSINODE} ${MFSLABEL}
767         @gzip -9nv ${RD}/mfsroot/mfsroot
768         touch ${.TARGET}
769
770 release.10:
771 .if !defined(NO_FLOPPIES)
772 .if exists(${.CURDIR}/${TARGET}/drivers.conf)
773         @echo "Making the drivers floppy."
774         @rm -rf ${RD}/driversfd
775         @mkdir ${RD}/driversfd
776         @awk -f  ${.CURDIR}/scripts/driver-copy2.awk 3 \
777             ${.CURDIR}/${TARGET}/drivers.conf \
778             ${RD}/trees/base/boot/kernel ${RD}/driversfd
779         -@rmdir ${RD}/driversfd
780         if [ -d ${RD}/driversfd ]; then \
781             sh -e ${DOFS_SH} ${RD}/floppies/drivers.flp ${RD} ${MNT} \
782                 ${DRIVERSIZE} ${RD}/driversfd ${DRIVERINODE} ${DRIVERLABEL}; \
783             cd ${RD}/driversfd && awk -f  ${.CURDIR}/scripts/driver-desc.awk \
784                 *.dsc >> ${RD}/floppies/DRIVERS.TXT; \
785         fi
786 .endif
787 .if defined(BOOTSIZE)
788         @echo "Making the regular boot floppy."
789         @cd ${.CURDIR} && ${MAKE} doMFSKERN FSIMAGE=kern
790 .endif
791 .if defined(SMALLBOOTSIZE)
792         @echo "Making the small boot floppy."
793         @cd ${.CURDIR} && ${MAKE} doMFSKERN FSIMAGE=kern-small FDSIZE=SMALL
794 .endif
795 .if defined(BIGBOOTSIZE)
796         @echo "Making the big boot floppy."
797         @cd ${.CURDIR} && ${MAKE} doMFSKERN FSIMAGE=boot FDSIZE=BIG
798 .endif
799 .if defined(FIXITSIZE) || defined(SMALLFIXITSIZE)
800         @echo "Making fixit floppy."
801         @rm -rf ${RD}/fixitfd
802         @mkdir ${RD}/fixitfd
803         @cd ${RD}/fixitfd && \
804             mkdir -p dev stand bin sbin etc mnt mnt1 mnt2 mnt3 mnt4 tmp \
805             usr/share/misc
806         @cp ${RD}/trees/base/etc/spwd.db ${RD}/trees/base/etc/group \
807             ${RD}/fixitfd/etc
808         @sed -e 's/#.*//' ${RD}/trees/base/etc/protocols \
809             > ${RD}/fixitfd/etc/protocols
810         @sed -e 's/#.*//' ${RD}/trees/base/usr/share/misc/scsi_modes \
811             > ${RD}/fixitfd/usr/share/misc/scsi_modes
812         @cp ${.CURDIR}/fixit.profile ${RD}/fixitfd/.profile
813         @cp ${.CURDIR}/fixit.services ${RD}/fixitfd/etc/services
814         @cp ${.CURDIR}/scripts/tar.sh ${RD}/fixitfd/stand/tar
815         @chmod 555 ${RD}/fixitfd/stand/tar
816 .if defined(SMALLFIXITSIZE)
817         @cd ${.CURDIR} && ${MAKE} installCRUNCH CRUNCH=fixit-small \
818             DIR=${RD}/fixitfd/stand ZIP=false
819         @sh -e ${DOFS_SH} ${RD}/floppies/fixit-small.flp ${RD} ${MNT} \
820             ${SMALLFIXITSIZE} ${RD}/fixitfd ${FIXITINODE} ${SMALLFIXITLABEL}
821         @rm -rf ${RD}/fixitfd/stand
822         @mkdir ${RD}/fixitfd/stand
823 .endif
824 .if defined(FIXITSIZE)
825         @cd ${.CURDIR} && ${MAKE} installCRUNCH CRUNCH=fixit \
826             DIR=${RD}/fixitfd/stand ZIP=false
827         @sh -e ${DOFS_SH} ${RD}/floppies/fixit.flp ${RD} ${MNT} \
828             ${FIXITSIZE} ${RD}/fixitfd ${FIXITINODE} ${FIXITLABEL}
829 .endif
830 .endif
831 # Do our last minute floppies directory setup in a convenient place.
832 .if !defined(NODOC)
833         @cp ${RND}/${RELNOTES_LANG}/installation/${TARGET}/article.txt \
834             ${RD}/floppies/README.TXT
835         @(cd ${RD}/floppies; md5 README.TXT *.flp > CHECKSUM.MD5)
836 .else
837         @(cd ${RD}/floppies; md5 *.flp > CHECKSUM.MD5)
838 .endif
839 .endif
840         touch ${.TARGET}
841
842 #
843 # --==## Setup a suitable ftp-area ##==--
844 #
845 ftp.1:
846         @echo "Setting up FTP distribution area"
847         @mkdir -p ${FD}
848         -@ln -s . ${FD}/${BUILDNAME}
849 .if !defined(NO_FLOPPIES)
850         @cd ${RD} && find floppies -print | cpio -dumpl ${FD}
851 .endif
852         @cd ${RD}/dists && find . -print | cpio -dumpl ${FD}
853 .if !defined(NODOC)
854         @for i in ${DIST_DOCS_ARCH_INDEP}; do \
855                 cp ${RND}/${RELNOTES_LANG}/$$i/article.txt \
856                     ${FD}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
857                 cp ${RND}/${RELNOTES_LANG}/$$i/article.html \
858                     ${FD}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \
859         done
860         @for i in ${DIST_DOCS_ARCH_DEP}; do \
861                 cp ${RND}/${RELNOTES_LANG}/$$i/${TARGET}/article.txt \
862                     ${FD}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
863                 cp ${RND}/${RELNOTES_LANG}/$$i/${TARGET}/article.html \
864                     ${FD}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \
865         done
866         @cp ${RND}/${RELNOTES_LANG}/readme/docbook.css ${FD}
867         @mv ${FD}/INSTALLATION.TXT ${FD}/INSTALL.TXT
868         @mv ${FD}/INSTALLATION.HTM ${FD}/INSTALL.HTM
869         @mv ${FD}/EARLY-ADOPTER.TXT ${FD}/EARLY.TXT
870         @mv ${FD}/EARLY-ADOPTER.HTM ${FD}/EARLY.HTM
871 .endif
872         @echo "CD_VERSION = ${BUILDNAME}" > ${FD}/cdrom.inf
873         touch ${.TARGET}
874
875 #
876 # --==## Setup a suitable cdrom-area ##==--
877 #
878 cdrom.1:
879         @echo "Setting up CDROM distribution area"
880         @mkdir -p ${CD_BOOT} ${CD_DISC1} ${CD_DISC2}
881         -@ln -s . ${CD_DISC1}/${BUILDNAME}
882 .if !defined(NO_FLOPPIES)
883         @cd ${RD} && find floppies -print | cpio -dumpl ${CD_DISC1}
884 .endif
885         @cd ${RD}/dists && find . -print | cpio -dumpl ${CD_DISC1}
886         @for i in ${DISTRIBUTIONS} ; \
887         do \
888                 if [ -d ${RD}/trees/$${i} ] ; then \
889                         chflags -R noschg ${RD}/trees/$${i} || true ; \
890                         ( cd ${RD}/trees/$${i} && \
891                             find . -depth -print | cpio -dumpl ${CD_DISC2} ) ; \
892                 fi \
893         done
894         @rm -f ${CD_DISC2}/.profile
895         @cp ${.CURDIR}/fixit.profile ${CD_DISC2}/.profile
896         @echo "CD_VERSION = ${BUILDNAME}" > ${CD_DISC1}/cdrom.inf
897         @echo "CD_VERSION = ${BUILDNAME}" > ${CD_DISC2}/cdrom.inf
898 .if !defined(NODOC)
899         @for i in ${DIST_DOCS_ARCH_INDEP}; do \
900           cp ${RND}/${RELNOTES_LANG}/$$i/article.txt \
901               ${CD_DISC1}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
902           cp ${RND}/${RELNOTES_LANG}/$$i/article.html \
903               ${CD_DISC1}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \
904         done
905         @for i in ${DIST_DOCS_ARCH_DEP}; do \
906           cp ${RND}/${RELNOTES_LANG}/$$i/${TARGET}/article.txt \
907               ${CD_DISC1}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
908           cp ${RND}/${RELNOTES_LANG}/$$i/${TARGET}/article.html \
909               ${CD_DISC1}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \
910         done
911         @cp ${RND}/${RELNOTES_LANG}/readme/docbook.css ${CD_DISC1}
912         @mv ${CD_DISC1}/INSTALLATION.TXT ${CD_DISC1}/INSTALL.TXT
913         @mv ${CD_DISC1}/INSTALLATION.HTM ${CD_DISC1}/INSTALL.HTM
914         @mv ${CD_DISC1}/EARLY-ADOPTER.TXT ${CD_DISC1}/EARLY.TXT
915         @mv ${CD_DISC1}/EARLY-ADOPTER.HTM ${CD_DISC1}/EARLY.HTM
916 .endif
917 .if ${TARGET} != "pc98"
918         @echo "Setting up boot area"
919         @rm -f ${CD_DISC2}/boot/loader.conf
920         @cp ${RD}/mfsroot/mfsroot.gz ${CD_DISC2}/boot/mfsroot.gz
921         @echo 'mfsroot_load="YES"' > ${CD_DISC2}/boot/loader.conf
922         @echo 'mfsroot_type="mfs_root"' >> ${CD_DISC2}/boot/loader.conf
923         @echo 'mfsroot_name="/boot/mfsroot"' >> ${CD_DISC2}/boot/loader.conf
924 .if defined(CD_BOOT)
925         @cp -Rp ${CD_DISC2}/boot ${CD_BOOT}
926 .if defined(MINIROOT)
927         @mkdir -p ${FD}/miniroot
928         @sh -e ${DOFS_SH} ${FD}/miniroot/miniroot.ufs \
929             ${RD} ${MNT} 0 ${CD_BOOT} 8192 auto
930         @gzip -9v ${FD}/miniroot/miniroot.ufs
931 .endif
932 .endif
933         @cp -Rp ${CD_DISC2}/boot ${CD_DISC1}
934 .if ${TARGET} == "i386" && defined(EMUL_BOOT) && !defined(NO_FLOPPIES)
935         # In case bootable ISO with floppy emulation is desired.
936 .if defined(CD_BOOT)
937         @mkdir -p ${CD_BOOT}/floppies
938         @cp ${CD_DISC1}/floppies/boot.flp ${CD_BOOT}/floppies
939 .endif
940         @mkdir -p ${CD_DISC2}/floppies
941         @cp ${CD_DISC1}/floppies/boot.flp ${CD_DISC2}/floppies
942 .endif
943 .endif
944         touch ${.TARGET}
945
946 iso.1:
947 .if exists(${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh)
948         @echo "Creating ISO images..."
949 .if defined(CD_BOOT)
950         @sh ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh ${BOOTABLE} \
951             fbsd_bootonly \
952             ${CD}/${BUILDNAME}-${TARGET}-bootonly.iso ${CD_BOOT}
953 .endif
954         @sh ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh ${BOOTABLE} \
955             fbsd_miniinst \
956             ${CD}/${BUILDNAME}-${TARGET}-miniinst.iso ${CD_DISC1}
957         @sh ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh ${BOOTABLE} \
958             fbsd_livefs \
959             ${CD}/${BUILDNAME}-${TARGET}-disc2.iso ${CD_DISC2}
960 .if defined(CD_EXTRA_BITS)
961         @sh ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh ${BOOTABLE} \
962             fbsd_boot \
963             ${CD}/${BUILDNAME}-${TARGET}-disc1.iso ${CD_DISC1} \
964             ${CD_EXTRA_BITS} \
965             && false
966 .endif
967         @(cd ${CD} && md5 *.iso > ${BUILDNAME}-${TARGET}-iso.CHECKSUM.MD5)
968         touch ${.TARGET}
969 .else
970         @echo "Do not know how to create an ISO for ${TARGET_ARCH}."
971 .endif
972
973 #
974 # --==## Documentation Project files such as the Handbook and FAQ ##==--
975 #
976 doc.1:
977         @echo "Making docs..."
978         @for i in ${DOCPORTS}; do \
979             cd /usr/ports/$$i && \
980             env -i FTP_PASSIVE_MODE=$${FTP_PASSIVE_MODE:-no} PATH=$${PATH} \
981                 make all install clean BATCH=yes WITHOUT_X11=yes JADETEX=no \
982                 WITHOUT_PYTHON=yes FORCE_PKG_REGISTER=yes; \
983         done
984         @cd /usr/doc && make all install 'FORMATS=html html-split txt' \
985             INSTALL_COMPRESSED='' DOCDIR=${RD}/trees/base/usr/share/doc
986         touch ${.TARGET}
987
988 #
989 # --==## RELNOTESng:  Next-generation replacements for *.TXT files ##==--
990 #
991 doc.2:
992         @echo "Making release documentation..."
993         @cd ${.CURDIR}/doc && make all install clean 'FORMATS=html txt' \
994             INSTALL_COMPRESSED='' DOCDIR=${RND}
995         touch ${.TARGET}
996
997 # Various "subroutine" and other supporting targets.
998
999 # RD=
1000 # SD=
1001 # TD=
1002 # ARG=
1003 doTARBALL:
1004 .if !defined(SD)
1005         @echo "SD undefined in doTARBALL" && exit 1
1006 .endif
1007 .if !defined(TD)
1008         @echo "TD undefined in doTARBALL" && exit 1
1009 .endif
1010 .if !defined(ARG)
1011         @echo "ARG undefined in doTARBALL" && exit 1
1012 .endif
1013         @rm -rf ${RD}/dists/${TD}/${TN}*
1014         @mkdir -p ${RD}/dists/${TD}
1015         @( cd ${SD} && \
1016                 tn=`echo ${TN} | tr 'A-Z' 'a-z' | cut -c1-8` && \
1017                 echo rolling ${TD}/$$tn tarball &&\
1018                 tar --exclude CVS --exclude obj --exclude BOOTMFS -cf - ${ARG} | \
1019                 ${ZIPNSPLIT} ${RD}/dists/${TD}/$$tn. && \
1020                 sh ${.CURDIR}/scripts/info.sh ${RD}/dists/${TD}/$$tn \
1021                     > ${RD}/dists/${TD}/$$tn.inf && \
1022                 if [ -f ${.CURDIR}/scripts/$${TD}-install.sh ]; then \
1023                         cp -p ${.CURDIR}/scripts/$${TD}-install.sh \
1024                             ${RD}/dists/${TD}/install.sh; \
1025                 fi && \
1026                 if [ "${SD}" != "/usr/src" ]; then \
1027                         mtree -c -i -p ${SD}/${ARG} \
1028                           -k gname,md5digest,mode,nlink,uname,size,link,type \
1029                           > ${RD}/dists/${TD}/$$tn.mtree ; \
1030                 else \
1031                         true; \
1032                 fi; \
1033                 ( cd ${RD}/dists/${TD}; \
1034                 rm -f CHECKSUM.MD5; \
1035                 md5 * > CHECKSUM.MD5 ) \
1036         )
1037
1038 doRELEASE: release.1 release.2 release.3 ${DOCREL} release.4 release.5 \
1039     release.6 release.7 release.8 release.9 release.10 ${EXTRAS}
1040         @echo "Release done"
1041
1042 floppies:
1043         @rm -f release.5 release.9 release.10
1044         @cd ${.CURDIR} && ${MAKE} release.5 release.9 release.10
1045         @cd ${RD} && find floppies -print | cpio -dumpl ${FD}
1046
1047 installCRUNCH:
1048 .if !defined(CRUNCH)
1049         @echo "CRUNCH undefined in installCRUNCH" && exit 1
1050 .endif
1051 .if !defined(DIR)
1052         @echo "DIR undefined in installCRUNCH" && exit 1
1053 .endif
1054 .if !defined(ZIP)
1055         @echo "ZIP undefined in installCRUNCH" && exit 1
1056 .endif
1057         @if ${ZIP} ; then \
1058                 gzip -9 < ${RD}/crunch/${CRUNCH} > ${DIR}/${CRUNCH}_crunch ; \
1059         else \
1060                 ln -f ${RD}/crunch/${CRUNCH} ${DIR}/${CRUNCH}_crunch ; \
1061         fi
1062         @chmod 555 ${DIR}/${CRUNCH}_crunch
1063         @if [ -f ${.CURDIR}/${TARGET}/${CRUNCH}_crunch.conf ] ; then \
1064                 for i in `crunchgen -l ${.CURDIR}/${TARGET}/${CRUNCH}_crunch.conf` ; do \
1065                         ln -f ${DIR}/${CRUNCH}_crunch ${DIR}/$$i ; \
1066                 done \
1067         else \
1068                 for i in `crunchgen -l ${.CURDIR}/${CRUNCH}_crunch.conf` ; do \
1069                         ln -f ${DIR}/${CRUNCH}_crunch ${DIR}/$$i ; \
1070                 done \
1071         fi
1072
1073 #
1074 # --==## Put a filesystem into a BOOTMFS kernel ##==--
1075 #
1076 doMFSKERN:
1077         @echo "Running ${.TARGET} for ${FSIMAGE}"
1078         @rm -f ${RD}/kernels/BOOTMFS ${RD}/kernels/BOOTMFS.${FSIMAGE}
1079         @cd ${.CURDIR}/../sys/${TARGET}/conf; \
1080         if [ -r ${.CURDIR}/${TARGET}/dokern.sh ]; then \
1081             sh ${.CURDIR}/${TARGET}/dokern.sh ${FDSIZE}; \
1082         else \
1083             sed -e 's/ident.*GENERIC/ident              BOOTMFS/g'; \
1084         fi < GENERIC > BOOTMFS; \
1085         [ -r GENERIC.hints ] && cp GENERIC.hints BOOTMFS.hints
1086 .if defined(FDSIZE) && ${FDSIZE} == "SMALL" && \
1087     exists(${.CURDIR}/${TARGET}/drivers-small.conf)
1088         @awk -f ${.CURDIR}/scripts/driver-remove.awk \
1089             ${.CURDIR}/${TARGET}/drivers-small.conf \
1090             ${.CURDIR}/../sys/${TARGET}/conf/BOOTMFS
1091 .elif exists(${.CURDIR}/${TARGET}/drivers.conf)
1092         @awk -f ${.CURDIR}/scripts/driver-remove.awk \
1093             ${.CURDIR}/${TARGET}/drivers.conf \
1094             ${.CURDIR}/../sys/${TARGET}/conf/BOOTMFS
1095 .endif
1096         cd ${.CURDIR}/..; \
1097         KERNEL_KO=BOOTMFS KODIR= \
1098             ${CROSSMAKE} ${KERNEL_FLAGS} -DNO_MODULES -DNO_KERNELCLEAN \
1099             KERNCONF=BOOTMFS COPTFLAGS="-Os -pipe" -DNO_CPU_COPTFLAGS \
1100             buildkernel reinstallkernel \
1101             DESTDIR=${RD}/kernels
1102         [ -r ${.CURDIR}/../sys/${TARGET}/conf/BOOTMFS.hints ] && \
1103             cp ${.CURDIR}/../sys/${TARGET}/conf/BOOTMFS.hints ${RD}/kernels
1104         @rm -rf ${RD}/image.${FSIMAGE}
1105         @mkdir ${RD}/image.${FSIMAGE}
1106         @cd ${RD}/kernels && \
1107             (chflags noschg BOOTMFS || true) && \
1108             ${WMAKEENV} strip -R .comment BOOTMFS && \
1109             cp BOOTMFS BOOTMFS.${FSIMAGE} && \
1110             [ -r BOOTMFS.hints ] && mv BOOTMFS.hints BOOTMFS.${FSIMAGE}.hints
1111         mv ${RD}/kernels/BOOTMFS ${RD}/image.${FSIMAGE}/kernel
1112         @echo "Setting up /boot directory for ${FSIMAGE} floppy"
1113         @mkdir -p ${RD}/image.${FSIMAGE}/boot
1114 .if ${TARGET} == "i386"
1115         @${WMAKEENV} kgzip -v -l ${RD}/trees/base/usr/lib/kgzldr.o -o \
1116             ${RD}/image.${FSIMAGE}/boot/loader ${RD}/trees/special/boot/loader
1117 .else
1118         @cp ${RD}/trees/special/boot/loader ${RD}/image.${FSIMAGE}/boot
1119 .endif
1120         @[ -r ${RD}/kernels/BOOTMFS.${FSIMAGE}.hints ] && \
1121           sed -e '/^hint/s/^/set /' -e '/^#/d' \
1122               ${RD}/kernels/BOOTMFS.${FSIMAGE}.hints > \
1123               ${RD}/image.${FSIMAGE}/boot/device.hints && \
1124           echo "include /boot/device.hints" \
1125               > ${RD}/image.${FSIMAGE}/boot/loader.rc
1126         @echo "load /kernel" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
1127 .if !defined(FDSIZE) || ${FDSIZE} != "BIG"
1128         @echo "echo \\007\\007" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
1129         @echo "echo Please insert MFS root floppy and press enter:" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
1130         @echo "read" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
1131 .endif
1132         @echo "load -t mfs_root /mfsroot" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
1133         @echo "set hint.acpi.0.disabled=1" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
1134         @if [ -r ${RD}/floppies/drivers.flp ]; then \
1135                 echo "set driver_floppy=YES" >> ${RD}/image.${FSIMAGE}/boot/loader.rc; \
1136         fi
1137         @echo "set module_path=\"/modules;/dist\"" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
1138         @echo "echo \\007\\007" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
1139         @echo "autoboot 10" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
1140 .if ${TARGET_ARCH} == "i386" && ${AUTO_KEYBOARD_DETECT}
1141         @echo "-P" >> ${RD}/image.${FSIMAGE}/boot.config
1142 .endif
1143         @gzip -9v ${RD}/image.${FSIMAGE}/kernel
1144         @rm -f ${RD}/floppies/${FSIMAGE}.flp
1145 .if defined(FDSIZE) && ${FDSIZE} == "BIG"
1146         @cp ${RD}/mfsroot/mfsroot.gz ${RD}/image.${FSIMAGE}
1147         sh -e ${DOFS_SH} ${RD}/floppies/${FSIMAGE}.flp ${RD} ${MNT} \
1148             ${BIGBOOTSIZE} ${RD}/image.${FSIMAGE} ${BOOTINODE} ${BIGBOOTLABEL}
1149 .elif defined(FDSIZE) && ${FDSIZE} == "SMALL"
1150         sh -e ${DOFS_SH} ${RD}/floppies/mfsroot-small.flp ${RD} ${MNT} \
1151             ${SMALLBOOTSIZE} ${RD}/mfsroot-small/mfsroot.gz ${BOOTINODE} \
1152             ${SMALLBOOTLABEL}
1153         sh -e ${DOFS_SH} ${RD}/floppies/${FSIMAGE}.flp ${RD} ${MNT} \
1154             ${SMALLBOOTSIZE} ${RD}/image.${FSIMAGE} ${BOOTINODE} \
1155             ${SMALLBOOTLABEL}
1156 .else
1157         sh -e ${DOFS_SH} ${RD}/floppies/mfsroot.flp ${RD} ${MNT} \
1158             ${BOOTSIZE} ${RD}/mfsroot/mfsroot.gz ${BOOTINODE} ${BOOTLABEL}
1159         sh -e ${DOFS_SH} ${RD}/floppies/${FSIMAGE}.flp ${RD} ${MNT} \
1160             ${BOOTSIZE} ${RD}/image.${FSIMAGE} ${BOOTINODE} ${BOOTLABEL}
1161 .endif
1162         @echo "Created ${RD}/floppies/${FSIMAGE}.flp"
1163
1164 .include <bsd.obj.mk>