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) 761741fd7SNathan Whitehorn# memstick: Builds memory stick image (memstick) 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} 35*876acefaSHiroki SatoDISTDIR= dist 368f1f55e9SRuslan Ermilov 3712ad0bb1SNathan Whitehorn.if !exists(${DOCDIR}) 3812ad0bb1SNathan WhitehornNODOC= true 3912ad0bb1SNathan Whitehorn.endif 4012ad0bb1SNathan Whitehorn.if !exists(${PORTSDIR}) 4112ad0bb1SNathan WhitehornNOPORTS= true 42dd1a1b3dSJoerg Wunsch.endif 43dd1a1b3dSJoerg Wunsch 4412ad0bb1SNathan WhitehornEXTRA_PACKAGES= 456daa108fSRuslan Ermilov.if !defined(NOPORTS) 4612ad0bb1SNathan WhitehornEXTRA_PACKAGES+= ports.txz 476daa108fSRuslan Ermilov.endif 484731faa3SJordan K. Hubbard.if !defined(NOSRC) 4912ad0bb1SNathan WhitehornEXTRA_PACKAGES+= src.txz 502e3a1557SKen Smith.endif 51a1b193b5SJohn Baldwin.if !defined(NODOC) 5212ad0bb1SNathan WhitehornEXTRA_PACKAGES+= reldoc 53b2200964SJohn Baldwin.endif 54b2200964SJohn Baldwin 5512ad0bb1SNathan WhitehornRELEASE_TARGETS= ftp 56*876acefaSHiroki SatoIMAGES= 5712ad0bb1SNathan Whitehorn.if exists(${.CURDIR}/${TARGET}/mkisoimages.sh) 5812ad0bb1SNathan WhitehornRELEASE_TARGETS+= cdrom 59*876acefaSHiroki SatoIMAGES+= release.iso bootonly.iso 606daa108fSRuslan Ermilov.endif 6112ad0bb1SNathan Whitehorn.if exists(${.CURDIR}/${TARGET}/make-memstick.sh) 6212ad0bb1SNathan WhitehornRELEASE_TARGETS+= memstick 63*876acefaSHiroki SatoIMAGES+= memstick 64e738d1eaSJohn Baldwin.endif 65e738d1eaSJohn Baldwin 668eb4e096SRuslan Ermilov.include <bsd.obj.mk> 6712ad0bb1SNathan Whitehorn 6812ad0bb1SNathan Whitehornbase.txz: 69*876acefaSHiroki Sato mkdir -p ${DISTDIR} 70*876acefaSHiroki Sato cd ${WORLDDIR} && ${IMAKE} distributeworld DISTDIR=${.OBJDIR}/${DISTDIR} 7112ad0bb1SNathan Whitehorn# Set up mergemaster root database 72672d7ddbSSean Bruno sh ${.CURDIR}/scripts/mm-mtree.sh -m ${WORLDDIR} -F \ 73*876acefaSHiroki Sato "TARGET_ARCH=${TARGET_ARCH} TARGET=${TARGET}" -D "${.OBJDIR}/${DISTDIR}/base" 74bfc3bab8SNathan Whitehorn# Package all components 75*876acefaSHiroki Sato cd ${WORLDDIR} && ${IMAKE} packageworld DISTDIR=${.OBJDIR}/${DISTDIR} 76*876acefaSHiroki Sato mv ${DISTDIR}/*.txz . 7712ad0bb1SNathan Whitehorn 7812ad0bb1SNathan Whitehornkernel.txz: 79*876acefaSHiroki Sato mkdir -p ${DISTDIR} 80*876acefaSHiroki Sato cd ${WORLDDIR} && ${IMAKE} distributekernel packagekernel DISTDIR=${.OBJDIR}/${DISTDIR} 81*876acefaSHiroki Sato mv ${DISTDIR}/kernel*.txz . 8212ad0bb1SNathan Whitehorn 8312ad0bb1SNathan Whitehornsrc.txz: 84*876acefaSHiroki Sato 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: 90*876acefaSHiroki Sato 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 99*876acefaSHiroki Sato mkdir -p reldoc 10012ad0bb1SNathan Whitehorn.for i in hardware readme relnotes errata 101*876acefaSHiroki Sato ln -f rdoc/${RELNOTES_LANG}/${i}/article.txt reldoc/${i:U}.TXT 102*876acefaSHiroki Sato ln -f rdoc/${RELNOTES_LANG}/${i}/article.html reldoc/${i:U}.HTM 10312ad0bb1SNathan Whitehorn.endfor 104*876acefaSHiroki Sato cp rdoc/${RELNOTES_LANG}/readme/docbook.css reldoc 10512ad0bb1SNathan Whitehorn 10612ad0bb1SNathan Whitehornsystem: packagesystem 10712ad0bb1SNathan Whitehorn# Install system 108*876acefaSHiroki Sato mkdir -p release 1096e352319SNathan Whitehorn cd ${WORLDDIR} && ${IMAKE} installkernel installworld distribution \ 11001dae98eSNathan Whitehorn DESTDIR=${.OBJDIR}/release WITHOUT_RESCUE=1 WITHOUT_KERNEL_SYMBOLS=1 11112ad0bb1SNathan Whitehorn# Copy distfiles 112*876acefaSHiroki Sato mkdir -p release/usr/freebsd-dist 113*876acefaSHiroki Sato cp *.txz MANIFEST release/usr/freebsd-dist 11412ad0bb1SNathan Whitehorn# Copy documentation, if generated 11512ad0bb1SNathan Whitehorn.if !defined(NODOC) 116*876acefaSHiroki Sato cp reldoc/* release 11712ad0bb1SNathan Whitehorn.endif 11812ad0bb1SNathan Whitehorn# Set up installation environment 119*876acefaSHiroki Sato ln -s /tmp/bsdinstall_etc/resolv.conf release/etc/resolv.conf 120*876acefaSHiroki Sato echo sendmail_enable=\"NONE\" > release/etc/rc.conf 121*876acefaSHiroki Sato echo hostid_enable=\"NO\" >> release/etc/rc.conf 122*876acefaSHiroki Sato cp ${.CURDIR}/rc.local release/etc 123*876acefaSHiroki Sato touch ${.TARGET} 12412ad0bb1SNathan Whitehorn 12546c413feSNathan Whitehornbootonly: packagesystem 12646c413feSNathan Whitehorn# Install system 127*876acefaSHiroki Sato mkdir -p bootonly 12846c413feSNathan Whitehorn cd ${WORLDDIR} && ${IMAKE} installkernel installworld distribution \ 12946c413feSNathan Whitehorn DESTDIR=${.OBJDIR}/bootonly WITHOUT_AMD=1 WITHOUT_AT=1 \ 13046c413feSNathan Whitehorn WITHOUT_BIND_DNSSEC=1 WITHOUT_BIND_ETC=1 WITHOUT_BIND_MTREE=1 \ 13146c413feSNathan Whitehorn WITHOUT_BIND_NAMED=1 WITHOUT_GAMES=1 WITHOUT_GROFF=1 \ 13246c413feSNathan Whitehorn WITHOUT_INSTALLLIB=1 WITHOUT_LIB32=1 WITHOUT_MAIL=1 \ 13301dae98eSNathan Whitehorn WITHOUT_NCP=1 WITHOUT_TOOLCHAIN=1 WITHOUT_PROFILE=1 \ 13401dae98eSNathan Whitehorn WITHOUT_INSTALLIB=1 WITHOUT_RESCUE=1 WITHOUT_DICT=1 \ 13501dae98eSNathan Whitehorn WITHOUT_KERNEL_SYMBOLS=1 13646c413feSNathan Whitehorn# Copy manifest only (no distfiles) to get checksums 137*876acefaSHiroki Sato mkdir -p bootonly/usr/freebsd-dist 138*876acefaSHiroki Sato cp MANIFEST bootonly/usr/freebsd-dist 13946c413feSNathan Whitehorn# Copy documentation, if generated 14046c413feSNathan Whitehorn.if !defined(NODOC) 141*876acefaSHiroki Sato cp reldoc/* bootonly 14246c413feSNathan Whitehorn.endif 14346c413feSNathan Whitehorn# Set up installation environment 144*876acefaSHiroki Sato ln -s /tmp/bsdinstall_etc/resolv.conf bootonly/etc/resolv.conf 145*876acefaSHiroki Sato echo sendmail_enable=\"NONE\" > bootonly/etc/rc.conf 146*876acefaSHiroki Sato echo hostid_enable=\"NO\" >> bootonly/etc/rc.conf 147*876acefaSHiroki Sato cp ${.CURDIR}/rc.local bootonly/etc 14846c413feSNathan Whitehorn 14912ad0bb1SNathan Whitehornrelease.iso: system 150*876acefaSHiroki Sato sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b FreeBSD_Install ${.TARGET} release 15112ad0bb1SNathan Whitehorn 15246c413feSNathan Whitehornbootonly.iso: bootonly 153*876acefaSHiroki Sato sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b FreeBSD_Install ${.TARGET} bootonly 15446c413feSNathan Whitehorn 15512ad0bb1SNathan Whitehornmemstick: system 156*876acefaSHiroki Sato sh ${.CURDIR}/${TARGET}/make-memstick.sh release ${.TARGET} 15712ad0bb1SNathan Whitehorn 15812ad0bb1SNathan Whitehornpackagesystem: base.txz kernel.txz ${EXTRA_PACKAGES} 159*876acefaSHiroki Sato sh ${.CURDIR}/scripts/make-manifest.sh *.txz > MANIFEST 160299a8b95SNathan Whitehorn touch ${.TARGET} 16112ad0bb1SNathan Whitehorn 16246c413feSNathan Whitehorncdrom: release.iso bootonly.iso 16312ad0bb1SNathan Whitehornftp: packagesystem 164299a8b95SNathan Whitehorn rm -rf ftp 165*876acefaSHiroki Sato mkdir -p ftp 166299a8b95SNathan Whitehorn cp *.txz MANIFEST ftp 16712ad0bb1SNathan Whitehorn 1680bd47e83SNathan Whitehornrelease: 1690bd47e83SNathan Whitehorn ${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} obj 1700bd47e83SNathan Whitehorn ${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} ${RELEASE_TARGETS} 17112ad0bb1SNathan Whitehorn 17212ad0bb1SNathan Whitehornclean: 173*876acefaSHiroki Sato chflags -R noschg . 174299a8b95SNathan Whitehorn rm -rf dist ftp 17512ad0bb1SNathan Whitehorn rm -f packagesystem 176299a8b95SNathan Whitehorn rm -f *.txz MANIFEST 17712ad0bb1SNathan Whitehorn rm -f system 178299a8b95SNathan Whitehorn rm -rf release bootonly 179299a8b95SNathan Whitehorn rm -f release.iso bootonly.iso memstick 180299a8b95SNathan Whitehorn 181299a8b95SNathan Whitehorninstall: 182*876acefaSHiroki Sato.if defined(DESTDIR) && !empty(DESTDIR) 183*876acefaSHiroki Sato mkdir -p ${DESTDIR} 184*876acefaSHiroki Sato.endif 185*876acefaSHiroki Sato cp -a ${IMAGES} ftp ${DESTDIR}/ 186