xref: /freebsd/release/Makefile (revision 0bd47e8362e1eee02d034e0479dd79673ec06bcc)
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}
29*0bd47e83SNathan Whitehorn.if ${TARGET} == ${MACHINE}
30*0bd47e83SNathan WhitehornTARGET_ARCH?=	${MACHINE_ARCH}
318f1f55e9SRuslan Ermilov.else
32*0bd47e83SNathan WhitehornTARGET_ARCH?=	${TARGET}
338f1f55e9SRuslan Ermilov.endif
3412ad0bb1SNathan WhitehornIMAKE=		${MAKE} TARGET_ARCH=${TARGET_ARCH} TARGET=${TARGET}
3512ad0bb1SNathan WhitehornDISTDIR=	${.OBJDIR}/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
5612ad0bb1SNathan Whitehorn.if exists(${.CURDIR}/${TARGET}/mkisoimages.sh)
5712ad0bb1SNathan WhitehornRELEASE_TARGETS+= cdrom
586daa108fSRuslan Ermilov.endif
5912ad0bb1SNathan Whitehorn.if exists(${.CURDIR}/${TARGET}/make-memstick.sh)
6012ad0bb1SNathan WhitehornRELEASE_TARGETS+= memstick
61e738d1eaSJohn Baldwin.endif
62e738d1eaSJohn Baldwin
638eb4e096SRuslan Ermilov.include <bsd.obj.mk>
6412ad0bb1SNathan Whitehorn
6512ad0bb1SNathan Whitehornbase.txz:
6612ad0bb1SNathan Whitehorn	-mkdir ${DISTDIR}
6712ad0bb1SNathan Whitehorn	cd ${WORLDDIR} && ${IMAKE} distributeworld DISTDIR=${DISTDIR}
6812ad0bb1SNathan Whitehorn# Set up mergemaster root database
6912ad0bb1SNathan Whitehorn	sh ${.CURDIR}/scripts/mm-mtree.sh -F \
7012ad0bb1SNathan Whitehorn	    "TARGET_ARCH=${TARGET_ARCH} TARGET=${TARGET}" -D "${DISTDIR}/base"
7112ad0bb1SNathan Whitehorn# Merge handbook, etc. from doc tree into src tree doc distribution
7212ad0bb1SNathan Whitehorn.if !defined(NODOC)
7312ad0bb1SNathan Whitehorn	cd ${DOCDIR} && ${IMAKE} all install \
7412ad0bb1SNathan Whitehorn	    DOCDIR=${DISTDIR}/doc/usr/share/doc 'FORMATS=html html-split txt' \
7512ad0bb1SNathan Whitehorn	    INSTALL_COMPRESSED='' URLS_ABSOLUTE=YES
7612ad0bb1SNathan Whitehorn.endif
7712ad0bb1SNathan Whitehorn	cd ${WORLDDIR} && ${IMAKE} packageworld DISTDIR=${DISTDIR}
7812ad0bb1SNathan Whitehorn	mv ${DISTDIR}/*.txz ${.OBJDIR}
7912ad0bb1SNathan Whitehorn
8012ad0bb1SNathan Whitehornkernel.txz:
8112ad0bb1SNathan Whitehorn	-mkdir ${DISTDIR}
8212ad0bb1SNathan Whitehorn	cd ${WORLDDIR} && ${IMAKE} distributekernel packagekernel DISTDIR=${DISTDIR}
8312ad0bb1SNathan Whitehorn	mv ${DISTDIR}/kernel.txz ${.OBJDIR}
8412ad0bb1SNathan Whitehorn
8512ad0bb1SNathan Whitehornsrc.txz:
8612ad0bb1SNathan Whitehorn	-mkdir -p ${DISTDIR}/usr
8712ad0bb1SNathan Whitehorn	ln -fs ${WORLDDIR} ${DISTDIR}/usr/src
8812ad0bb1SNathan Whitehorn	cd ${DISTDIR} && tar cLvJf ${.OBJDIR}/src.txz --exclude .svn \
8912ad0bb1SNathan Whitehorn	    --exclude CVS usr/src
9012ad0bb1SNathan Whitehorn
9112ad0bb1SNathan Whitehornports.txz:
9212ad0bb1SNathan Whitehorn	-mkdir -p ${DISTDIR}/usr
9312ad0bb1SNathan Whitehorn	ln -fs ${PORTSDIR} ${DISTDIR}/usr/ports
9412ad0bb1SNathan Whitehorn	cd ${DISTDIR} && tar cLvJf ${.OBJDIR}/ports.txz \
9512ad0bb1SNathan Whitehorn	    --exclude usr/ports/distfiles --exclude usr/ports/packages \
9612ad0bb1SNathan Whitehorn	    --exclude 'usr/ports/INDEX*' --exclude work usr/ports
9712ad0bb1SNathan Whitehorn
9812ad0bb1SNathan Whitehornreldoc:
9912ad0bb1SNathan Whitehorn	cd ${.CURDIR}/doc && ${MAKE} all install clean 'FORMATS=html txt' \
10012ad0bb1SNathan Whitehorn	    INSTALL_COMPRESSED='' URLS_ABSOLUTE=YES DOCDIR=${.OBJDIR}/rdoc
10112ad0bb1SNathan Whitehorn	-mkdir ${.OBJDIR}/reldoc
10212ad0bb1SNathan Whitehorn.for i in hardware readme relnotes errata
10312ad0bb1SNathan Whitehorn	ln -f ${.OBJDIR}/rdoc/${RELNOTES_LANG}/${i}/article.txt \
10412ad0bb1SNathan Whitehorn	    ${.OBJDIR}/reldoc/${i:U}.TXT
10512ad0bb1SNathan Whitehorn	ln -f ${.OBJDIR}/rdoc/${RELNOTES_LANG}/${i}/article.html \
10612ad0bb1SNathan Whitehorn	    ${.OBJDIR}/reldoc/${i:U}.HTM
10712ad0bb1SNathan Whitehorn.endfor
10812ad0bb1SNathan Whitehorn	cp ${.OBJDIR}/rdoc/${RELNOTES_LANG}/readme/docbook.css ${.OBJDIR}/reldoc
10912ad0bb1SNathan Whitehorn
11012ad0bb1SNathan Whitehornsystem: packagesystem
11112ad0bb1SNathan Whitehorn# Install system
11212ad0bb1SNathan Whitehorn	-mkdir ${.OBJDIR}/release
11312ad0bb1SNathan Whitehorn	cd ${WORLDDIR} && ${IMAKE} installkernel installworld distribution DESTDIR=${.OBJDIR}/release
11412ad0bb1SNathan Whitehorn	-rm ${.OBJDIR}/release/boot/kernel/*.symbols
11512ad0bb1SNathan Whitehorn# Copy distfiles
11612ad0bb1SNathan Whitehorn	mkdir ${.OBJDIR}/release/usr/freebsd-dist
11712ad0bb1SNathan Whitehorn	cp ${.OBJDIR}/*.txz ${.OBJDIR}/MANIFEST \
11812ad0bb1SNathan Whitehorn	    ${.OBJDIR}/release/usr/freebsd-dist
11912ad0bb1SNathan Whitehorn# Copy documentation, if generated
12012ad0bb1SNathan Whitehorn.if !defined(NODOC)
12112ad0bb1SNathan Whitehorn	cp ${.OBJDIR}/reldoc/* ${.OBJDIR}/release
12212ad0bb1SNathan Whitehorn.endif
12312ad0bb1SNathan Whitehorn# Set up installation environment
12412ad0bb1SNathan Whitehorn	ln -s /tmp/bsdinstall_etc/resolv.conf ${.OBJDIR}/release/etc/resolv.conf
12512ad0bb1SNathan Whitehorn	echo sendmail_enable=\"NONE\" > ${.OBJDIR}/release/etc/rc.conf
12612ad0bb1SNathan Whitehorn	echo hostid_enable=\"NO\" >> ${.OBJDIR}/release/etc/rc.conf
12712ad0bb1SNathan Whitehorn	cp ${.CURDIR}/rc.local ${.OBJDIR}/release/etc
12812ad0bb1SNathan Whitehorn	touch ${.OBJDIR}/${.TARGET}
12912ad0bb1SNathan Whitehorn
13046c413feSNathan Whitehornbootonly: packagesystem
13146c413feSNathan Whitehorn# Install system
13246c413feSNathan Whitehorn	mkdir ${.OBJDIR}/bootonly
13346c413feSNathan Whitehorn	cd ${WORLDDIR} && ${IMAKE} installkernel installworld distribution \
13446c413feSNathan Whitehorn	    DESTDIR=${.OBJDIR}/bootonly WITHOUT_AMD=1 WITHOUT_AT=1 \
13546c413feSNathan Whitehorn	    WITHOUT_BIND_DNSSEC=1 WITHOUT_BIND_ETC=1 WITHOUT_BIND_MTREE=1 \
13646c413feSNathan Whitehorn	    WITHOUT_BIND_NAMED=1 WITHOUT_GAMES=1 WITHOUT_GROFF=1 \
13746c413feSNathan Whitehorn	    WITHOUT_INSTALLLIB=1 WITHOUT_LIB32=1 WITHOUT_MAIL=1 \
13846c413feSNathan Whitehorn	    WITHOUT_NCP=1 WITHOUT_TOOLCHAIN=1 WITHOUT_RESCUE=1 WITHOUT_DICT=1
13946c413feSNathan Whitehorn	-rm ${.OBJDIR}/bootonly/boot/kernel/*.symbols
14046c413feSNathan Whitehorn# Copy manifest only (no distfiles) to get checksums
14146c413feSNathan Whitehorn	mkdir ${.OBJDIR}/bootonly/usr/freebsd-dist
14246c413feSNathan Whitehorn	cp ${.OBJDIR}/MANIFEST ${.OBJDIR}/bootonly/usr/freebsd-dist
14346c413feSNathan Whitehorn# Copy documentation, if generated
14446c413feSNathan Whitehorn.if !defined(NODOC)
14546c413feSNathan Whitehorn	cp ${.OBJDIR}/reldoc/* ${.OBJDIR}/bootonly
14646c413feSNathan Whitehorn.endif
14746c413feSNathan Whitehorn# Set up installation environment
14846c413feSNathan Whitehorn	ln -s /tmp/bsdinstall_etc/resolv.conf ${.OBJDIR}/bootonly/etc/resolv.conf
14946c413feSNathan Whitehorn	echo sendmail_enable=\"NONE\" > ${.OBJDIR}/bootonly/etc/rc.conf
15046c413feSNathan Whitehorn	echo hostid_enable=\"NO\" >> ${.OBJDIR}/bootonly/etc/rc.conf
15146c413feSNathan Whitehorn	cp ${.CURDIR}/rc.local ${.OBJDIR}/bootonly/etc
15246c413feSNathan Whitehorn
15312ad0bb1SNathan Whitehornrelease.iso: system
15412ad0bb1SNathan Whitehorn	sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b FreeBSD_Install ${.OBJDIR}/release.iso ${.OBJDIR}/release
15512ad0bb1SNathan Whitehorn
15646c413feSNathan Whitehornbootonly.iso: bootonly
15746c413feSNathan Whitehorn	sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b FreeBSD_Install ${.OBJDIR}/bootonly.iso ${.OBJDIR}/bootonly
15846c413feSNathan Whitehorn
15912ad0bb1SNathan Whitehornmemstick: system
16012ad0bb1SNathan Whitehorn	sh ${.CURDIR}/${TARGET}/make-memstick.sh ${.OBJDIR}/release ${.OBJDIR}/memstick
16112ad0bb1SNathan Whitehorn
16212ad0bb1SNathan Whitehornpackagesystem: base.txz kernel.txz ${EXTRA_PACKAGES}
16312ad0bb1SNathan Whitehorn	sh ${.CURDIR}/scripts/make-manifest.sh ${.OBJDIR}/*.txz > ${.OBJDIR}/MANIFEST
164299a8b95SNathan Whitehorn	touch ${.TARGET}
16512ad0bb1SNathan Whitehorn
16646c413feSNathan Whitehorncdrom: release.iso bootonly.iso
16712ad0bb1SNathan Whitehornftp: packagesystem
168299a8b95SNathan Whitehorn	rm -rf ftp
169299a8b95SNathan Whitehorn	mkdir ftp
170299a8b95SNathan Whitehorn	cp *.txz MANIFEST ftp
17112ad0bb1SNathan Whitehorn
172*0bd47e83SNathan Whitehornrelease:
173*0bd47e83SNathan Whitehorn	${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} obj
174*0bd47e83SNathan Whitehorn	${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} ${RELEASE_TARGETS}
17512ad0bb1SNathan Whitehorn
17612ad0bb1SNathan Whitehornclean:
17712ad0bb1SNathan Whitehorn	chflags -R noschg ${.OBJDIR}
178299a8b95SNathan Whitehorn	rm -rf dist ftp
17912ad0bb1SNathan Whitehorn	rm -f packagesystem
180299a8b95SNathan Whitehorn	rm -f *.txz MANIFEST
18112ad0bb1SNathan Whitehorn	rm -f system
182299a8b95SNathan Whitehorn	rm -rf release bootonly
183299a8b95SNathan Whitehorn	rm -f release.iso bootonly.iso memstick
184299a8b95SNathan Whitehorn
185299a8b95SNathan Whitehorninstall:
186299a8b95SNathan Whitehorn	-mkdir ${DESTDIR}
187299a8b95SNathan Whitehorn	cp -a *.iso memstick ftp ${DESTDIR}/
18812ad0bb1SNathan Whitehorn
189