Makefile revision 7052
1# $Id: Makefile,v 1.113 1995/02/28 20:32:29 phk Exp $ 2# 3# How to roll a release: 4# 5# make release CHROOTDIR=<lots of disk> [ RELEASETAG=something ] 6# 7# As far as I know, this will roll everything nicely into the "stage" 8# directory. I still need to write the two rules to move that into 9# the "cdrom" and "ftp" directories. 10# I also need to "make ports" and install those, but I'm not going to do 11# that on a 14.4 line just yet... 12 13# Things which without too much trouble can be considered variables 14EXTRADISTRIBUTIONS= secure games manpages proflibs dict info 15CPIO1= etc/services etc/protocols 16CPIO2= scripts/miscfuncs.sh scripts/instdist.sh scripts/netinst.sh \ 17 scripts/adduser.sh scripts/bininst.sh scripts/setup.sh 18 19FDDEVICE= fd0 20FDCYLS= 80 21FDCYLSIZE= 15k 22FDLABEL= fd1200 23MNT= /mnt 24 25ZIPNSPLIT= gzip --no-name -9 -c | split -b 240640 - 26 27 28# Things which will get you into trouble if you change them 29DISTRIBUTIONS= bin ${EXTRADISTRIBUTIONS} 30MTREEFILES= ${.CURDIR}/../etc/mtree 31RD= ${RELEASEDIR}/stage 32 33release: 34.if !defined(CHROOTDIR) 35 @echo "To make a release you must set CHROOTDIR" && false 36.endif 37 -mkdir ${CHROOTDIR} 38 chflags -R noschg ${CHROOTDIR}/. 39 rm -rf ${CHROOTDIR}/* 40 cd ${.CURDIR}/../etc ; ${MAKE} distrib-dirs DESTDIR=${CHROOTDIR} 41 cd ${.CURDIR}/../etc ; ${MAKE} distribution DESTDIR=${CHROOTDIR} 42 cd ${.CURDIR}/.. ; ${MAKE} install DESTDIR=${CHROOTDIR} 43 echo "#!/bin/sh" > ${CHROOTDIR}/mk 44 echo "set -ex" >> ${CHROOTDIR}/mk 45 echo "cd /usr/src" >> ${CHROOTDIR}/mk 46 echo "make world" >> ${CHROOTDIR}/mk 47 echo "cd sbin/sysinstall" >> ${CHROOTDIR}/mk 48 echo "make obj" >> ${CHROOTDIR}/mk 49 echo "cd ../../release" >> ${CHROOTDIR}/mk 50 echo "make obj" >> ${CHROOTDIR}/mk 51 echo "make doRELEASE" >> ${CHROOTDIR}/mk 52 echo "RELEASEDIR=/R" >> ${CHROOTDIR}/etc/make.conf 53.if !defined(RELEASETAG) 54 cd ${CHROOTDIR}/usr ; cvs co -P src 55.else 56 cd ${CHROOTDIR}/usr ; cvs export -r ${RELEASETAG} src 57.endif 58 chmod 755 ${CHROOTDIR}/mk 59 chroot ${CHROOTDIR} /mk 60 61clean: 62 rm -rf cpio_crunch boot_crunch release.[0-9] release.1[0] 63 64# Clean out ${RELEASEDIR} and make the directory structure. 65release.1: 66 @cd ${.CURDIR} ; $(MAKE) ckRELEASEDIR 67 -mkdir ${RELEASEDIR} 68 chflags -R noschg ${RELEASEDIR}/. 69 rm -rf ${RELEASEDIR}/* 70 mkdir ${RD} 71 mkdir ${RD}/bootfd 72 mkdir ${RD}/bootfd/dev 73 mkdir ${RD}/bootfd/mnt 74 mkdir ${RD}/bootfd/stand 75 mkdir ${RD}/cpiofd 76 mkdir ${RD}/cpiofd/stand 77 mkdir ${RD}/fixitfd 78 mkdir ${RD}/fixitfd/stand 79 mkdir ${RD}/fixitfd/sbin 80 mkdir ${RD}/fixitfd/mnt 81 mkdir ${RD}/floppies 82 mkdir ${RD}/dists 83 mkdir ${RD}/dists/bin 84 mkdir ${RD}/tarballs 85 mkdir ${RD}/tarballs/bin 86 cd ${.CURDIR}/../etc && make distrib-dirs DESTDIR=${RD}/dists/bin 87 for i in ${EXTRADISTRIBUTIONS} ; do \ 88 mkdir ${RD}/dists/$$i ; \ 89 mkdir ${RD}/tarballs/$$i ; \ 90 mtree -deU -f ${MTREEFILES}/BSD.root.dist \ 91 -p ${RD}/dists/$$i > /dev/null ; \ 92 mtree -deU -f ${MTREEFILES}/BSD.usr.dist \ 93 -p ${RD}/dists/$$i/usr > /dev/null ; \ 94 mtree -deU -f ${MTREEFILES}/BSD.var.dist \ 95 -p ${RD}/dists/$$i/var > /dev/null ; \ 96 done 97 touch release.1 98 99# Install the system into the various distributions. 100release.2: 101 @cd ${.CURDIR} ; $(MAKE) ckRELEASEDIR 102 cd ${.CURDIR}/.. ; make distribute DISTDIR=${RD}/dists 103 touch release.2 104 105# Make and install a couple of kernels we need. 106release.3: 107 @cd ${.CURDIR} ; $(MAKE) ckRELEASEDIR 108 cd ${.CURDIR}/../sys/i386/conf ; \ 109 config GENERIC ; \ 110 config BOOTFLP 111 cd ${.CURDIR}/../sys/compile/GENERIC ; \ 112 make depend ; \ 113 make kernel ; \ 114 install -c kernel ${RD}/dists/bin/kernel.GENERIC 115 ln -f ${RD}/dists/bin/kernel.GENERIC ${RD}/cpiofd/kernel 116 cd ${.CURDIR}/../sys/compile/BOOTFLP ; \ 117 make depend ; \ 118 make kernel ; \ 119 install -s -c kernel ${RD}/bootfd/kernel 120 ln -f ${RD}/bootfd/kernel ${RD}/fixitfd/kernel 121 touch release.3 122 123# Make and install the two crunched binaries which live on the floppies. 124# You are not supposed to like this :-) 125release.4: 126 @cd ${.CURDIR} ; $(MAKE) ckRELEASEDIR 127 for j in boot cpio fixit; do \ 128 rm -rf $${j}_crunch ; \ 129 mkdir $${j}_crunch ; \ 130 ( cd $${j}_crunch ; \ 131 crunchgen ${.CURDIR}/$${j}_crunch.conf ; \ 132 ${MAKE} -f $${j}_crunch.mk objs exe NOCRYPT=yes ) ; \ 133 gzip -9 < $${j}_crunch/$${j}_crunch \ 134 > ${RD}/$${j}fd/stand/$${j}_crunch ; \ 135 rm -rf $${j}_crunch ; \ 136 chmod 555 ${RD}/$${j}fd/stand/$${j}_crunch ; \ 137 for i in `crunchgen -l ${.CURDIR}/$${j}_crunch.conf` ; do \ 138 ln -f ${RD}/$${j}fd/stand/$${j}_crunch \ 139 ${RD}/$${j}fd/stand/$$i ; \ 140 done ; \ 141 done 142 touch release.4 143 144# Fix up the distributions. 145release.5: 146 @cd ${.CURDIR} ; $(MAKE) ckRELEASEDIR 147 if [ -d ${RD}/dists/bin/usr/share/man ] ; then \ 148 rm -rf ${RD}/dists/manpages/usr/share/man ;\ 149 mv ${RD}/dists/bin/usr/share/man \ 150 ${RD}/dists/manpages/usr/share/man ;\ 151 fi 152 if [ -d ${RD}/dists/bin/usr/games ] ; then \ 153 rm -rf ${RD}/dists/games/usr/games ;\ 154 mv ${RD}/dists/bin/usr/games \ 155 ${RD}/dists/games/usr/games ;\ 156 fi 157 if [ -d ${RD}/dists/bin/usr/share/games ] ; then \ 158 rm -rf ${RD}/dists/games/usr/share/games ;\ 159 mv ${RD}/dists/bin/usr/share/games \ 160 ${RD}/dists/games/usr/share/games ;\ 161 fi 162 if [ -d ${RD}/dists/bin/var/games ] ; then \ 163 rm -rf ${RD}/dists/games/var/games ;\ 164 mv ${RD}/dists/bin/var/games \ 165 ${RD}/dists/games/var/games ;\ 166 fi 167 if [ -d ${RD}/dists/bin/usr/share/dict ] ; then \ 168 rm -rf ${RD}/dists/dict/usr/share/dict ;\ 169 mv ${RD}/dists/bin/usr/share/dict \ 170 ${RD}/dists/dict/usr/share/dict ;\ 171 fi 172 for i in airport birthtoken flowers na.phone zipcodes ; do \ 173 if [ -f ${RD}/dists/bin/usr/share/misc/$$i ] ; then \ 174 mv ${RD}/dists/bin/usr/share/misc/$$i \ 175 ${RD}/dists/dict/usr/share/misc ; \ 176 fi ; \ 177 done 178 for i in ${RD}/dists/bin/usr/lib/*_p.a ; do \ 179 if [ -f $$i ] ; then \ 180 mv $$i \ 181 ${RD}/dists/proflibs/usr/lib ; \ 182 fi ; \ 183 done 184 -cd ${RD}/dists ; \ 185 find ${EXTRADISTRIBUTIONS} -depth -type d -print | xargs rmdir 186 187 touch release.5 188 189# Complete the bootfd 190release.6: 191 @cd ${.CURDIR} ; $(MAKE) ckRELEASEDIR 192 ( cd ${RD}/dists/bin/dev ; \ 193 ls console tty ttyv1 null zero \ 194 sd[0123][a-h] wd[0123][a-h] fd[01] \ 195 rsd[0123][a-h] rwd[0123][a-h] rfd[01] | \ 196 cpio -dump ${RD}/bootfd/dev ) 197 install -c ${.CURDIR}/../COPYRIGHT ${RD}/bootfd 198 cd ${RD}/dists/bin/usr/share/FAQ ; \ 199 install -c diskspace.FAQ ${RD}/bootfd/DISKSPACE.FAQ ;\ 200 install -c RELNOTES.FreeBSD ${RD}/bootfd ;\ 201 install -c TROUBLESHOOTING ${RD}/bootfd ;\ 202 install -c README-2.0 ${RD}/bootfd/README 203 touch ${RD}/bootfd/this_is_boot_flp 204 cd ${.CURDIR} ; ${MAKE} doFLOPPY FLOPPY=boot 205 touch release.6 206 207# Complete the cpiofd directory 208# XXX a lot of stuff is missing here... 209release.7: 210 @cd ${.CURDIR} ; $(MAKE) ckRELEASEDIR 211 cd ${RD}/dists/bin ; ls ${CPIO1} | cpio -dump ${RD}/cpiofd 212 cd ${.CURDIR} ; ls ${CPIO2} | cpio -dumpv ${RD}/cpiofd 213 chmod 755 ${RD}/cpiofd/scripts/* 214 cp ${RD}/dists/bin/usr/sbin/tzsetup ${RD}/cpiofd 215 ( cd ${RD}/cpiofd ; \ 216 ( rm -f OK ; find . -print ; touch OK ; echo OK ) | \ 217 cpio -H newc -oa | gzip -9 -c | dd conv=osync ) \ 218 > ${RD}/floppies/cpio.flp 219 gzip -1 -c < ${RD}/floppies/cpio.flp > ${RD}/floppies/cpio.flp.gz 220 touch release.7 221 222# Make binary tarballs 223release.8: 224 @cd ${.CURDIR} ; $(MAKE) ckRELEASEDIR 225 rm -rf ${RD}/tarballs 226 mkdir -p ${RD}/tarballs 227 @for i in ${DISTRIBUTIONS} ; \ 228 do \ 229 if [ -d ${RD}/dists/$${i} ] ; then \ 230 cd ${.CURDIR} ; \ 231 $(MAKE) doTARBALL SD=${RD}/dists/$${i} \ 232 TD=$$i ARG="." ; \ 233 ( cd ${RD}/tarballs/$${i}; \ 234 sh -e ${.CURDIR}/scripts/mkchecksums.sh ) ; \ 235 cp ${.CURDIR}/scripts/extract_$${i}.sh \ 236 ${RD}/tarballs/$${i}/extract.sh;\ 237 echo "$${i} distribution is finished."; \ 238 fi ; \ 239 done 240 touch release.8 241 242 243# Make source tarballs 244release.9: 245 @cd ${.CURDIR} ; $(MAKE) ckRELEASEDIR 246 @cd ${.CURDIR} ; $(MAKE) doTARBALL SD=/usr/src TD=src/base ARG="[A-Z]*" 247 @for i in bin etc games gnu include lib libexec release sbin \ 248 secure lkm eBones share sys usrbin usrsbin ; do \ 249 if [ -d /usr/src/$$i ] ; then \ 250 cd ${.CURDIR} ; \ 251 $(MAKE) doTARBALL SD=/usr/src \ 252 TD=src/$$i ARG="$$i" ; \ 253 fi ; \ 254 done 255 ( cd ${RD}/tarballs/src; \ 256 sh -e ${.CURDIR}/scripts/mkchecksums.sh ) ; \ 257 cp ${.CURDIR}/scripts/extract_src.sh \ 258 ${RD}/tarballs/src/extract.sh;\ 259 echo "src distribution is finished."; \ 260 touch release.9 261 262# Complete the fixitfd 263release.10: 264 @cd ${.CURDIR} ; $(MAKE) ckRELEASEDIR 265 ( cd ${RD}/dists/bin/dev ; \ 266 ls console tty ttyv1 null zero \ 267 sd[0123][a-h] wd[0123][a-h] fd[01] \ 268 rsd[0123][a-h] rwd[0123][a-h] rfd[01] | \ 269 cpio -dump ${RD}/fixitfd/dev ) 270 ln -f ${RD}/fixitfd/stand/init ${RD}/fixitfd/sbin 271 cd ${.CURDIR} ; ${MAKE} doFLOPPY FLOPPY=fixit 272 touch release.10 273 274 275# Various "subroutine" and other supporting targets. 276 277doTARBALL: 278.if !defined(SD) 279 @echo "SD undefined in doTARBALL" ; exit 1 280.endif 281.if !defined(TD) 282 @echo "TB undefined in doTARBALL" ; exit 1 283.endif 284.if !defined(ARG) 285 @echo "ARG undefined in doTARBALL" ; exit 1 286.endif 287 rm -rf ${RD}/tarballs/${TD} 288 mkdir -p ${RD}/tarballs/${TD} 289 ( cd ${SD} ; \ 290 echo rolling ${TD} tarball ;\ 291 tar --exclude CVS -cf - ${ARG} | \ 292 ${ZIPNSPLIT} ${RD}/tarballs/${TD}/`basename ${TD}`. ) 293 294doRELEASE: release.1 release.2 release.3 release.4 release.5 release.6 \ 295 release.7 release.8 release.9 release.10 296 @echo "Release done" 297 298ckRELEASEDIR: 299.if !defined(RELEASEDIR) 300 @echo "To make a release RELEASEDIR must be defined" && false 301.endif 302 303doFLOPPY: 304.if !defined(FLOPPY) 305 @echo "FLOPPY undefined in doFLOPPY" ; exit 1 306.endif 307.if !defined(VNDEVICE) 308 -umount /dev/${FDDEVICE} 309 -umount ${MNT} 310 echo y | fdformat /dev/r${FDDEVICE} 311 disklabel -w -r -B \ 312 -b ${RD}/dists/bin/usr/mdec/fdboot \ 313 -s ${RD}/dists/bin/usr/mdec/bootfd \ 314 /dev/r${FDDEVICE} ${FDLABEL} 315 newfs -c 80 -b 4096 -f 512 -i 4096 -m 0 -t 0 -u 0 \ 316 -o space -T ${FDLABEL} /dev/r${FDDEVICE} 317 mount -o async /dev/${FDDEVICE} ${MNT} 318 cd ${RD}/${FLOPPY}fd ; find . -print | cpio -dumpv ${MNT} 319 sync 320 umount ${MNT} 321 fsck /dev/r${FDDEVICE} 322 dd if=/dev/r${FDDEVICE} of=${RD}/floppies/${FLOPPY}.tmp \ 323 bs=${FDCYLSIZE} count=${FDCYLS} 324 mv ${RD}/floppies/${FLOPPY}.tmp ${RD}/floppies/${FLOPPY}.flp 325 gzip -9 -c < ${RD}/floppies/${FLOPPY}.flp \ 326 > ${RD}/floppies/${FLOPPY}.flp.gz 327.endif 328 329.include <bsd.prog.mk> 330