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