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) 75d27274aSGlen Barber# dvdrom: Builds release DVD-ROM media (dvd1.iso) 83c334738SGlen Barber# memstick: Builds memory stick image (memstick.img) 9a9da1707SGlen Barber# mini-memstick: Builds minimal memory stick image (mini-memstick.img) 1012ad0bb1SNathan Whitehorn# ftp: Sets up FTP distribution area (ftp) 1112ad0bb1SNathan Whitehorn# release: Build all media and FTP distribution area 12299a8b95SNathan Whitehorn# install: Copies all release media into ${DESTDIR} 13bd668f6fSPoul-Henning Kamp# 1412ad0bb1SNathan Whitehorn# Variables affecting the build process: 1512ad0bb1SNathan Whitehorn# WORLDDIR: location of src tree -- must have built world and default kernel 1612ad0bb1SNathan Whitehorn# (by default, the directory above this one) 1712ad0bb1SNathan Whitehorn# PORTSDIR: location of ports tree to distribute (default: /usr/ports) 1812ad0bb1SNathan Whitehorn# DOCDIR: location of doc tree (default: /usr/doc) 199d22cb2eSHiroki Sato# NOPKG: if set, do not distribute third-party packages 2012ad0bb1SNathan Whitehorn# NOPORTS: if set, do not distribute ports tree 2112ad0bb1SNathan Whitehorn# NOSRC: if set, do not distribute source tree 2212ad0bb1SNathan Whitehorn# NODOC: if set, do not generate release documentation 23*f7f650c7SGlen Barber# WITH_DVD: if set, generate dvd1.iso 2412ad0bb1SNathan Whitehorn# TARGET/TARGET_ARCH: architecture of built release 25b03ddec9SJohn Baldwin# 26ab0e9cdcSPoul-Henning Kamp 2712ad0bb1SNathan WhitehornWORLDDIR?= ${.CURDIR}/.. 2812ad0bb1SNathan WhitehornPORTSDIR?= /usr/ports 2912ad0bb1SNathan WhitehornDOCDIR?= /usr/doc 3012ad0bb1SNathan WhitehornRELNOTES_LANG?= en_US.ISO8859-1 31fff8eb57SJohn Baldwin 32464485c8SHiroki Sato.if !defined(TARGET) || empty(TARGET) 33464485c8SHiroki SatoTARGET= ${MACHINE} 34464485c8SHiroki Sato.endif 35464485c8SHiroki Sato.if !defined(TARGET_ARCH) || empty(TARGET_ARCH) 360bd47e83SNathan Whitehorn.if ${TARGET} == ${MACHINE} 37464485c8SHiroki SatoTARGET_ARCH= ${MACHINE_ARCH} 388f1f55e9SRuslan Ermilov.else 39464485c8SHiroki SatoTARGET_ARCH= ${TARGET} 40464485c8SHiroki Sato.endif 418f1f55e9SRuslan Ermilov.endif 4212ad0bb1SNathan WhitehornIMAKE= ${MAKE} TARGET_ARCH=${TARGET_ARCH} TARGET=${TARGET} 43876acefaSHiroki SatoDISTDIR= dist 448f1f55e9SRuslan Ermilov 45de17cbccSHiroki Sato# Define OSRELEASE by using newvars.sh 46de17cbccSHiroki Sato.if !defined(OSRELEASE) || empty(OSRELEASE) 47de17cbccSHiroki Sato.for _V in TYPE BRANCH REVISION 48de17cbccSHiroki Sato${_V}!= eval $$(awk '/^${_V}=/{print}' ${.CURDIR}/../sys/conf/newvers.sh); echo $$${_V} 49de17cbccSHiroki Sato.endfor 50de17cbccSHiroki Sato.for _V in ${TARGET_ARCH} 51de17cbccSHiroki Sato.if !empty(TARGET:M${_V}) 52de17cbccSHiroki SatoOSRELEASE= ${TYPE}-${REVISION}-${BRANCH}-${TARGET} 53de17cbccSHiroki Sato.else 54de17cbccSHiroki SatoOSRELEASE= ${TYPE}-${REVISION}-${BRANCH}-${TARGET}-${TARGET_ARCH} 55de17cbccSHiroki Sato.endif 56de17cbccSHiroki Sato.endfor 57de17cbccSHiroki Sato.endif 58de17cbccSHiroki Sato 5912ad0bb1SNathan Whitehorn.if !exists(${DOCDIR}) 6012ad0bb1SNathan WhitehornNODOC= true 6112ad0bb1SNathan Whitehorn.endif 6212ad0bb1SNathan Whitehorn.if !exists(${PORTSDIR}) 6312ad0bb1SNathan WhitehornNOPORTS= true 64dd1a1b3dSJoerg Wunsch.endif 65dd1a1b3dSJoerg Wunsch 6612ad0bb1SNathan WhitehornEXTRA_PACKAGES= 676daa108fSRuslan Ermilov.if !defined(NOPORTS) 6812ad0bb1SNathan WhitehornEXTRA_PACKAGES+= ports.txz 696daa108fSRuslan Ermilov.endif 704731faa3SJordan K. Hubbard.if !defined(NOSRC) 7112ad0bb1SNathan WhitehornEXTRA_PACKAGES+= src.txz 722e3a1557SKen Smith.endif 73a1b193b5SJohn Baldwin.if !defined(NODOC) 7412ad0bb1SNathan WhitehornEXTRA_PACKAGES+= reldoc 75b2200964SJohn Baldwin.endif 76b2200964SJohn Baldwin 7712ad0bb1SNathan WhitehornRELEASE_TARGETS= ftp 78876acefaSHiroki SatoIMAGES= 7912ad0bb1SNathan Whitehorn.if exists(${.CURDIR}/${TARGET}/mkisoimages.sh) 8012ad0bb1SNathan WhitehornRELEASE_TARGETS+= cdrom 818cec99b6SGlen BarberIMAGES+= disc1.iso bootonly.iso 82*f7f650c7SGlen Barber. if defined(WITH_DVD) 83dc244562SGlen BarberRELEASE_TARGETS+= dvdrom 84dc244562SGlen BarberIMAGES+= dvd1.iso 85dc244562SGlen Barber. endif 866daa108fSRuslan Ermilov.endif 8712ad0bb1SNathan Whitehorn.if exists(${.CURDIR}/${TARGET}/make-memstick.sh) 883c334738SGlen BarberRELEASE_TARGETS+= memstick.img 89a9da1707SGlen BarberRELEASE_TARGETS+= mini-memstick.img 903c334738SGlen BarberIMAGES+= memstick.img 91a9da1707SGlen BarberIMAGES+= mini-memstick.img 92e738d1eaSJohn Baldwin.endif 93e738d1eaSJohn Baldwin 9446b13263SHiroki SatoCLEANFILES= packagesystem *.txz MANIFEST system ${IMAGES} 9546b13263SHiroki SatoCLEANDIRS= dist ftp release bootonly dvd 9646b13263SHiroki Satobeforeclean: 9746b13263SHiroki Sato chflags -R noschg . 988eb4e096SRuslan Ermilov.include <bsd.obj.mk> 9946b13263SHiroki Satoclean: beforeclean 10012ad0bb1SNathan Whitehorn 10112ad0bb1SNathan Whitehornbase.txz: 102876acefaSHiroki Sato mkdir -p ${DISTDIR} 103876acefaSHiroki Sato cd ${WORLDDIR} && ${IMAKE} distributeworld DISTDIR=${.OBJDIR}/${DISTDIR} 10412ad0bb1SNathan Whitehorn# Set up mergemaster root database 105672d7ddbSSean Bruno sh ${.CURDIR}/scripts/mm-mtree.sh -m ${WORLDDIR} -F \ 106876acefaSHiroki Sato "TARGET_ARCH=${TARGET_ARCH} TARGET=${TARGET}" -D "${.OBJDIR}/${DISTDIR}/base" 107bfc3bab8SNathan Whitehorn# Package all components 108876acefaSHiroki Sato cd ${WORLDDIR} && ${IMAKE} packageworld DISTDIR=${.OBJDIR}/${DISTDIR} 109876acefaSHiroki Sato mv ${DISTDIR}/*.txz . 11012ad0bb1SNathan Whitehorn 11112ad0bb1SNathan Whitehornkernel.txz: 112876acefaSHiroki Sato mkdir -p ${DISTDIR} 113876acefaSHiroki Sato cd ${WORLDDIR} && ${IMAKE} distributekernel packagekernel DISTDIR=${.OBJDIR}/${DISTDIR} 114876acefaSHiroki Sato mv ${DISTDIR}/kernel*.txz . 11512ad0bb1SNathan Whitehorn 11612ad0bb1SNathan Whitehornsrc.txz: 117876acefaSHiroki Sato mkdir -p ${DISTDIR}/usr 11812ad0bb1SNathan Whitehorn ln -fs ${WORLDDIR} ${DISTDIR}/usr/src 1199f5907dbSGlen Barber cd ${DISTDIR} && tar cLvJf ${.OBJDIR}/src.txz --exclude .svn --exclude .zfs \ 120c4acc58dSEd Maste --exclude CVS --exclude @ --exclude usr/src/release/dist usr/src 12112ad0bb1SNathan Whitehorn 12212ad0bb1SNathan Whitehornports.txz: 123876acefaSHiroki Sato mkdir -p ${DISTDIR}/usr 12412ad0bb1SNathan Whitehorn ln -fs ${PORTSDIR} ${DISTDIR}/usr/ports 12512ad0bb1SNathan Whitehorn cd ${DISTDIR} && tar cLvJf ${.OBJDIR}/ports.txz \ 1266f4fc344SNathan Whitehorn --exclude CVS --exclude .svn \ 12712ad0bb1SNathan Whitehorn --exclude usr/ports/distfiles --exclude usr/ports/packages \ 12812ad0bb1SNathan Whitehorn --exclude 'usr/ports/INDEX*' --exclude work usr/ports 12912ad0bb1SNathan Whitehorn 13012ad0bb1SNathan Whitehornreldoc: 13112ad0bb1SNathan Whitehorn cd ${.CURDIR}/doc && ${MAKE} all install clean 'FORMATS=html txt' \ 13212ad0bb1SNathan Whitehorn INSTALL_COMPRESSED='' URLS_ABSOLUTE=YES DOCDIR=${.OBJDIR}/rdoc 133876acefaSHiroki Sato mkdir -p reldoc 13412ad0bb1SNathan Whitehorn.for i in hardware readme relnotes errata 13553089271STijl Coosemans ln -f rdoc/${RELNOTES_LANG}/${i}/article.txt reldoc/${i:tu}.TXT 13653089271STijl Coosemans ln -f rdoc/${RELNOTES_LANG}/${i}/article.html reldoc/${i:tu}.HTM 13712ad0bb1SNathan Whitehorn.endfor 138876acefaSHiroki Sato cp rdoc/${RELNOTES_LANG}/readme/docbook.css reldoc 13912ad0bb1SNathan Whitehorn 14012ad0bb1SNathan Whitehornsystem: packagesystem 14112ad0bb1SNathan Whitehorn# Install system 142876acefaSHiroki Sato mkdir -p release 1436e352319SNathan Whitehorn cd ${WORLDDIR} && ${IMAKE} installkernel installworld distribution \ 14458ddb0a6SGlen Barber DESTDIR=${.OBJDIR}/release WITHOUT_RESCUE=1 WITHOUT_KERNEL_SYMBOLS=1 \ 14558ddb0a6SGlen Barber WITHOUT_PROFILE=1 14612ad0bb1SNathan Whitehorn# Copy distfiles 147876acefaSHiroki Sato mkdir -p release/usr/freebsd-dist 148876acefaSHiroki Sato cp *.txz MANIFEST release/usr/freebsd-dist 14912ad0bb1SNathan Whitehorn# Copy documentation, if generated 15012ad0bb1SNathan Whitehorn.if !defined(NODOC) 151876acefaSHiroki Sato cp reldoc/* release 15212ad0bb1SNathan Whitehorn.endif 15312ad0bb1SNathan Whitehorn# Set up installation environment 154de17cbccSHiroki Sato ln -fs /tmp/bsdinstall_etc/resolv.conf release/etc/resolv.conf 155876acefaSHiroki Sato echo sendmail_enable=\"NONE\" > release/etc/rc.conf 156876acefaSHiroki Sato echo hostid_enable=\"NO\" >> release/etc/rc.conf 157876acefaSHiroki Sato cp ${.CURDIR}/rc.local release/etc 158876acefaSHiroki Sato touch ${.TARGET} 15912ad0bb1SNathan Whitehorn 16046c413feSNathan Whitehornbootonly: packagesystem 16146c413feSNathan Whitehorn# Install system 162876acefaSHiroki Sato mkdir -p bootonly 16346c413feSNathan Whitehorn cd ${WORLDDIR} && ${IMAKE} installkernel installworld distribution \ 16446c413feSNathan Whitehorn DESTDIR=${.OBJDIR}/bootonly WITHOUT_AMD=1 WITHOUT_AT=1 \ 16556b72efeSDag-Erling Smørgrav WITHOUT_GAMES=1 WITHOUT_GROFF=1 \ 16646c413feSNathan Whitehorn WITHOUT_INSTALLLIB=1 WITHOUT_LIB32=1 WITHOUT_MAIL=1 \ 16701dae98eSNathan Whitehorn WITHOUT_NCP=1 WITHOUT_TOOLCHAIN=1 WITHOUT_PROFILE=1 \ 16801dae98eSNathan Whitehorn WITHOUT_INSTALLIB=1 WITHOUT_RESCUE=1 WITHOUT_DICT=1 \ 16901dae98eSNathan Whitehorn WITHOUT_KERNEL_SYMBOLS=1 17046c413feSNathan Whitehorn# Copy manifest only (no distfiles) to get checksums 171876acefaSHiroki Sato mkdir -p bootonly/usr/freebsd-dist 172876acefaSHiroki Sato cp MANIFEST bootonly/usr/freebsd-dist 17346c413feSNathan Whitehorn# Copy documentation, if generated 17446c413feSNathan Whitehorn.if !defined(NODOC) 175876acefaSHiroki Sato cp reldoc/* bootonly 17646c413feSNathan Whitehorn.endif 17746c413feSNathan Whitehorn# Set up installation environment 178de17cbccSHiroki Sato ln -fs /tmp/bsdinstall_etc/resolv.conf bootonly/etc/resolv.conf 179876acefaSHiroki Sato echo sendmail_enable=\"NONE\" > bootonly/etc/rc.conf 180876acefaSHiroki Sato echo hostid_enable=\"NO\" >> bootonly/etc/rc.conf 181876acefaSHiroki Sato cp ${.CURDIR}/rc.local bootonly/etc 18246c413feSNathan Whitehorn 183dc244562SGlen Barberdvd: 184dc244562SGlen Barber# Install system 185dc244562SGlen Barber mkdir -p ${.TARGET} 186dc244562SGlen Barber cd ${WORLDDIR} && ${IMAKE} installkernel installworld distribution \ 1872b471d3aSGlen Barber DESTDIR=${.OBJDIR}/${.TARGET} WITHOUT_RESCUE=1 WITHOUT_KERNEL_SYMBOLS=1 188dc244562SGlen Barber# Copy distfiles 189dc244562SGlen Barber mkdir -p ${.TARGET}/usr/freebsd-dist 190dc244562SGlen Barber cp *.txz MANIFEST ${.TARGET}/usr/freebsd-dist 191dc244562SGlen Barber# Copy documentation, if generated 192dc244562SGlen Barber.if !defined(NODOC) 193dc244562SGlen Barber cp reldoc/* ${.TARGET} 194dc244562SGlen Barber.endif 195dc244562SGlen Barber# Set up installation environment 196dc244562SGlen Barber ln -fs /tmp/bsdinstall_etc/resolv.conf ${.TARGET}/etc/resolv.conf 197dc244562SGlen Barber echo sendmail_enable=\"NONE\" > ${.TARGET}/etc/rc.conf 198dc244562SGlen Barber echo hostid_enable=\"NO\" >> ${.TARGET}/etc/rc.conf 199dc244562SGlen Barber cp ${.CURDIR}/rc.local ${.TARGET}/etc 200dc244562SGlen Barber touch ${.TARGET} 201dc244562SGlen Barber 2028cec99b6SGlen Barberrelease.iso: disc1.iso 2038cec99b6SGlen Barberdisc1.iso: system 204876acefaSHiroki Sato sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b FreeBSD_Install ${.TARGET} release 20512ad0bb1SNathan Whitehorn 206dc244562SGlen Barberdvd1.iso: dvd pkg-stage 207dc244562SGlen Barber sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b FreeBSD_Install ${.TARGET} dvd 208dc244562SGlen Barber 20946c413feSNathan Whitehornbootonly.iso: bootonly 210876acefaSHiroki Sato sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b FreeBSD_Install ${.TARGET} bootonly 21146c413feSNathan Whitehorn 212cb95a96bSGlen Barbermemstick: memstick.img 2133c334738SGlen Barbermemstick.img: system 214876acefaSHiroki Sato sh ${.CURDIR}/${TARGET}/make-memstick.sh release ${.TARGET} 21512ad0bb1SNathan Whitehorn 216a9da1707SGlen Barbermini-memstick: mini-memstick.img 217a9da1707SGlen Barbermini-memstick.img: system 218a9da1707SGlen Barber sh ${.CURDIR}/${TARGET}/make-memstick.sh bootonly ${.TARGET} 219a9da1707SGlen Barber 22012ad0bb1SNathan Whitehornpackagesystem: base.txz kernel.txz ${EXTRA_PACKAGES} 221876acefaSHiroki Sato sh ${.CURDIR}/scripts/make-manifest.sh *.txz > MANIFEST 222299a8b95SNathan Whitehorn touch ${.TARGET} 22312ad0bb1SNathan Whitehorn 224dc244562SGlen Barberpkg-stage: 2259d22cb2eSHiroki Sato.if !defined(NOPKG) && exists(${.CURDIR}/${TARGET}/pkg-stage.conf) 226dc244562SGlen Barber sh ${.CURDIR}/scripts/pkg-stage.sh ${.CURDIR}/${TARGET}/pkg-stage.conf \ 227dc244562SGlen Barber ${REVISION} 228dc244562SGlen Barber.endif 229dc244562SGlen Barber 2308cec99b6SGlen Barbercdrom: disc1.iso bootonly.iso 231dc244562SGlen Barberdvdrom: dvd1.iso 23212ad0bb1SNathan Whitehornftp: packagesystem 233299a8b95SNathan Whitehorn rm -rf ftp 234876acefaSHiroki Sato mkdir -p ftp 235299a8b95SNathan Whitehorn cp *.txz MANIFEST ftp 23612ad0bb1SNathan Whitehorn 2370bd47e83SNathan Whitehornrelease: 2380bd47e83SNathan Whitehorn ${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} obj 2390bd47e83SNathan Whitehorn ${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} ${RELEASE_TARGETS} 24012ad0bb1SNathan Whitehorn 241299a8b95SNathan Whitehorninstall: 242876acefaSHiroki Sato.if defined(DESTDIR) && !empty(DESTDIR) 243876acefaSHiroki Sato mkdir -p ${DESTDIR} 244876acefaSHiroki Sato.endif 245de17cbccSHiroki Sato cp -a ftp ${DESTDIR}/ 246de17cbccSHiroki Sato.for I in ${IMAGES} 247de17cbccSHiroki Sato cp -p ${I} ${DESTDIR}/${OSRELEASE}-${I} 248de17cbccSHiroki Sato.endfor 249de17cbccSHiroki Sato cd ${DESTDIR} && sha256 ${OSRELEASE}* > ${DESTDIR}/CHECKSUM.SHA256 250de17cbccSHiroki Sato cd ${DESTDIR} && md5 ${OSRELEASE}* > ${DESTDIR}/CHECKSUM.MD5 251