197d92980SPeter Wemm# $FreeBSD$ 20202c140SRodney W. Grimes# 312ad0bb1SNathan Whitehorn# Makefile for building releases and release media. 4bd668f6fSPoul-Henning Kamp# 512ad0bb1SNathan Whitehorn# User-driven targets: 612ad0bb1SNathan Whitehorn# cdrom: Builds release CD-ROM media (release.iso) 712ad0bb1SNathan Whitehorn# ftp: Sets up FTP distribution area (ftp) 812ad0bb1SNathan Whitehorn# release: Build all media and FTP distribution area 9bd668f6fSPoul-Henning Kamp# 1012ad0bb1SNathan Whitehorn# Variables affecting the build process: 1112ad0bb1SNathan Whitehorn# WORLDDIR: location of src tree -- must have built world and default kernel 1212ad0bb1SNathan Whitehorn# (by default, the directory above this one) 1312ad0bb1SNathan Whitehorn# PORTSDIR: location of ports tree to distribute (default: /usr/ports) 1412ad0bb1SNathan Whitehorn# DOCDIR: location of doc tree (default: /usr/doc) 1512ad0bb1SNathan Whitehorn# NOPORTS: if set, do not distribute ports tree 1612ad0bb1SNathan Whitehorn# NOSRC: if set, do not distribute source tree 1712ad0bb1SNathan Whitehorn# NODOC: if set, do not generate release documentation 1812ad0bb1SNathan Whitehorn# TARGET/TARGET_ARCH: architecture of built release 19b03ddec9SJohn Baldwin# 20ab0e9cdcSPoul-Henning Kamp 2112ad0bb1SNathan WhitehornWORLDDIR?= ${.CURDIR}/.. 2212ad0bb1SNathan WhitehornPORTSDIR?= /usr/ports 2312ad0bb1SNathan WhitehornDOCDIR?= /usr/doc 2412ad0bb1SNathan WhitehornRELNOTES_LANG?= en_US.ISO8859-1 25fff8eb57SJohn Baldwin 268f1f55e9SRuslan ErmilovTARGET_ARCH?= ${MACHINE_ARCH} 278f1f55e9SRuslan Ermilov.if ${TARGET_ARCH} == ${MACHINE_ARCH} 288f1f55e9SRuslan ErmilovTARGET?= ${MACHINE} 298f1f55e9SRuslan Ermilov.else 308f1f55e9SRuslan ErmilovTARGET?= ${TARGET_ARCH} 318f1f55e9SRuslan Ermilov.endif 3212ad0bb1SNathan WhitehornIMAKE= ${MAKE} TARGET_ARCH=${TARGET_ARCH} TARGET=${TARGET} 3312ad0bb1SNathan WhitehornDISTDIR= ${.OBJDIR}/dist 348f1f55e9SRuslan Ermilov 3512ad0bb1SNathan Whitehorn.if !exists(${DOCDIR}) 3612ad0bb1SNathan WhitehornNODOC= true 3712ad0bb1SNathan Whitehorn.endif 3812ad0bb1SNathan Whitehorn.if !exists(${PORTSDIR}) 3912ad0bb1SNathan WhitehornNOPORTS= true 40dd1a1b3dSJoerg Wunsch.endif 41dd1a1b3dSJoerg Wunsch 4212ad0bb1SNathan WhitehornEXTRA_PACKAGES= 436daa108fSRuslan Ermilov.if !defined(NOPORTS) 4412ad0bb1SNathan WhitehornEXTRA_PACKAGES+= ports.txz 456daa108fSRuslan Ermilov.endif 464731faa3SJordan K. Hubbard.if !defined(NOSRC) 4712ad0bb1SNathan WhitehornEXTRA_PACKAGES+= src.txz 482e3a1557SKen Smith.endif 49a1b193b5SJohn Baldwin.if !defined(NODOC) 5012ad0bb1SNathan WhitehornEXTRA_PACKAGES+= reldoc 51b2200964SJohn Baldwin.endif 52b2200964SJohn Baldwin 5312ad0bb1SNathan WhitehornRELEASE_TARGETS= ftp 5412ad0bb1SNathan Whitehorn.if exists(${.CURDIR}/${TARGET}/mkisoimages.sh) 5512ad0bb1SNathan WhitehornRELEASE_TARGETS+= cdrom 566daa108fSRuslan Ermilov.endif 5712ad0bb1SNathan Whitehorn.if exists(${.CURDIR}/${TARGET}/make-memstick.sh) 5812ad0bb1SNathan WhitehornRELEASE_TARGETS+= memstick 59e738d1eaSJohn Baldwin.endif 60e738d1eaSJohn Baldwin 618eb4e096SRuslan Ermilov.include <bsd.obj.mk> 6212ad0bb1SNathan Whitehorn 6312ad0bb1SNathan Whitehornbase.txz: 6412ad0bb1SNathan Whitehorn -mkdir ${DISTDIR} 6512ad0bb1SNathan Whitehorn cd ${WORLDDIR} && ${IMAKE} distributeworld DISTDIR=${DISTDIR} 6612ad0bb1SNathan Whitehorn# Set up mergemaster root database 6712ad0bb1SNathan Whitehorn sh ${.CURDIR}/scripts/mm-mtree.sh -F \ 6812ad0bb1SNathan Whitehorn "TARGET_ARCH=${TARGET_ARCH} TARGET=${TARGET}" -D "${DISTDIR}/base" 6912ad0bb1SNathan Whitehorn# Merge handbook, etc. from doc tree into src tree doc distribution 7012ad0bb1SNathan Whitehorn.if !defined(NODOC) 7112ad0bb1SNathan Whitehorn cd ${DOCDIR} && ${IMAKE} all install \ 7212ad0bb1SNathan Whitehorn DOCDIR=${DISTDIR}/doc/usr/share/doc 'FORMATS=html html-split txt' \ 7312ad0bb1SNathan Whitehorn INSTALL_COMPRESSED='' URLS_ABSOLUTE=YES 7412ad0bb1SNathan Whitehorn.endif 7512ad0bb1SNathan Whitehorn cd ${WORLDDIR} && ${IMAKE} packageworld DISTDIR=${DISTDIR} 7612ad0bb1SNathan Whitehorn mv ${DISTDIR}/*.txz ${.OBJDIR} 7712ad0bb1SNathan Whitehorn 7812ad0bb1SNathan Whitehornkernel.txz: 7912ad0bb1SNathan Whitehorn -mkdir ${DISTDIR} 8012ad0bb1SNathan Whitehorn cd ${WORLDDIR} && ${IMAKE} distributekernel packagekernel DISTDIR=${DISTDIR} 8112ad0bb1SNathan Whitehorn mv ${DISTDIR}/kernel.txz ${.OBJDIR} 8212ad0bb1SNathan Whitehorn 8312ad0bb1SNathan Whitehornsrc.txz: 8412ad0bb1SNathan Whitehorn -mkdir -p ${DISTDIR}/usr 8512ad0bb1SNathan Whitehorn ln -fs ${WORLDDIR} ${DISTDIR}/usr/src 8612ad0bb1SNathan Whitehorn cd ${DISTDIR} && tar cLvJf ${.OBJDIR}/src.txz --exclude .svn \ 8712ad0bb1SNathan Whitehorn --exclude CVS usr/src 8812ad0bb1SNathan Whitehorn 8912ad0bb1SNathan Whitehornports.txz: 9012ad0bb1SNathan Whitehorn -mkdir -p ${DISTDIR}/usr 9112ad0bb1SNathan Whitehorn ln -fs ${PORTSDIR} ${DISTDIR}/usr/ports 9212ad0bb1SNathan Whitehorn cd ${DISTDIR} && tar cLvJf ${.OBJDIR}/ports.txz \ 9312ad0bb1SNathan Whitehorn --exclude usr/ports/distfiles --exclude usr/ports/packages \ 9412ad0bb1SNathan Whitehorn --exclude 'usr/ports/INDEX*' --exclude work usr/ports 9512ad0bb1SNathan Whitehorn 9612ad0bb1SNathan Whitehornreldoc: 9712ad0bb1SNathan Whitehorn cd ${.CURDIR}/doc && ${MAKE} all install clean 'FORMATS=html txt' \ 9812ad0bb1SNathan Whitehorn INSTALL_COMPRESSED='' URLS_ABSOLUTE=YES DOCDIR=${.OBJDIR}/rdoc 9912ad0bb1SNathan Whitehorn -mkdir ${.OBJDIR}/reldoc 10012ad0bb1SNathan Whitehorn.for i in hardware readme relnotes errata 10112ad0bb1SNathan Whitehorn ln -f ${.OBJDIR}/rdoc/${RELNOTES_LANG}/${i}/article.txt \ 10212ad0bb1SNathan Whitehorn ${.OBJDIR}/reldoc/${i:U}.TXT 10312ad0bb1SNathan Whitehorn ln -f ${.OBJDIR}/rdoc/${RELNOTES_LANG}/${i}/article.html \ 10412ad0bb1SNathan Whitehorn ${.OBJDIR}/reldoc/${i:U}.HTM 10512ad0bb1SNathan Whitehorn.endfor 10612ad0bb1SNathan Whitehorn cp ${.OBJDIR}/rdoc/${RELNOTES_LANG}/readme/docbook.css ${.OBJDIR}/reldoc 10712ad0bb1SNathan Whitehorn 10812ad0bb1SNathan Whitehornsystem: packagesystem 10912ad0bb1SNathan Whitehorn# Install system 11012ad0bb1SNathan Whitehorn -mkdir ${.OBJDIR}/release 11112ad0bb1SNathan Whitehorn cd ${WORLDDIR} && ${IMAKE} installkernel installworld distribution DESTDIR=${.OBJDIR}/release 11212ad0bb1SNathan Whitehorn -rm ${.OBJDIR}/release/boot/kernel/*.symbols 11312ad0bb1SNathan Whitehorn# Copy distfiles 11412ad0bb1SNathan Whitehorn mkdir ${.OBJDIR}/release/usr/freebsd-dist 11512ad0bb1SNathan Whitehorn cp ${.OBJDIR}/*.txz ${.OBJDIR}/MANIFEST \ 11612ad0bb1SNathan Whitehorn ${.OBJDIR}/release/usr/freebsd-dist 11712ad0bb1SNathan Whitehorn# Copy documentation, if generated 11812ad0bb1SNathan Whitehorn.if !defined(NODOC) 11912ad0bb1SNathan Whitehorn cp ${.OBJDIR}/reldoc/* ${.OBJDIR}/release 12012ad0bb1SNathan Whitehorn.endif 12112ad0bb1SNathan Whitehorn# Set up installation environment 12212ad0bb1SNathan Whitehorn ln -s /tmp/bsdinstall_etc/resolv.conf ${.OBJDIR}/release/etc/resolv.conf 12312ad0bb1SNathan Whitehorn echo sendmail_enable=\"NONE\" > ${.OBJDIR}/release/etc/rc.conf 12412ad0bb1SNathan Whitehorn echo hostid_enable=\"NO\" >> ${.OBJDIR}/release/etc/rc.conf 12512ad0bb1SNathan Whitehorn cp ${.CURDIR}/rc.local ${.OBJDIR}/release/etc 12612ad0bb1SNathan Whitehorn touch ${.OBJDIR}/${.TARGET} 12712ad0bb1SNathan Whitehorn 128*46c413feSNathan Whitehornbootonly: packagesystem 129*46c413feSNathan Whitehorn# Install system 130*46c413feSNathan Whitehorn mkdir ${.OBJDIR}/bootonly 131*46c413feSNathan Whitehorn cd ${WORLDDIR} && ${IMAKE} installkernel installworld distribution \ 132*46c413feSNathan Whitehorn DESTDIR=${.OBJDIR}/bootonly WITHOUT_AMD=1 WITHOUT_AT=1 \ 133*46c413feSNathan Whitehorn WITHOUT_BIND_DNSSEC=1 WITHOUT_BIND_ETC=1 WITHOUT_BIND_MTREE=1 \ 134*46c413feSNathan Whitehorn WITHOUT_BIND_NAMED=1 WITHOUT_GAMES=1 WITHOUT_GROFF=1 \ 135*46c413feSNathan Whitehorn WITHOUT_INSTALLLIB=1 WITHOUT_LIB32=1 WITHOUT_MAIL=1 \ 136*46c413feSNathan Whitehorn WITHOUT_NCP=1 WITHOUT_TOOLCHAIN=1 WITHOUT_RESCUE=1 WITHOUT_DICT=1 137*46c413feSNathan Whitehorn -rm ${.OBJDIR}/bootonly/boot/kernel/*.symbols 138*46c413feSNathan Whitehorn# Copy manifest only (no distfiles) to get checksums 139*46c413feSNathan Whitehorn mkdir ${.OBJDIR}/bootonly/usr/freebsd-dist 140*46c413feSNathan Whitehorn cp ${.OBJDIR}/MANIFEST ${.OBJDIR}/bootonly/usr/freebsd-dist 141*46c413feSNathan Whitehorn# Copy documentation, if generated 142*46c413feSNathan Whitehorn.if !defined(NODOC) 143*46c413feSNathan Whitehorn cp ${.OBJDIR}/reldoc/* ${.OBJDIR}/bootonly 144*46c413feSNathan Whitehorn.endif 145*46c413feSNathan Whitehorn# Set up installation environment 146*46c413feSNathan Whitehorn ln -s /tmp/bsdinstall_etc/resolv.conf ${.OBJDIR}/bootonly/etc/resolv.conf 147*46c413feSNathan Whitehorn echo sendmail_enable=\"NONE\" > ${.OBJDIR}/bootonly/etc/rc.conf 148*46c413feSNathan Whitehorn echo hostid_enable=\"NO\" >> ${.OBJDIR}/bootonly/etc/rc.conf 149*46c413feSNathan Whitehorn cp ${.CURDIR}/rc.local ${.OBJDIR}/bootonly/etc 150*46c413feSNathan Whitehorn 15112ad0bb1SNathan Whitehornrelease.iso: system 15212ad0bb1SNathan Whitehorn sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b FreeBSD_Install ${.OBJDIR}/release.iso ${.OBJDIR}/release 15312ad0bb1SNathan Whitehorn 154*46c413feSNathan Whitehornbootonly.iso: bootonly 155*46c413feSNathan Whitehorn sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b FreeBSD_Install ${.OBJDIR}/bootonly.iso ${.OBJDIR}/bootonly 156*46c413feSNathan Whitehorn 15712ad0bb1SNathan Whitehornmemstick: system 15812ad0bb1SNathan Whitehorn sh ${.CURDIR}/${TARGET}/make-memstick.sh ${.OBJDIR}/release ${.OBJDIR}/memstick 15912ad0bb1SNathan Whitehorn 16012ad0bb1SNathan Whitehornpackagesystem: base.txz kernel.txz ${EXTRA_PACKAGES} 16112ad0bb1SNathan Whitehorn sh ${.CURDIR}/scripts/make-manifest.sh ${.OBJDIR}/*.txz > ${.OBJDIR}/MANIFEST 16212ad0bb1SNathan Whitehorn touch ${.OBJDIR}/${.TARGET} 16312ad0bb1SNathan Whitehorn 164*46c413feSNathan Whitehorncdrom: release.iso bootonly.iso 16512ad0bb1SNathan Whitehornftp: packagesystem 16612ad0bb1SNathan Whitehorn rm -rf ${.OBJDIR}/ftp 16712ad0bb1SNathan Whitehorn mkdir ${.OBJDIR}/ftp 16812ad0bb1SNathan Whitehorn cp ${.OBJDIR}/*.txz ${.OBJDIR}/MANIFEST ${.OBJDIR}/ftp 16912ad0bb1SNathan Whitehorn 1703a20439fSNathan Whitehornrelease: obj ${RELEASE_TARGETS} 17112ad0bb1SNathan Whitehorn 17212ad0bb1SNathan Whitehornclean: 17312ad0bb1SNathan Whitehorn chflags -R noschg ${.OBJDIR} 17412ad0bb1SNathan Whitehorn rm -rf ${.OBJDIR}/dist ${.OBJDIR}/ftp 17512ad0bb1SNathan Whitehorn rm -f packagesystem 17612ad0bb1SNathan Whitehorn rm -f ${.OBJDIR}/*.txz ${.OBJDIR}/MANIFEST 17712ad0bb1SNathan Whitehorn rm -f system 17812ad0bb1SNathan Whitehorn rm -rf ${.OBJDIR}/release 17912ad0bb1SNathan Whitehorn rm -f ${.OBJDIR}/release.iso ${.OBJDIR}/memstick 18012ad0bb1SNathan Whitehorn 181