Makefile revision 6746
1# $Id: Makefile,v 1.109 1995/02/26 01:35:32 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 RELEASEDIR=/R" >> ${CHROOTDIR}/mk 52.if !defined(RELEASETAG) 53 cd ${CHROOTDIR}/usr ; cvs co src 54.else 55 cd ${CHROOTDIR}/usr ; cvs export -r ${RELEASETAG} src 56.endif 57 chmod 755 ${CHROOTDIR}/mk 58 chroot ${CHROOTDIR} /mk 59 60clean: 61 rm -rf cpio_crunch boot_crunch release.[1-9] 62 63# Clean out ${RELEASEDIR} and make the directory structure. 64release.1: 65 @cd ${.CURDIR} ; $(MAKE) ckRELEASEDIR 66 -mkdir ${RELEASEDIR} 67 chflags -R noschg ${RELEASEDIR}/. 68 rm -rf ${RELEASEDIR}/* 69 mkdir ${RD} 70 mkdir ${RD}/bootfd 71 mkdir ${RD}/bootfd/dev 72 mkdir ${RD}/bootfd/mnt 73 mkdir ${RD}/bootfd/stand 74 mkdir ${RD}/cpiofd 75 mkdir ${RD}/cpiofd/stand 76 mkdir ${RD}/floppies 77 mkdir ${RD}/dists 78 mkdir ${RD}/dists/bin 79 mkdir ${RD}/tarballs 80 mkdir ${RD}/tarballs/bin 81 cd ${.CURDIR}/../etc && make distrib-dirs DESTDIR=${RD}/dists/bin 82 for i in ${EXTRADISTRIBUTIONS} ; do \ 83 mkdir ${RD}/dists/$$i ; \ 84 mkdir ${RD}/tarballs/$$i ; \ 85 mtree -deU -f ${MTREEFILES}/BSD.root.dist \ 86 -p ${RD}/dists/$$i > /dev/null ; \ 87 mtree -deU -f ${MTREEFILES}/BSD.usr.dist \ 88 -p ${RD}/dists/$$i/usr > /dev/null ; \ 89 mtree -deU -f ${MTREEFILES}/BSD.var.dist \ 90 -p ${RD}/dists/$$i/var > /dev/null ; \ 91 done 92 touch release.1 93 94# Install the system into the various distributions. 95release.2: 96 @cd ${.CURDIR} ; $(MAKE) ckRELEASEDIR 97 cd ${.CURDIR}/.. ; make distribute DISTDIR=${RD}/dists 98 touch release.2 99 100# Make and install a couple of kernels we need. 101release.3: 102 @cd ${.CURDIR} ; $(MAKE) ckRELEASEDIR 103 cd ${.CURDIR}/../sys/i386/conf ; \ 104 config GENERIC ; \ 105 config BOOTFLP 106 cd ${.CURDIR}/../sys/compile/GENERIC ; \ 107 make depend ; \ 108 make kernel ; \ 109 install -c kernel ${RD}/dists/bin/kernel.GENERIC 110 ln -f ${RD}/dists/bin/kernel.GENERIC \ 111 ${RD}/cpiofd/kernel 112 cd ${.CURDIR}/../sys/compile/BOOTFLP ; \ 113 make depend ; \ 114 make kernel ; \ 115 install -s -c kernel ${RD}/bootfd/kernel 116 touch release.3 117 118# Make and install the two crunched binaries which live on the floppies. 119# You are not supposed to like this :-) 120release.4: 121 @cd ${.CURDIR} ; $(MAKE) ckRELEASEDIR 122 for j in boot cpio ; do \ 123 rm -rf $${j}_crunch ; \ 124 mkdir $${j}_crunch ; \ 125 ( cd $${j}_crunch ; \ 126 crunchgen ${.CURDIR}/$${j}_crunch.conf ; \ 127 ${MAKE} -f $${j}_crunch.mk objs exe NOCRYPT=yes ) ; \ 128 gzip -9 < $${j}_crunch/$${j}_crunch \ 129 > ${RD}/$${j}fd/stand/$${j}_crunch ; \ 130 rm -rf $${j}_crunch ; \ 131 chmod 555 ${RD}/$${j}fd/stand/$${j}_crunch ; \ 132 for i in `crunchgen -l ${.CURDIR}/$${j}_crunch.conf` ; do \ 133 ln -f ${RD}/$${j}fd/stand/$${j}_crunch \ 134 ${RD}/$${j}fd/stand/$$i ; \ 135 done ; \ 136 done 137 touch release.4 138 139# Fix up the distributions. 140release.5: 141 @cd ${.CURDIR} ; $(MAKE) ckRELEASEDIR 142 if [ -d ${RD}/dists/bin/usr/share/man ] ; then \ 143 rm -rf ${RD}/dists/manpages/usr/share/man ;\ 144 mv ${RD}/dists/bin/usr/share/man \ 145 ${RD}/dists/manpages/usr/share/man ;\ 146 fi 147 if [ -d ${RD}/dists/bin/usr/games ] ; then \ 148 rm -rf ${RD}/dists/games/usr/games ;\ 149 mv ${RD}/dists/bin/usr/games \ 150 ${RD}/dists/games/usr/games ;\ 151 fi 152 if [ -d ${RD}/dists/bin/usr/share/games ] ; then \ 153 rm -rf ${RD}/dists/games/usr/share/games ;\ 154 mv ${RD}/dists/bin/usr/share/games \ 155 ${RD}/dists/games/usr/share/games ;\ 156 fi 157 if [ -d ${RD}/dists/bin/var/games ] ; then \ 158 rm -rf ${RD}/dists/games/var/games ;\ 159 mv ${RD}/dists/bin/var/games \ 160 ${RD}/dists/games/var/games ;\ 161 fi 162 if [ -d ${RD}/dists/bin/usr/share/dict ] ; then \ 163 rm -rf ${RD}/dists/dict/usr/share/dict ;\ 164 mv ${RD}/dists/bin/usr/share/dict \ 165 ${RD}/dists/dict/usr/share/dict ;\ 166 fi 167 for i in airport birthtoken flowers na.phone zipcodes ; do \ 168 if [ -f ${RD}/dists/bin/usr/share/misc/$$i ] ; then \ 169 mv ${RD}/dists/bin/usr/share/misc/$$i \ 170 ${RD}/dists/dict/usr/share/misc ; \ 171 fi ; \ 172 done 173 for i in ${RD}/dists/bin/usr/lib/*_p.a ; do \ 174 if [ -f $$i ] ; then \ 175 mv $$i \ 176 ${RD}/dists/proflibs/usr/lib ; \ 177 fi ; \ 178 done 179 -cd ${RD}/dists ; \ 180 find ${EXTRADISTRIBUTIONS} -depth -type d -print | xargs rmdir 181 182 touch release.5 183 184# Complete the bootfd 185release.6: 186 @cd ${.CURDIR} ; $(MAKE) ckRELEASEDIR 187 ( cd ${RD}/dists/bin/dev ; \ 188 ls console tty ttyv1 null zero \ 189 sd[0123][a-h] wd[0123][a-h] fd[01] \ 190 rsd[0123][a-h] rwd[0123][a-h] rfd[01] | \ 191 cpio -dump ${RD}/bootfd/dev ) 192 install -c ${.CURDIR}/../COPYRIGHT ${RD}/bootfd 193 cd ${RD}/dists/bin/usr/share/FAQ ; \ 194 install -c diskspace.FAQ ${RD}/bootfd/DISKSPACE.FAQ ;\ 195 install -c RELNOTES.FreeBSD ${RD}/bootfd ;\ 196 install -c TROUBLESHOOTING ${RD}/bootfd ;\ 197 install -c README-2.0 ${RD}/bootfd/README 198 touch ${RD}/bootfd/this_is_boot_flp 199.if !defined(VNDEVICE) 200 -umount /dev/${FDDEVICE} 201 -umount ${MNT} 202 echo y | fdformat /dev/r${FDDEVICE} 203 disklabel -w -r -B \ 204 -b ${RD}/dists/bin/usr/mdec/fdboot \ 205 -s ${RD}/dists/bin/usr/mdec/bootfd \ 206 /dev/r${FDDEVICE} ${FDLABEL} 207 newfs -c 80 -b 4096 -f 512 -i 9000 -m 0 -t 0 -u 0 \ 208 -o space -T ${FDLABEL} /dev/r${FDDEVICE} 209 mount -o async /dev/${FDDEVICE} ${MNT} 210 cd ${RD}/bootfd ; find . -print | cpio -dumpv ${MNT} 211 sync 212 umount ${MNT} 213 fsck /dev/r${FDDEVICE} 214 dd if=/dev/r${FDDEVICE} of=${RD}/floppies/boot.tmp \ 215 bs=${FDCYLSIZE} count=${FDCYLS} 216 mv ${RD}/floppies/boot.tmp ${RD}/floppies/boot.flp 217 gzip -9 -c < ${RD}/floppies/boot.flp > ${RD}/floppies/boot.flp.gz 218.endif 219 touch release.6 220 221# Complete the cpiofd directory 222# XXX a lot of stuff is missing here... 223release.7: 224 @cd ${.CURDIR} ; $(MAKE) ckRELEASEDIR 225 cd ${RD}/dists/bin ; ls ${CPIO1} | cpio -dump ${RD}/cpiofd 226 cd ${.CURDIR} ; ls ${CPIO2} | cpio -dumpv ${RD}/cpiofd 227 chmod 755 ${RD}/cpiofd/scripts/* 228 cp ${RD}/dists/bin/usr/sbin/tzsetup ${RD}/cpiofd 229 ( cd ${RD}/cpiofd ; \ 230 ( rm -f OK ; find . -print ; touch OK ; echo OK ) | \ 231 cpio -H newc -oa | gzip -9 -c | dd conv=osync ) \ 232 > ${RD}/floppies/cpio.flp 233 gzip -1 -c < ${RD}/floppies/cpio.flp > ${RD}/floppies/cpio.flp.gz 234 touch release.7 235 236# Make binary tarballs 237release.8: 238 @cd ${.CURDIR} ; $(MAKE) ckRELEASEDIR 239 rm -rf ${RD}/tarballs 240 mkdir -p ${RD}/tarballs 241 @for i in ${DISTRIBUTIONS} ; \ 242 do \ 243 if [ -d ${RD}/dists/$${i} ] ; then \ 244 cd ${.CURDIR} ; \ 245 $(MAKE) doTARBALL SD=${RD}/dists/$${i} \ 246 TD=$$i ARG="." ; \ 247 ( cd ${RD}/tarballs/$${i}; \ 248 sh -e ${.CURDIR}/scripts/mkchecksums.sh ) ; \ 249 cp ${.CURDIR}/scripts/extract_$${i}.sh \ 250 ${RD}/tarballs/$${i}/extract.sh;\ 251 echo "$${i} distribution is finished."; \ 252 fi ; \ 253 done 254 touch release.8 255 256 .include <bsd.prog.mk> 257 258# Make source tarballs 259release.9: 260 @cd ${.CURDIR} ; $(MAKE) ckRELEASEDIR 261 @cd ${.CURDIR} ; $(MAKE) doTARBALL SD=/usr/src TD=src/base ARG="[A-Z]*" 262 @for i in bin etc games gnu include lib libexec release sbin \ 263 secure lkm eBones share sys usrbin usrsbin ; do \ 264 if [ -d /usr/src/$$i ] ; then \ 265 cd ${.CURDIR} ; \ 266 $(MAKE) doTARBALL SD=/usr/src \ 267 TD=src/$$i ARG="$$i" ; \ 268 fi ; \ 269 done 270 ( cd ${RD}/tarballs/src; \ 271 sh -e ${.CURDIR}/scripts/mkchecksums.sh ) ; \ 272 cp ${.CURDIR}/scripts/extract_src.sh \ 273 ${RD}/tarballs/src/extract.sh;\ 274 echo "src distribution is finished."; \ 275 #touch release.9 276 277# Various "subroutine" and other supporting targets. 278 279doTARBALL: 280.if !defined(SD) 281 @echo "SD undefined in doTARBALL" ; exit 1 282.endif 283.if !defined(TD) 284 @echo "TB undefined in doTARBALL" ; exit 1 285.endif 286.if !defined(ARG) 287 @echo "ARGundefined in doTARBALL" ; exit 1 288.endif 289 rm -rf ${RD}/tarballs/${TD} 290 mkdir -p ${RD}/tarballs/${TD} 291 ( cd ${SD} ; \ 292 echo rolling ${TD} tarball ;\ 293 tar --exclude CVS -cf - ${ARG} | \ 294 ${ZIPNSPLIT} ${RD}/tarballs/${TD}/`basename ${TD}`. ) 295 296doRELEASE: release.1 release.2 release.3 release.4 release.5 release.6 \ 297 release.7 release.8 release.9 298 @echo "Release done" 299 300ckRELEASEDIR: 301.if !defined(RELEASEDIR) 302 @echo "To make a release RELEASEDIR must be defined" && false 303.endif 304 305