xref: /freebsd/release/Makefile (revision 23659c9d9d9f4e160d97e0b298c278880b5e48c2)
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
23f7f650c7SGlen 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
82d8824524SGlen Barber. if defined(WITH_DVD) && !empty(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"
107e9120a25SGlen Barber	etcupdate extract -B -M "TARGET_ARCH=${TARGET_ARCH} TARGET=${TARGET}" \
108d6d73d47SJohn Hay	    -s ${WORLDDIR} -d "${.OBJDIR}/${DISTDIR}/base/var/db/etcupdate"
109bfc3bab8SNathan Whitehorn# Package all components
110876acefaSHiroki Sato	cd ${WORLDDIR} && ${IMAKE} packageworld DISTDIR=${.OBJDIR}/${DISTDIR}
111876acefaSHiroki Sato	mv ${DISTDIR}/*.txz .
11212ad0bb1SNathan Whitehorn
11312ad0bb1SNathan Whitehornkernel.txz:
114876acefaSHiroki Sato	mkdir -p ${DISTDIR}
115876acefaSHiroki Sato	cd ${WORLDDIR} && ${IMAKE} distributekernel packagekernel DISTDIR=${.OBJDIR}/${DISTDIR}
116876acefaSHiroki Sato	mv ${DISTDIR}/kernel*.txz .
11712ad0bb1SNathan Whitehorn
11812ad0bb1SNathan Whitehornsrc.txz:
119876acefaSHiroki Sato	mkdir -p ${DISTDIR}/usr
12012ad0bb1SNathan Whitehorn	ln -fs ${WORLDDIR} ${DISTDIR}/usr/src
1219f5907dbSGlen Barber	cd ${DISTDIR} && tar cLvJf ${.OBJDIR}/src.txz --exclude .svn --exclude .zfs \
122*23659c9dSGlen Barber	    --exclude .git --exclude @ --exclude usr/src/release/dist usr/src
12312ad0bb1SNathan Whitehorn
12412ad0bb1SNathan Whitehornports.txz:
125876acefaSHiroki Sato	mkdir -p ${DISTDIR}/usr
12612ad0bb1SNathan Whitehorn	ln -fs ${PORTSDIR} ${DISTDIR}/usr/ports
12712ad0bb1SNathan Whitehorn	cd ${DISTDIR} && tar cLvJf ${.OBJDIR}/ports.txz \
128*23659c9dSGlen Barber	    --exclude .git --exclude .svn \
12912ad0bb1SNathan Whitehorn	    --exclude usr/ports/distfiles --exclude usr/ports/packages \
13012ad0bb1SNathan Whitehorn	    --exclude 'usr/ports/INDEX*' --exclude work usr/ports
13112ad0bb1SNathan Whitehorn
13212ad0bb1SNathan Whitehornreldoc:
13312ad0bb1SNathan Whitehorn	cd ${.CURDIR}/doc && ${MAKE} all install clean 'FORMATS=html txt' \
13412ad0bb1SNathan Whitehorn	    INSTALL_COMPRESSED='' URLS_ABSOLUTE=YES DOCDIR=${.OBJDIR}/rdoc
135876acefaSHiroki Sato	mkdir -p reldoc
13612ad0bb1SNathan Whitehorn.for i in hardware readme relnotes errata
13753089271STijl Coosemans	ln -f rdoc/${RELNOTES_LANG}/${i}/article.txt reldoc/${i:tu}.TXT
13853089271STijl Coosemans	ln -f rdoc/${RELNOTES_LANG}/${i}/article.html reldoc/${i:tu}.HTM
13912ad0bb1SNathan Whitehorn.endfor
140876acefaSHiroki Sato	cp rdoc/${RELNOTES_LANG}/readme/docbook.css reldoc
14112ad0bb1SNathan Whitehorn
14212ad0bb1SNathan Whitehornsystem: packagesystem
14312ad0bb1SNathan Whitehorn# Install system
144876acefaSHiroki Sato	mkdir -p release
1456e352319SNathan Whitehorn	cd ${WORLDDIR} && ${IMAKE} installkernel installworld distribution \
14658ddb0a6SGlen Barber		DESTDIR=${.OBJDIR}/release WITHOUT_RESCUE=1 WITHOUT_KERNEL_SYMBOLS=1 \
147b1e3e965SGlen Barber		WITHOUT_PROFILE=1 WITHOUT_SENDMAIL=1 WITHOUT_ATF=1 WITHOUT_LIB32=1
14812ad0bb1SNathan Whitehorn# Copy distfiles
149876acefaSHiroki Sato	mkdir -p release/usr/freebsd-dist
150876acefaSHiroki Sato	cp *.txz MANIFEST release/usr/freebsd-dist
15112ad0bb1SNathan Whitehorn# Copy documentation, if generated
15212ad0bb1SNathan Whitehorn.if !defined(NODOC)
153876acefaSHiroki Sato	cp reldoc/* release
15412ad0bb1SNathan Whitehorn.endif
15512ad0bb1SNathan Whitehorn# Set up installation environment
156de17cbccSHiroki Sato	ln -fs /tmp/bsdinstall_etc/resolv.conf release/etc/resolv.conf
157876acefaSHiroki Sato	echo sendmail_enable=\"NONE\" > release/etc/rc.conf
158876acefaSHiroki Sato	echo hostid_enable=\"NO\" >> release/etc/rc.conf
159876acefaSHiroki Sato	cp ${.CURDIR}/rc.local release/etc
160876acefaSHiroki Sato	touch ${.TARGET}
16112ad0bb1SNathan Whitehorn
16246c413feSNathan Whitehornbootonly: packagesystem
16346c413feSNathan Whitehorn# Install system
164876acefaSHiroki Sato	mkdir -p bootonly
16546c413feSNathan Whitehorn	cd ${WORLDDIR} && ${IMAKE} installkernel installworld distribution \
16646c413feSNathan Whitehorn	    DESTDIR=${.OBJDIR}/bootonly WITHOUT_AMD=1 WITHOUT_AT=1 \
16756b72efeSDag-Erling Smørgrav	    WITHOUT_GAMES=1 WITHOUT_GROFF=1 \
16846c413feSNathan Whitehorn	    WITHOUT_INSTALLLIB=1 WITHOUT_LIB32=1 WITHOUT_MAIL=1 \
16901dae98eSNathan Whitehorn	    WITHOUT_NCP=1 WITHOUT_TOOLCHAIN=1 WITHOUT_PROFILE=1 \
17001dae98eSNathan Whitehorn	    WITHOUT_INSTALLIB=1 WITHOUT_RESCUE=1 WITHOUT_DICT=1 \
17101dae98eSNathan Whitehorn	    WITHOUT_KERNEL_SYMBOLS=1
17246c413feSNathan Whitehorn# Copy manifest only (no distfiles) to get checksums
173876acefaSHiroki Sato	mkdir -p bootonly/usr/freebsd-dist
174876acefaSHiroki Sato	cp MANIFEST bootonly/usr/freebsd-dist
17546c413feSNathan Whitehorn# Copy documentation, if generated
17646c413feSNathan Whitehorn.if !defined(NODOC)
177876acefaSHiroki Sato	cp reldoc/* bootonly
17846c413feSNathan Whitehorn.endif
17946c413feSNathan Whitehorn# Set up installation environment
180de17cbccSHiroki Sato	ln -fs /tmp/bsdinstall_etc/resolv.conf bootonly/etc/resolv.conf
181876acefaSHiroki Sato	echo sendmail_enable=\"NONE\" > bootonly/etc/rc.conf
182876acefaSHiroki Sato	echo hostid_enable=\"NO\" >> bootonly/etc/rc.conf
183876acefaSHiroki Sato	cp ${.CURDIR}/rc.local bootonly/etc
18446c413feSNathan Whitehorn
185dc244562SGlen Barberdvd:
186dc244562SGlen Barber# Install system
187dc244562SGlen Barber	mkdir -p ${.TARGET}
188dc244562SGlen Barber	cd ${WORLDDIR} && ${IMAKE} installkernel installworld distribution \
1892b471d3aSGlen Barber		DESTDIR=${.OBJDIR}/${.TARGET} WITHOUT_RESCUE=1 WITHOUT_KERNEL_SYMBOLS=1
190dc244562SGlen Barber# Copy distfiles
191dc244562SGlen Barber	mkdir -p ${.TARGET}/usr/freebsd-dist
192dc244562SGlen Barber	cp *.txz MANIFEST ${.TARGET}/usr/freebsd-dist
193dc244562SGlen Barber# Copy documentation, if generated
194dc244562SGlen Barber.if !defined(NODOC)
195dc244562SGlen Barber	cp reldoc/* ${.TARGET}
196dc244562SGlen Barber.endif
197dc244562SGlen Barber# Set up installation environment
198dc244562SGlen Barber	ln -fs /tmp/bsdinstall_etc/resolv.conf ${.TARGET}/etc/resolv.conf
199dc244562SGlen Barber	echo sendmail_enable=\"NONE\" > ${.TARGET}/etc/rc.conf
200dc244562SGlen Barber	echo hostid_enable=\"NO\" >> ${.TARGET}/etc/rc.conf
201dc244562SGlen Barber	cp ${.CURDIR}/rc.local ${.TARGET}/etc
202dc244562SGlen Barber	touch ${.TARGET}
203dc244562SGlen Barber
2048cec99b6SGlen Barberrelease.iso: disc1.iso
2058cec99b6SGlen Barberdisc1.iso: system
206876acefaSHiroki Sato	sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b FreeBSD_Install ${.TARGET} release
20712ad0bb1SNathan Whitehorn
208dc244562SGlen Barberdvd1.iso: dvd pkg-stage
209dc244562SGlen Barber	sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b FreeBSD_Install ${.TARGET} dvd
210dc244562SGlen Barber
21146c413feSNathan Whitehornbootonly.iso: bootonly
212876acefaSHiroki Sato	sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b FreeBSD_Install ${.TARGET} bootonly
21346c413feSNathan Whitehorn
214cb95a96bSGlen Barbermemstick: memstick.img
2153c334738SGlen Barbermemstick.img: system
216876acefaSHiroki Sato	sh ${.CURDIR}/${TARGET}/make-memstick.sh release ${.TARGET}
21712ad0bb1SNathan Whitehorn
218a9da1707SGlen Barbermini-memstick: mini-memstick.img
219a9da1707SGlen Barbermini-memstick.img: system
220a9da1707SGlen Barber	sh ${.CURDIR}/${TARGET}/make-memstick.sh bootonly ${.TARGET}
221a9da1707SGlen Barber
22212ad0bb1SNathan Whitehornpackagesystem: base.txz kernel.txz ${EXTRA_PACKAGES}
223876acefaSHiroki Sato	sh ${.CURDIR}/scripts/make-manifest.sh *.txz > MANIFEST
224299a8b95SNathan Whitehorn	touch ${.TARGET}
22512ad0bb1SNathan Whitehorn
226dc244562SGlen Barberpkg-stage:
2276f50c4eaSGlen Barber.if !defined(NOPKG)
2286f50c4eaSGlen Barber	env REPOS_DIR=${.CURDIR}/pkg_repos/ \
2296f50c4eaSGlen Barber		sh ${.CURDIR}/scripts/pkg-stage.sh
2300d0e89b7SGlen Barber	mkdir -p ${.OBJDIR}/dvd/packages/repos/
2310d0e89b7SGlen Barber	cp ${.CURDIR}/scripts/FreeBSD_install_cdrom.conf \
2320d0e89b7SGlen Barber		${.OBJDIR}/dvd/packages/repos/
233dc244562SGlen Barber.endif
2340d0e89b7SGlen Barber	touch ${.TARGET}
235dc244562SGlen Barber
2368cec99b6SGlen Barbercdrom: disc1.iso bootonly.iso
237dc244562SGlen Barberdvdrom: dvd1.iso
23812ad0bb1SNathan Whitehornftp: packagesystem
239299a8b95SNathan Whitehorn	rm -rf ftp
240876acefaSHiroki Sato	mkdir -p ftp
241299a8b95SNathan Whitehorn	cp *.txz MANIFEST ftp
24212ad0bb1SNathan Whitehorn
2430bd47e83SNathan Whitehornrelease:
2440bd47e83SNathan Whitehorn	${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} obj
2450bd47e83SNathan Whitehorn	${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} ${RELEASE_TARGETS}
24612ad0bb1SNathan Whitehorn
247299a8b95SNathan Whitehorninstall:
248876acefaSHiroki Sato.if defined(DESTDIR) && !empty(DESTDIR)
249876acefaSHiroki Sato	mkdir -p ${DESTDIR}
250876acefaSHiroki Sato.endif
251de17cbccSHiroki Sato	cp -a ftp ${DESTDIR}/
252de17cbccSHiroki Sato.for I in ${IMAGES}
253de17cbccSHiroki Sato	cp -p ${I} ${DESTDIR}/${OSRELEASE}-${I}
254de17cbccSHiroki Sato.endfor
255de17cbccSHiroki Sato	cd ${DESTDIR} && sha256 ${OSRELEASE}* > ${DESTDIR}/CHECKSUM.SHA256
256de17cbccSHiroki Sato	cd ${DESTDIR} && md5 ${OSRELEASE}* > ${DESTDIR}/CHECKSUM.MD5
257