197d92980SPeter Wemm# $FreeBSD$ 20202c140SRodney W. Grimes# 312ad0bb1SNathan Whitehorn# Makefile for building releases and release media. 4bd668f6fSPoul-Henning Kamp# 512ad0bb1SNathan Whitehorn# User-driven targets: 68cec99b6SGlen Barber# cdrom: Builds release CD-ROM media (disc1.iso) 73c334738SGlen Barber# memstick: Builds memory stick image (memstick.img) 812ad0bb1SNathan Whitehorn# ftp: Sets up FTP distribution area (ftp) 912ad0bb1SNathan Whitehorn# release: Build all media and FTP distribution area 10299a8b95SNathan Whitehorn# install: Copies all release media into ${DESTDIR} 11bd668f6fSPoul-Henning Kamp# 1212ad0bb1SNathan Whitehorn# Variables affecting the build process: 1312ad0bb1SNathan Whitehorn# WORLDDIR: location of src tree -- must have built world and default kernel 1412ad0bb1SNathan Whitehorn# (by default, the directory above this one) 1512ad0bb1SNathan Whitehorn# PORTSDIR: location of ports tree to distribute (default: /usr/ports) 1612ad0bb1SNathan Whitehorn# DOCDIR: location of doc tree (default: /usr/doc) 1712ad0bb1SNathan Whitehorn# NOPORTS: if set, do not distribute ports tree 1812ad0bb1SNathan Whitehorn# NOSRC: if set, do not distribute source tree 1912ad0bb1SNathan Whitehorn# NODOC: if set, do not generate release documentation 2012ad0bb1SNathan Whitehorn# TARGET/TARGET_ARCH: architecture of built release 21b03ddec9SJohn Baldwin# 22ab0e9cdcSPoul-Henning Kamp 2312ad0bb1SNathan WhitehornWORLDDIR?= ${.CURDIR}/.. 2412ad0bb1SNathan WhitehornPORTSDIR?= /usr/ports 2512ad0bb1SNathan WhitehornDOCDIR?= /usr/doc 2612ad0bb1SNathan WhitehornRELNOTES_LANG?= en_US.ISO8859-1 27fff8eb57SJohn Baldwin 288f1f55e9SRuslan ErmilovTARGET?= ${MACHINE} 290bd47e83SNathan Whitehorn.if ${TARGET} == ${MACHINE} 300bd47e83SNathan WhitehornTARGET_ARCH?= ${MACHINE_ARCH} 318f1f55e9SRuslan Ermilov.else 320bd47e83SNathan WhitehornTARGET_ARCH?= ${TARGET} 338f1f55e9SRuslan Ermilov.endif 3412ad0bb1SNathan WhitehornIMAKE= ${MAKE} TARGET_ARCH=${TARGET_ARCH} TARGET=${TARGET} 35876acefaSHiroki SatoDISTDIR= dist 368f1f55e9SRuslan Ermilov 37de17cbccSHiroki Sato# Define OSRELEASE by using newvars.sh 38de17cbccSHiroki Sato.if !defined(OSRELEASE) || empty(OSRELEASE) 39de17cbccSHiroki Sato.for _V in TYPE BRANCH REVISION 40de17cbccSHiroki Sato${_V}!= eval $$(awk '/^${_V}=/{print}' ${.CURDIR}/../sys/conf/newvers.sh); echo $$${_V} 41de17cbccSHiroki Sato.endfor 42de17cbccSHiroki Sato.for _V in ${TARGET_ARCH} 43de17cbccSHiroki Sato.if !empty(TARGET:M${_V}) 44de17cbccSHiroki SatoOSRELEASE= ${TYPE}-${REVISION}-${BRANCH}-${TARGET} 45de17cbccSHiroki Sato.else 46de17cbccSHiroki SatoOSRELEASE= ${TYPE}-${REVISION}-${BRANCH}-${TARGET}-${TARGET_ARCH} 47de17cbccSHiroki Sato.endif 48de17cbccSHiroki Sato.endfor 49de17cbccSHiroki Sato.endif 50de17cbccSHiroki Sato 5112ad0bb1SNathan Whitehorn.if !exists(${DOCDIR}) 5212ad0bb1SNathan WhitehornNODOC= true 5312ad0bb1SNathan Whitehorn.endif 5412ad0bb1SNathan Whitehorn.if !exists(${PORTSDIR}) 5512ad0bb1SNathan WhitehornNOPORTS= true 56dd1a1b3dSJoerg Wunsch.endif 57dd1a1b3dSJoerg Wunsch 5812ad0bb1SNathan WhitehornEXTRA_PACKAGES= 596daa108fSRuslan Ermilov.if !defined(NOPORTS) 6012ad0bb1SNathan WhitehornEXTRA_PACKAGES+= ports.txz 616daa108fSRuslan Ermilov.endif 624731faa3SJordan K. Hubbard.if !defined(NOSRC) 6312ad0bb1SNathan WhitehornEXTRA_PACKAGES+= src.txz 642e3a1557SKen Smith.endif 65a1b193b5SJohn Baldwin.if !defined(NODOC) 6612ad0bb1SNathan WhitehornEXTRA_PACKAGES+= reldoc 67b2200964SJohn Baldwin.endif 68b2200964SJohn Baldwin 6912ad0bb1SNathan WhitehornRELEASE_TARGETS= ftp 70876acefaSHiroki SatoIMAGES= 7112ad0bb1SNathan Whitehorn.if exists(${.CURDIR}/${TARGET}/mkisoimages.sh) 7212ad0bb1SNathan WhitehornRELEASE_TARGETS+= cdrom 738cec99b6SGlen BarberIMAGES+= disc1.iso bootonly.iso 746daa108fSRuslan Ermilov.endif 7512ad0bb1SNathan Whitehorn.if exists(${.CURDIR}/${TARGET}/make-memstick.sh) 763c334738SGlen BarberRELEASE_TARGETS+= memstick.img 773c334738SGlen BarberIMAGES+= memstick.img 78e738d1eaSJohn Baldwin.endif 79e738d1eaSJohn Baldwin 808eb4e096SRuslan Ermilov.include <bsd.obj.mk> 8112ad0bb1SNathan Whitehorn 8212ad0bb1SNathan Whitehornbase.txz: 83876acefaSHiroki Sato mkdir -p ${DISTDIR} 84876acefaSHiroki Sato cd ${WORLDDIR} && ${IMAKE} distributeworld DISTDIR=${.OBJDIR}/${DISTDIR} 8512ad0bb1SNathan Whitehorn# Set up mergemaster root database 86672d7ddbSSean Bruno sh ${.CURDIR}/scripts/mm-mtree.sh -m ${WORLDDIR} -F \ 87876acefaSHiroki Sato "TARGET_ARCH=${TARGET_ARCH} TARGET=${TARGET}" -D "${.OBJDIR}/${DISTDIR}/base" 88bfc3bab8SNathan Whitehorn# Package all components 89876acefaSHiroki Sato cd ${WORLDDIR} && ${IMAKE} packageworld DISTDIR=${.OBJDIR}/${DISTDIR} 90876acefaSHiroki Sato mv ${DISTDIR}/*.txz . 9112ad0bb1SNathan Whitehorn 9212ad0bb1SNathan Whitehornkernel.txz: 93876acefaSHiroki Sato mkdir -p ${DISTDIR} 94876acefaSHiroki Sato cd ${WORLDDIR} && ${IMAKE} distributekernel packagekernel DISTDIR=${.OBJDIR}/${DISTDIR} 95876acefaSHiroki Sato mv ${DISTDIR}/kernel*.txz . 9612ad0bb1SNathan Whitehorn 9712ad0bb1SNathan Whitehornsrc.txz: 98876acefaSHiroki Sato mkdir -p ${DISTDIR}/usr 9912ad0bb1SNathan Whitehorn ln -fs ${WORLDDIR} ${DISTDIR}/usr/src 1009f5907dbSGlen Barber cd ${DISTDIR} && tar cLvJf ${.OBJDIR}/src.txz --exclude .svn --exclude .zfs \ 101c4acc58dSEd Maste --exclude CVS --exclude @ --exclude usr/src/release/dist usr/src 10212ad0bb1SNathan Whitehorn 10312ad0bb1SNathan Whitehornports.txz: 104876acefaSHiroki Sato mkdir -p ${DISTDIR}/usr 10512ad0bb1SNathan Whitehorn ln -fs ${PORTSDIR} ${DISTDIR}/usr/ports 10612ad0bb1SNathan Whitehorn cd ${DISTDIR} && tar cLvJf ${.OBJDIR}/ports.txz \ 1076f4fc344SNathan Whitehorn --exclude CVS --exclude .svn \ 10812ad0bb1SNathan Whitehorn --exclude usr/ports/distfiles --exclude usr/ports/packages \ 10912ad0bb1SNathan Whitehorn --exclude 'usr/ports/INDEX*' --exclude work usr/ports 11012ad0bb1SNathan Whitehorn 11112ad0bb1SNathan Whitehornreldoc: 11212ad0bb1SNathan Whitehorn cd ${.CURDIR}/doc && ${MAKE} all install clean 'FORMATS=html txt' \ 11312ad0bb1SNathan Whitehorn INSTALL_COMPRESSED='' URLS_ABSOLUTE=YES DOCDIR=${.OBJDIR}/rdoc 114876acefaSHiroki Sato mkdir -p reldoc 11512ad0bb1SNathan Whitehorn.for i in hardware readme relnotes errata 11653089271STijl Coosemans ln -f rdoc/${RELNOTES_LANG}/${i}/article.txt reldoc/${i:tu}.TXT 11753089271STijl Coosemans ln -f rdoc/${RELNOTES_LANG}/${i}/article.html reldoc/${i:tu}.HTM 11812ad0bb1SNathan Whitehorn.endfor 119876acefaSHiroki Sato cp rdoc/${RELNOTES_LANG}/readme/docbook.css reldoc 12012ad0bb1SNathan Whitehorn 12112ad0bb1SNathan Whitehornsystem: packagesystem 12212ad0bb1SNathan Whitehorn# Install system 123876acefaSHiroki Sato mkdir -p release 1246e352319SNathan Whitehorn cd ${WORLDDIR} && ${IMAKE} installkernel installworld distribution \ 125*58ddb0a6SGlen Barber DESTDIR=${.OBJDIR}/release WITHOUT_RESCUE=1 WITHOUT_KERNEL_SYMBOLS=1 \ 126*58ddb0a6SGlen Barber WITHOUT_PROFILE=1 12712ad0bb1SNathan Whitehorn# Copy distfiles 128876acefaSHiroki Sato mkdir -p release/usr/freebsd-dist 129876acefaSHiroki Sato cp *.txz MANIFEST release/usr/freebsd-dist 13012ad0bb1SNathan Whitehorn# Copy documentation, if generated 13112ad0bb1SNathan Whitehorn.if !defined(NODOC) 132876acefaSHiroki Sato cp reldoc/* release 13312ad0bb1SNathan Whitehorn.endif 13412ad0bb1SNathan Whitehorn# Set up installation environment 135de17cbccSHiroki Sato ln -fs /tmp/bsdinstall_etc/resolv.conf release/etc/resolv.conf 136876acefaSHiroki Sato echo sendmail_enable=\"NONE\" > release/etc/rc.conf 137876acefaSHiroki Sato echo hostid_enable=\"NO\" >> release/etc/rc.conf 138876acefaSHiroki Sato cp ${.CURDIR}/rc.local release/etc 139876acefaSHiroki Sato touch ${.TARGET} 14012ad0bb1SNathan Whitehorn 14146c413feSNathan Whitehornbootonly: packagesystem 14246c413feSNathan Whitehorn# Install system 143876acefaSHiroki Sato mkdir -p bootonly 14446c413feSNathan Whitehorn cd ${WORLDDIR} && ${IMAKE} installkernel installworld distribution \ 14546c413feSNathan Whitehorn DESTDIR=${.OBJDIR}/bootonly WITHOUT_AMD=1 WITHOUT_AT=1 \ 14656b72efeSDag-Erling Smørgrav WITHOUT_GAMES=1 WITHOUT_GROFF=1 \ 14746c413feSNathan Whitehorn WITHOUT_INSTALLLIB=1 WITHOUT_LIB32=1 WITHOUT_MAIL=1 \ 14801dae98eSNathan Whitehorn WITHOUT_NCP=1 WITHOUT_TOOLCHAIN=1 WITHOUT_PROFILE=1 \ 14901dae98eSNathan Whitehorn WITHOUT_INSTALLIB=1 WITHOUT_RESCUE=1 WITHOUT_DICT=1 \ 15001dae98eSNathan Whitehorn WITHOUT_KERNEL_SYMBOLS=1 15146c413feSNathan Whitehorn# Copy manifest only (no distfiles) to get checksums 152876acefaSHiroki Sato mkdir -p bootonly/usr/freebsd-dist 153876acefaSHiroki Sato cp MANIFEST bootonly/usr/freebsd-dist 15446c413feSNathan Whitehorn# Copy documentation, if generated 15546c413feSNathan Whitehorn.if !defined(NODOC) 156876acefaSHiroki Sato cp reldoc/* bootonly 15746c413feSNathan Whitehorn.endif 15846c413feSNathan Whitehorn# Set up installation environment 159de17cbccSHiroki Sato ln -fs /tmp/bsdinstall_etc/resolv.conf bootonly/etc/resolv.conf 160876acefaSHiroki Sato echo sendmail_enable=\"NONE\" > bootonly/etc/rc.conf 161876acefaSHiroki Sato echo hostid_enable=\"NO\" >> bootonly/etc/rc.conf 162876acefaSHiroki Sato cp ${.CURDIR}/rc.local bootonly/etc 16346c413feSNathan Whitehorn 1648cec99b6SGlen Barberrelease.iso: disc1.iso 1658cec99b6SGlen Barberdisc1.iso: system 166876acefaSHiroki Sato sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b FreeBSD_Install ${.TARGET} release 16712ad0bb1SNathan Whitehorn 16846c413feSNathan Whitehornbootonly.iso: bootonly 169876acefaSHiroki Sato sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b FreeBSD_Install ${.TARGET} bootonly 17046c413feSNathan Whitehorn 1713c334738SGlen Barbermemstick: memstick.img 1723c334738SGlen Barbermemstick.img: system 173876acefaSHiroki Sato sh ${.CURDIR}/${TARGET}/make-memstick.sh release ${.TARGET} 17412ad0bb1SNathan Whitehorn 17512ad0bb1SNathan Whitehornpackagesystem: base.txz kernel.txz ${EXTRA_PACKAGES} 176876acefaSHiroki Sato sh ${.CURDIR}/scripts/make-manifest.sh *.txz > MANIFEST 177299a8b95SNathan Whitehorn touch ${.TARGET} 17812ad0bb1SNathan Whitehorn 1798cec99b6SGlen Barbercdrom: disc1.iso bootonly.iso 18012ad0bb1SNathan Whitehornftp: packagesystem 181299a8b95SNathan Whitehorn rm -rf ftp 182876acefaSHiroki Sato mkdir -p ftp 183299a8b95SNathan Whitehorn cp *.txz MANIFEST ftp 18412ad0bb1SNathan Whitehorn 1850bd47e83SNathan Whitehornrelease: 1860bd47e83SNathan Whitehorn ${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} obj 1870bd47e83SNathan Whitehorn ${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} ${RELEASE_TARGETS} 18812ad0bb1SNathan Whitehorn 18912ad0bb1SNathan Whitehornclean: 190876acefaSHiroki Sato chflags -R noschg . 191299a8b95SNathan Whitehorn rm -rf dist ftp 19212ad0bb1SNathan Whitehorn rm -f packagesystem 193299a8b95SNathan Whitehorn rm -f *.txz MANIFEST 19412ad0bb1SNathan Whitehorn rm -f system 195299a8b95SNathan Whitehorn rm -rf release bootonly 1968cec99b6SGlen Barber rm -f disc1.iso bootonly.iso memstick.img 197299a8b95SNathan Whitehorn 198299a8b95SNathan Whitehorninstall: 199876acefaSHiroki Sato.if defined(DESTDIR) && !empty(DESTDIR) 200876acefaSHiroki Sato mkdir -p ${DESTDIR} 201876acefaSHiroki Sato.endif 202de17cbccSHiroki Sato cp -a ftp ${DESTDIR}/ 203de17cbccSHiroki Sato.for I in ${IMAGES} 204de17cbccSHiroki Sato cp -p ${I} ${DESTDIR}/${OSRELEASE}-${I} 205de17cbccSHiroki Sato.endfor 206de17cbccSHiroki Sato cd ${DESTDIR} && sha256 ${OSRELEASE}* > ${DESTDIR}/CHECKSUM.SHA256 207de17cbccSHiroki Sato cd ${DESTDIR} && md5 ${OSRELEASE}* > ${DESTDIR}/CHECKSUM.MD5 208