Makefile revision 6723
16059Samurai# $Id: Makefile,v 1.108 1995/02/25 22:08:43 phk Exp $ 26059Samurai# 36059Samurai# How to roll a release: 46059Samurai# 56059Samurai# make release CHROOTDIR=<lots of disk> [ RELEASETAG=something ] 66059Samurai# 76059Samurai# As far as I know, this will roll everything nicely into the "stage" 86059Samurai# directory. I still need to write the two rules to move that into 96059Samurai# the "cdrom" and "ftp" directories. 106059Samurai# I also need to "make ports" and install those, but I'm not going to do 116059Samurai# that on a 14.4 line just yet... 126059Samurai 136059Samurai# Things which without too much trouble can be considered variables 146059SamuraiEXTRADISTRIBUTIONS= secure games manpages proflibs dict info 156059SamuraiCPIO1= etc/services etc/protocols 166059SamuraiCPIO2= scripts/miscfuncs.sh scripts/instdist.sh scripts/netinst.sh \ 176059Samurai scripts/adduser.sh scripts/bininst.sh scripts/setup.sh 186059Samurai 198857SrgrimesFDDEVICE= fd0 2050479SpeterFDCYLS= 80 218857SrgrimesFDCYLSIZE= 15k 226059SamuraiFDLABEL= fd1200 2343313SbrianMNT= /mnt 2430715Sbrian 2526031SbrianZIPNSPLIT= gzip --no-name -9 -c | split -b 240640 - 2630715Sbrian 2726031Sbrian 2830715Sbrian# Things which will get you into trouble if you change them 2926031SbrianDISTRIBUTIONS= bin ${EXTRADISTRIBUTIONS} 3030715SbrianMTREEFILES= ${.CURDIR}/../etc/mtree 3136285SbrianRD= ${RELEASEDIR}/stage 3230715Sbrian 3338628Sbrianrelease: 3430715Sbrian.if !defined(CHROOTDIR) 3526516Sbrian @echo "To make a release you must set CHROOTDIR" && false 3653298Sbrian.endif 3753298Sbrian -mkdir ${CHROOTDIR} 3853298Sbrian chflags -R noschg ${CHROOTDIR}/. 3953298Sbrian rm -rf ${CHROOTDIR}/* 4053298Sbrian cd ${.CURDIR}/../etc ; ${MAKE} distrib-dirst DESTDIR=${CHROOTDIR} 4130715Sbrian cd ${.CURDIR}/.. ; ${MAKE} install DESTDIR=${CHROOTDIR} 4230715Sbrian echo "#!/bin/sh" > ${CHROOTDIR}/mk 4330715Sbrian echo "set -ex" >> ${CHROOTDIR}/mk 4430715Sbrian echo "cd /usr/src" >> ${CHROOTDIR}/mk 4530715Sbrian echo "make world" >> ${CHROOTDIR}/mk 4630715Sbrian echo "cd release" >> ${CHROOTDIR}/mk 4730715Sbrian echo "make doRELEASE RELEASEDIR=/R" >> ${CHROOTDIR}/mk 4830715Sbrian.if !defined(RELEASETAG) 4950059Sbrian cd ${CHROOTDIR}/usr ; cvs co src 5046086Sbrian.else 5146086Sbrian cd ${CHROOTDIR}/usr ; cvs export -r ${RELEASETAG} src 5246086Sbrian.endif 5339395Sbrian chmod 755 ${CHROOTDIR}/mk 5439395Sbrian chroot ${CHROOTDIR} /mk 5539395Sbrian 5646686Sbrianclean: 5737009Sbrian rm -rf cpio_crunch boot_crunch release.[1-9] 5831343Sbrian 5930715Sbrian# Clean out ${RELEASEDIR} and make the directory structure. 6030715Sbrianrelease.1: 6130715Sbrian @cd ${.CURDIR} ; $(MAKE) ckRELEASEDIR 626059Samurai -mkdir ${RELEASEDIR} 636059Samurai chflags -R noschg ${RELEASEDIR}/. 6431690Sbrian rm -rf ${RELEASEDIR}/* 6536285Sbrian mkdir ${RD} 6636285Sbrian mkdir ${RD}/bootfd 6738557Sbrian mkdir ${RD}/bootfd/dev 6838557Sbrian mkdir ${RD}/bootfd/mnt 696059Samurai mkdir ${RD}/bootfd/stand 7050059Sbrian mkdir ${RD}/cpiofd 7151075Sbrian mkdir ${RD}/cpiofd/stand 7231343Sbrian mkdir ${RD}/floppies 7325630Sbrian mkdir ${RD}/dists 7436285Sbrian mkdir ${RD}/tarballs 7536285Sbrian for i in ${DISTRIBUTIONS} ; do \ 7630715Sbrian mkdir ${RD}/dists/$$i ; \ 7730715Sbrian mkdir ${RD}/tarballs/$$i ; \ 7830715Sbrian mtree -deU -f ${MTREEFILES}/BSD.root.dist \ 7931080Sbrian -p ${RD}/dists/$$i > /dev/null ; \ 8036285Sbrian mtree -deU -f ${MTREEFILES}/BSD.usr.dist \ 8136285Sbrian -p ${RD}/dists/$$i/usr > /dev/null ; \ 8236285Sbrian mtree -deU -f ${MTREEFILES}/BSD.var.dist \ 8336285Sbrian -p ${RD}/dists/$$i/var > /dev/null ; \ 8443313Sbrian done 8543313Sbrian touch release.1 8643313Sbrian 8736285Sbrian# Install the system into the various distributions. 8836285Sbrianrelease.2: 8936285Sbrian @cd ${.CURDIR} ; $(MAKE) ckRELEASEDIR 9036285Sbrian cd ${.CURDIR}/.. ; make distribute DISTDIR=${RD}/dists 9136285Sbrian touch release.2 9238174Sbrian 9336285Sbrian# Make and install a couple of kernels we need. 9440561Sbrianrelease.3: 9553298Sbrian @cd ${.CURDIR} ; $(MAKE) ckRELEASEDIR 966059Samurai cd ${.CURDIR}/../sys/i386/conf ; \ 9736285Sbrian config GENERIC ; \ 9836285Sbrian config BOOTFLP 9936285Sbrian cd ${.CURDIR}/../sys/compile/GENERIC ; \ 10036285Sbrian make depend ; \ 10136285Sbrian make kernel ; \ 10236285Sbrian install -c kernel ${RD}/dists/bin/kernel.GENERIC 10336285Sbrian ln -f ${RD}/dists/bin/kernel.GENERIC \ 10436285Sbrian ${RD}/cpiofd/kernel 10536285Sbrian cd ${.CURDIR}/../sys/compile/BOOTFLP ; \ 10636285Sbrian make depend ; \ 10736285Sbrian make kernel ; \ 10836285Sbrian install -s -c kernel ${RD}/bootfd/kernel 10936285Sbrian touch release.3 11036285Sbrian 11136285Sbrian# Make and install the two crunched binaries which live on the floppies. 11236285Sbrian# You are not supposed to like this :-) 11336285Sbrianrelease.4: 11436285Sbrian @cd ${.CURDIR} ; $(MAKE) ckRELEASEDIR 11536285Sbrian for j in boot cpio ; do \ 11636285Sbrian rm -rf $${j}_crunch ; \ 11736285Sbrian mkdir $${j}_crunch ; \ 11836285Sbrian ( cd $${j}_crunch ; \ 11936285Sbrian crunchgen ${.CURDIR}/$${j}_crunch.conf ; \ 12036285Sbrian ${MAKE} -f $${j}_crunch.mk objs exe NOCRYPT=yes ) ; \ 12136285Sbrian gzip -9 < $${j}_crunch/$${j}_crunch \ 12238174Sbrian > ${RD}/$${j}fd/stand/$${j}_crunch ; \ 12338174Sbrian rm -rf $${j}_crunch ; \ 12438544Sbrian chmod 555 ${RD}/$${j}fd/stand/$${j}_crunch ; \ 12540665Sbrian for i in `crunchgen -l ${.CURDIR}/$${j}_crunch.conf` ; do \ 12640665Sbrian ln -f ${RD}/$${j}fd/stand/$${j}_crunch \ 12743313Sbrian ${RD}/$${j}fd/stand/$$i ; \ 12844073Sbrian done ; \ 12946686Sbrian done 13046686Sbrian touch release.4 13150867Sbrian 13252488Sbrian# Fix up the distributions. 1336059Samurairelease.5: 13436285Sbrian @cd ${.CURDIR} ; $(MAKE) ckRELEASEDIR 13536285Sbrian if [ -d ${RD}/dists/bin/usr/share/man ] ; then \ 13636285Sbrian rm -rf ${RD}/dists/manpages/usr/share/man ;\ 13736285Sbrian mv ${RD}/dists/bin/usr/share/man \ 13836285Sbrian ${RD}/dists/manpages/usr/share/man ;\ 13936285Sbrian fi 14044106Sbrian if [ -d ${RD}/dists/bin/usr/games ] ; then \ 14144106Sbrian rm -rf ${RD}/dists/games/usr/games ;\ 14244106Sbrian mv ${RD}/dists/bin/usr/games \ 14344106Sbrian ${RD}/dists/games/usr/games ;\ 14447858Sbrian fi 14547858Sbrian if [ -d ${RD}/dists/bin/usr/share/games ] ; then \ 14647858Sbrian rm -rf ${RD}/dists/games/usr/share/games ;\ 14747858Sbrian mv ${RD}/dists/bin/usr/share/games \ 14847858Sbrian ${RD}/dists/games/usr/share/games ;\ 14947858Sbrian fi 15047858Sbrian if [ -d ${RD}/dists/bin/var/games ] ; then \ 15147858Sbrian rm -rf ${RD}/dists/games/var/games ;\ 15247858Sbrian mv ${RD}/dists/bin/var/games \ 15336285Sbrian ${RD}/dists/games/var/games ;\ 15453970Sbrian fi 15536285Sbrian if [ -d ${RD}/dists/bin/usr/share/dict ] ; then \ 15636285Sbrian rm -rf ${RD}/dists/dict/usr/share/dict ;\ 15736285Sbrian mv ${RD}/dists/bin/usr/share/dict \ 15836285Sbrian ${RD}/dists/dict/usr/share/dict ;\ 15936285Sbrian fi 16036285Sbrian for i in airport birthtoken flowers na.phone zipcodes ; do \ 16136285Sbrian if [ -f ${RD}/dists/bin/usr/share/misc/$$i ] ; then \ 16236285Sbrian mv ${RD}/dists/bin/usr/share/misc/$$i \ 16336285Sbrian ${RD}/dists/dict/usr/share/misc ; \ 16436285Sbrian fi ; \ 16536285Sbrian done 16636285Sbrian for i in ${RD}/dists/bin/usr/lib/*_p.a ; do \ 16736934Sbrian if [ -f $$i ] ; then \ 16840561Sbrian mv $$i \ 16940561Sbrian ${RD}/dists/proflibs/usr/lib ; \ 17040561Sbrian fi ; \ 17140561Sbrian done 17240679Sbrian -cd ${RD}/dists ; \ 17350059Sbrian find ${EXTRADISTRIBUTIONS} -depth -type d -print | xargs rmdir 17436285Sbrian 17536285Sbrian touch release.5 17631343Sbrian 1776059Samurai# Complete the bootfd 17836285Sbrianrelease.6: 17936285Sbrian @cd ${.CURDIR} ; $(MAKE) ckRELEASEDIR 18036285Sbrian ( cd ${RD}/dists/bin/dev ; \ 18136285Sbrian ls console tty ttyv1 null zero \ 18236285Sbrian sd[0123][a-h] wd[0123][a-h] fd[01] \ 18336285Sbrian rsd[0123][a-h] rwd[0123][a-h] rfd[01] | \ 18436285Sbrian cpio -dump ${RD}/bootfd/dev ) 18536285Sbrian install -c ${.CURDIR}/../COPYRIGHT ${RD}/bootfd 18636285Sbrian cd ${RD}/dists/bin/usr/share/FAQ ; \ 18736285Sbrian install -c diskspace.FAQ ${RD}/bootfd/DISKSPACE.FAQ ;\ 18836285Sbrian install -c RELNOTES.FreeBSD ${RD}/bootfd ;\ 1896059Samurai install -c TROUBLESHOOTING ${RD}/bootfd ;\ 19031343Sbrian install -c README-2.0 ${RD}/bootfd/README 1916059Samurai touch ${RD}/bootfd/this_is_boot_flp 19228679Sbrian.if !defined(VNDEVICE) 19336285Sbrian -umount /dev/${FDDEVICE} 19436285Sbrian -umount ${MNT} 1956059Samurai echo y | fdformat /dev/r${FDDEVICE} 19636285Sbrian disklabel -w -r -B \ 19736285Sbrian -b ${RD}/dists/bin/usr/mdec/fdboot \ 19826516Sbrian -s ${RD}/dists/bin/usr/mdec/bootfd \ 19936285Sbrian /dev/r${FDDEVICE} ${FDLABEL} 20026516Sbrian newfs -c 80 -b 4096 -f 512 -i 9000 -m 0 -t 0 -u 0 \ 20136285Sbrian -o space -T ${FDLABEL} /dev/r${FDDEVICE} 20236285Sbrian mount -o async /dev/${FDDEVICE} ${MNT} 20336285Sbrian cd ${RD}/bootfd ; find . -print | cpio -dumpv ${MNT} 20436285Sbrian sync 20536285Sbrian umount ${MNT} 20636285Sbrian fsck /dev/r${FDDEVICE} 20728679Sbrian dd if=/dev/r${FDDEVICE} of=${RD}/floppies/boot.tmp \ 2086059Samurai bs=${FDCYLSIZE} count=${FDCYLS} 20926516Sbrian mv ${RD}/floppies/boot.tmp ${RD}/floppies/boot.flp 2106059Samurai gzip -9 -c < ${RD}/floppies/boot.flp > ${RD}/floppies/boot.flp.gz 21136285Sbrian.endif 21231372Sbrian touch release.6 21336285Sbrian 21436285Sbrian# Complete the cpiofd directory 21536285Sbrian# XXX a lot of stuff is missing here... 21631372Sbrianrelease.7: 21731372Sbrian @cd ${.CURDIR} ; $(MAKE) ckRELEASEDIR 21831372Sbrian cd ${RD}/dists/bin ; ls ${CPIO1} | cpio -dump ${RD}/cpiofd 21931372Sbrian cd ${.CURDIR} ; ls ${CPIO2} | cpio -dumpv ${RD}/cpiofd 22031372Sbrian chmod 755 ${RD}/cpiofd/scripts/* 22131372Sbrian cp ${RD}/dists/bin/usr/sbin/tzsetup ${RD}/cpiofd 2226059Samurai ( cd ${RD}/cpiofd ; \ 22336285Sbrian ( rm -f OK ; find . -print ; touch OK ; echo OK ) | \ 22436285Sbrian cpio -H newc -oa | gzip -9 -c | dd conv=osync ) \ 22536285Sbrian > ${RD}/floppies/cpio.flp 22636285Sbrian gzip -1 -c < ${RD}/floppies/cpio.flp > ${RD}/floppies/cpio.flp.gz 22736285Sbrian touch release.7 22836285Sbrian 22940482Sbrian# Make binary tarballs 23040482Sbrianrelease.8: 23140482Sbrian @cd ${.CURDIR} ; $(MAKE) ckRELEASEDIR 23236285Sbrian rm -rf ${RD}/tarballs 23331372Sbrian mkdir -p ${RD}/tarballs 23436285Sbrian @for i in ${DISTRIBUTIONS} ; \ 2356059Samurai do \ 23631372Sbrian if [ -d ${RD}/dists/$${i} ] ; then \ 23736285Sbrian cd ${.CURDIR} ; \ 23826516Sbrian $(MAKE) doTARBALL SD=${RD}/dists/$${i} \ 23926516Sbrian TD=$$i ARG="." ; \ 2406059Samurai ( cd ${RD}/tarballs/$${i}; \ 2416059Samurai sh -e ${.CURDIR}/scripts/mkchecksums.sh ) ; \ 24236285Sbrian cp ${.CURDIR}/scripts/extract_$${i}.sh \ 24336285Sbrian ${RD}/tarballs/$${i}/extract.sh;\ 2446059Samurai echo "$${i} distribution is finished."; \ 24536285Sbrian fi ; \ 24636285Sbrian done 24736285Sbrian touch release.8 2486059Samurai 24936285Sbrian .include <bsd.prog.mk> 25036285Sbrian 25136285Sbrian# Make source tarballs 25236285Sbrianrelease.9: 25336285Sbrian @cd ${.CURDIR} ; $(MAKE) ckRELEASEDIR 25436285Sbrian @cd ${.CURDIR} ; $(MAKE) doTARBALL SD=/usr/src TD=src/base ARG="[A-Z]*" 25536285Sbrian @for i in bin etc games gnu include lib libexec release sbin \ 25636285Sbrian secure lkm eBones share sys usrbin usrsbin ; do \ 2576059Samurai if [ -d /usr/src/$$i ] ; then \ 25836285Sbrian cd ${.CURDIR} ; \ 25936285Sbrian $(MAKE) doTARBALL SD=/usr/src \ 2606059Samurai TD=src/$$i ARG="$$i" ; \ 2616059Samurai fi ; \ 2626059Samurai done 26336285Sbrian ( cd ${RD}/tarballs/src; \ 2646059Samurai sh -e ${.CURDIR}/scripts/mkchecksums.sh ) ; \ 26536285Sbrian cp ${.CURDIR}/scripts/extract_src.sh \ 26636285Sbrian ${RD}/tarballs/src/extract.sh;\ 26711336Samurai echo "src distribution is finished."; \ 26836285Sbrian #touch release.9 26936285Sbrian 27036285Sbrian# Various "subroutine" and other supporting targets. 2716059Samurai 27226516SbriandoTARBALL: 27336285Sbrian.if !defined(SD) 27436285Sbrian @echo "SD undefined in doTARBALL" ; exit 1 27536285Sbrian.endif 27632711Sbrian.if !defined(TD) 27736285Sbrian @echo "TB undefined in doTARBALL" ; exit 1 27836285Sbrian.endif 27936285Sbrian.if !defined(ARG) 28036285Sbrian @echo "ARGundefined in doTARBALL" ; exit 1 28136285Sbrian.endif 28231121Sbrian rm -rf ${RD}/tarballs/${TD} 28336285Sbrian mkdir -p ${RD}/tarballs/${TD} 28436285Sbrian ( cd ${SD} ; \ 28536285Sbrian echo rolling ${TD} tarball ;\ 28636285Sbrian tar --exclude CVS -cf - ${ARG} | \ 28736285Sbrian ${ZIPNSPLIT} ${RD}/tarballs/${TD}/`basename ${TD}`. ) 28836285Sbrian 28936285SbriandoRELEASE: release.1 release.2 release.3 release.4 release.5 release.6 \ 29036285Sbrian release.7 release.8 release.9 29136285Sbrian @echo "Release done" 29236285Sbrian 29336285SbrianckRELEASEDIR: 29440797Sbrian.if !defined(RELEASEDIR) 29540797Sbrian @echo "To make a release RELEASEDIR must be defined" && false 29636285Sbrian.endif 29740797Sbrian 29836285Sbrian