xref: /freebsd/release/Makefile (revision 5d27274a0641e9e4e23b01d59e3c2944a9ec3703)
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)
7*5d27274aSGlen 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)
1912ad0bb1SNathan Whitehorn#  NOPORTS:  if set, do not distribute ports tree
2012ad0bb1SNathan Whitehorn#  NOSRC:    if set, do not distribute source tree
2112ad0bb1SNathan Whitehorn#  NODOC:    if set, do not generate release documentation
22*5d27274aSGlen Barber#  NODVD:    if set, do not generate dvd1.iso
2312ad0bb1SNathan Whitehorn#  TARGET/TARGET_ARCH: architecture of built release
24b03ddec9SJohn Baldwin#
25ab0e9cdcSPoul-Henning Kamp
2612ad0bb1SNathan WhitehornWORLDDIR?=	${.CURDIR}/..
2712ad0bb1SNathan WhitehornPORTSDIR?=	/usr/ports
2812ad0bb1SNathan WhitehornDOCDIR?=	/usr/doc
2912ad0bb1SNathan WhitehornRELNOTES_LANG?= en_US.ISO8859-1
30fff8eb57SJohn Baldwin
318f1f55e9SRuslan ErmilovTARGET?=	${MACHINE}
320bd47e83SNathan Whitehorn.if ${TARGET} == ${MACHINE}
330bd47e83SNathan WhitehornTARGET_ARCH?=	${MACHINE_ARCH}
348f1f55e9SRuslan Ermilov.else
350bd47e83SNathan WhitehornTARGET_ARCH?=	${TARGET}
368f1f55e9SRuslan Ermilov.endif
3712ad0bb1SNathan WhitehornIMAKE=		${MAKE} TARGET_ARCH=${TARGET_ARCH} TARGET=${TARGET}
38876acefaSHiroki SatoDISTDIR=	dist
398f1f55e9SRuslan Ermilov
40de17cbccSHiroki Sato# Define OSRELEASE by using newvars.sh
41de17cbccSHiroki Sato.if !defined(OSRELEASE) || empty(OSRELEASE)
42de17cbccSHiroki Sato.for _V in TYPE BRANCH REVISION
43de17cbccSHiroki Sato${_V}!=	eval $$(awk '/^${_V}=/{print}' ${.CURDIR}/../sys/conf/newvers.sh); echo $$${_V}
44de17cbccSHiroki Sato.endfor
45de17cbccSHiroki Sato.for _V in ${TARGET_ARCH}
46de17cbccSHiroki Sato.if !empty(TARGET:M${_V})
47de17cbccSHiroki SatoOSRELEASE=	${TYPE}-${REVISION}-${BRANCH}-${TARGET}
48de17cbccSHiroki Sato.else
49de17cbccSHiroki SatoOSRELEASE=	${TYPE}-${REVISION}-${BRANCH}-${TARGET}-${TARGET_ARCH}
50de17cbccSHiroki Sato.endif
51de17cbccSHiroki Sato.endfor
52de17cbccSHiroki Sato.endif
53de17cbccSHiroki Sato
5412ad0bb1SNathan Whitehorn.if !exists(${DOCDIR})
5512ad0bb1SNathan WhitehornNODOC= true
5612ad0bb1SNathan Whitehorn.endif
5712ad0bb1SNathan Whitehorn.if !exists(${PORTSDIR})
5812ad0bb1SNathan WhitehornNOPORTS= true
59dd1a1b3dSJoerg Wunsch.endif
60dd1a1b3dSJoerg Wunsch
6112ad0bb1SNathan WhitehornEXTRA_PACKAGES=
626daa108fSRuslan Ermilov.if !defined(NOPORTS)
6312ad0bb1SNathan WhitehornEXTRA_PACKAGES+= ports.txz
646daa108fSRuslan Ermilov.endif
654731faa3SJordan K. Hubbard.if !defined(NOSRC)
6612ad0bb1SNathan WhitehornEXTRA_PACKAGES+= src.txz
672e3a1557SKen Smith.endif
68a1b193b5SJohn Baldwin.if !defined(NODOC)
6912ad0bb1SNathan WhitehornEXTRA_PACKAGES+= reldoc
70b2200964SJohn Baldwin.endif
71b2200964SJohn Baldwin
7212ad0bb1SNathan WhitehornRELEASE_TARGETS= ftp
73876acefaSHiroki SatoIMAGES=
7412ad0bb1SNathan Whitehorn.if exists(${.CURDIR}/${TARGET}/mkisoimages.sh)
7512ad0bb1SNathan WhitehornRELEASE_TARGETS+= cdrom
768cec99b6SGlen BarberIMAGES+=	disc1.iso bootonly.iso
77dc244562SGlen Barber. if(!defined(NODVD))
78dc244562SGlen BarberRELEASE_TARGETS+= dvdrom
79dc244562SGlen BarberIMAGES+=	dvd1.iso
80dc244562SGlen Barber. endif
816daa108fSRuslan Ermilov.endif
8212ad0bb1SNathan Whitehorn.if exists(${.CURDIR}/${TARGET}/make-memstick.sh)
833c334738SGlen BarberRELEASE_TARGETS+= memstick.img
84a9da1707SGlen BarberRELEASE_TARGETS+= mini-memstick.img
853c334738SGlen BarberIMAGES+=	memstick.img
86a9da1707SGlen BarberIMAGES+=	mini-memstick.img
87e738d1eaSJohn Baldwin.endif
88e738d1eaSJohn Baldwin
898eb4e096SRuslan Ermilov.include <bsd.obj.mk>
9012ad0bb1SNathan Whitehorn
9112ad0bb1SNathan Whitehornbase.txz:
92876acefaSHiroki Sato	mkdir -p ${DISTDIR}
93876acefaSHiroki Sato	cd ${WORLDDIR} && ${IMAKE} distributeworld DISTDIR=${.OBJDIR}/${DISTDIR}
9412ad0bb1SNathan Whitehorn# Set up mergemaster root database
95672d7ddbSSean Bruno	sh ${.CURDIR}/scripts/mm-mtree.sh -m ${WORLDDIR} -F \
96876acefaSHiroki Sato	    "TARGET_ARCH=${TARGET_ARCH} TARGET=${TARGET}" -D "${.OBJDIR}/${DISTDIR}/base"
97bfc3bab8SNathan Whitehorn# Package all components
98876acefaSHiroki Sato	cd ${WORLDDIR} && ${IMAKE} packageworld DISTDIR=${.OBJDIR}/${DISTDIR}
99876acefaSHiroki Sato	mv ${DISTDIR}/*.txz .
10012ad0bb1SNathan Whitehorn
10112ad0bb1SNathan Whitehornkernel.txz:
102876acefaSHiroki Sato	mkdir -p ${DISTDIR}
103876acefaSHiroki Sato	cd ${WORLDDIR} && ${IMAKE} distributekernel packagekernel DISTDIR=${.OBJDIR}/${DISTDIR}
104876acefaSHiroki Sato	mv ${DISTDIR}/kernel*.txz .
10512ad0bb1SNathan Whitehorn
10612ad0bb1SNathan Whitehornsrc.txz:
107876acefaSHiroki Sato	mkdir -p ${DISTDIR}/usr
10812ad0bb1SNathan Whitehorn	ln -fs ${WORLDDIR} ${DISTDIR}/usr/src
1099f5907dbSGlen Barber	cd ${DISTDIR} && tar cLvJf ${.OBJDIR}/src.txz --exclude .svn --exclude .zfs \
110c4acc58dSEd Maste	    --exclude CVS --exclude @ --exclude usr/src/release/dist usr/src
11112ad0bb1SNathan Whitehorn
11212ad0bb1SNathan Whitehornports.txz:
113876acefaSHiroki Sato	mkdir -p ${DISTDIR}/usr
11412ad0bb1SNathan Whitehorn	ln -fs ${PORTSDIR} ${DISTDIR}/usr/ports
11512ad0bb1SNathan Whitehorn	cd ${DISTDIR} && tar cLvJf ${.OBJDIR}/ports.txz \
1166f4fc344SNathan Whitehorn	    --exclude CVS --exclude .svn \
11712ad0bb1SNathan Whitehorn	    --exclude usr/ports/distfiles --exclude usr/ports/packages \
11812ad0bb1SNathan Whitehorn	    --exclude 'usr/ports/INDEX*' --exclude work usr/ports
11912ad0bb1SNathan Whitehorn
12012ad0bb1SNathan Whitehornreldoc:
12112ad0bb1SNathan Whitehorn	cd ${.CURDIR}/doc && ${MAKE} all install clean 'FORMATS=html txt' \
12212ad0bb1SNathan Whitehorn	    INSTALL_COMPRESSED='' URLS_ABSOLUTE=YES DOCDIR=${.OBJDIR}/rdoc
123876acefaSHiroki Sato	mkdir -p reldoc
12412ad0bb1SNathan Whitehorn.for i in hardware readme relnotes errata
12553089271STijl Coosemans	ln -f rdoc/${RELNOTES_LANG}/${i}/article.txt reldoc/${i:tu}.TXT
12653089271STijl Coosemans	ln -f rdoc/${RELNOTES_LANG}/${i}/article.html reldoc/${i:tu}.HTM
12712ad0bb1SNathan Whitehorn.endfor
128876acefaSHiroki Sato	cp rdoc/${RELNOTES_LANG}/readme/docbook.css reldoc
12912ad0bb1SNathan Whitehorn
13012ad0bb1SNathan Whitehornsystem: packagesystem
13112ad0bb1SNathan Whitehorn# Install system
132876acefaSHiroki Sato	mkdir -p release
1336e352319SNathan Whitehorn	cd ${WORLDDIR} && ${IMAKE} installkernel installworld distribution \
13458ddb0a6SGlen Barber		DESTDIR=${.OBJDIR}/release WITHOUT_RESCUE=1 WITHOUT_KERNEL_SYMBOLS=1 \
13558ddb0a6SGlen Barber		WITHOUT_PROFILE=1
13612ad0bb1SNathan Whitehorn# Copy distfiles
137876acefaSHiroki Sato	mkdir -p release/usr/freebsd-dist
138876acefaSHiroki Sato	cp *.txz MANIFEST release/usr/freebsd-dist
13912ad0bb1SNathan Whitehorn# Copy documentation, if generated
14012ad0bb1SNathan Whitehorn.if !defined(NODOC)
141876acefaSHiroki Sato	cp reldoc/* release
14212ad0bb1SNathan Whitehorn.endif
14312ad0bb1SNathan Whitehorn# Set up installation environment
144de17cbccSHiroki Sato	ln -fs /tmp/bsdinstall_etc/resolv.conf release/etc/resolv.conf
145876acefaSHiroki Sato	echo sendmail_enable=\"NONE\" > release/etc/rc.conf
146876acefaSHiroki Sato	echo hostid_enable=\"NO\" >> release/etc/rc.conf
147876acefaSHiroki Sato	cp ${.CURDIR}/rc.local release/etc
148876acefaSHiroki Sato	touch ${.TARGET}
14912ad0bb1SNathan Whitehorn
15046c413feSNathan Whitehornbootonly: packagesystem
15146c413feSNathan Whitehorn# Install system
152876acefaSHiroki Sato	mkdir -p bootonly
15346c413feSNathan Whitehorn	cd ${WORLDDIR} && ${IMAKE} installkernel installworld distribution \
15446c413feSNathan Whitehorn	    DESTDIR=${.OBJDIR}/bootonly WITHOUT_AMD=1 WITHOUT_AT=1 \
15556b72efeSDag-Erling Smørgrav	    WITHOUT_GAMES=1 WITHOUT_GROFF=1 \
15646c413feSNathan Whitehorn	    WITHOUT_INSTALLLIB=1 WITHOUT_LIB32=1 WITHOUT_MAIL=1 \
15701dae98eSNathan Whitehorn	    WITHOUT_NCP=1 WITHOUT_TOOLCHAIN=1 WITHOUT_PROFILE=1 \
15801dae98eSNathan Whitehorn	    WITHOUT_INSTALLIB=1 WITHOUT_RESCUE=1 WITHOUT_DICT=1 \
15901dae98eSNathan Whitehorn	    WITHOUT_KERNEL_SYMBOLS=1
16046c413feSNathan Whitehorn# Copy manifest only (no distfiles) to get checksums
161876acefaSHiroki Sato	mkdir -p bootonly/usr/freebsd-dist
162876acefaSHiroki Sato	cp MANIFEST bootonly/usr/freebsd-dist
16346c413feSNathan Whitehorn# Copy documentation, if generated
16446c413feSNathan Whitehorn.if !defined(NODOC)
165876acefaSHiroki Sato	cp reldoc/* bootonly
16646c413feSNathan Whitehorn.endif
16746c413feSNathan Whitehorn# Set up installation environment
168de17cbccSHiroki Sato	ln -fs /tmp/bsdinstall_etc/resolv.conf bootonly/etc/resolv.conf
169876acefaSHiroki Sato	echo sendmail_enable=\"NONE\" > bootonly/etc/rc.conf
170876acefaSHiroki Sato	echo hostid_enable=\"NO\" >> bootonly/etc/rc.conf
171876acefaSHiroki Sato	cp ${.CURDIR}/rc.local bootonly/etc
17246c413feSNathan Whitehorn
173dc244562SGlen Barberdvd:
174dc244562SGlen Barber# Install system
175dc244562SGlen Barber	mkdir -p ${.TARGET}
176dc244562SGlen Barber	cd ${WORLDDIR} && ${IMAKE} installkernel installworld distribution \
1772b471d3aSGlen Barber		DESTDIR=${.OBJDIR}/${.TARGET} WITHOUT_RESCUE=1 WITHOUT_KERNEL_SYMBOLS=1
178dc244562SGlen Barber# Copy distfiles
179dc244562SGlen Barber	mkdir -p ${.TARGET}/usr/freebsd-dist
180dc244562SGlen Barber	cp *.txz MANIFEST ${.TARGET}/usr/freebsd-dist
181dc244562SGlen Barber# Copy documentation, if generated
182dc244562SGlen Barber.if !defined(NODOC)
183dc244562SGlen Barber	cp reldoc/* ${.TARGET}
184dc244562SGlen Barber.endif
185dc244562SGlen Barber# Set up installation environment
186dc244562SGlen Barber	ln -fs /tmp/bsdinstall_etc/resolv.conf ${.TARGET}/etc/resolv.conf
187dc244562SGlen Barber	echo sendmail_enable=\"NONE\" > ${.TARGET}/etc/rc.conf
188dc244562SGlen Barber	echo hostid_enable=\"NO\" >> ${.TARGET}/etc/rc.conf
189dc244562SGlen Barber	cp ${.CURDIR}/rc.local ${.TARGET}/etc
190dc244562SGlen Barber	touch ${.TARGET}
191dc244562SGlen Barber
1928cec99b6SGlen Barberrelease.iso: disc1.iso
1938cec99b6SGlen Barberdisc1.iso: system
194876acefaSHiroki Sato	sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b FreeBSD_Install ${.TARGET} release
19512ad0bb1SNathan Whitehorn
196dc244562SGlen Barberdvd1.iso: dvd pkg-stage
197dc244562SGlen Barber	sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b FreeBSD_Install ${.TARGET} dvd
198dc244562SGlen Barber
19946c413feSNathan Whitehornbootonly.iso: bootonly
200876acefaSHiroki Sato	sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b FreeBSD_Install ${.TARGET} bootonly
20146c413feSNathan Whitehorn
202cb95a96bSGlen Barbermemstick: memstick.img
2033c334738SGlen Barbermemstick.img: system
204876acefaSHiroki Sato	sh ${.CURDIR}/${TARGET}/make-memstick.sh release ${.TARGET}
20512ad0bb1SNathan Whitehorn
206a9da1707SGlen Barbermini-memstick: mini-memstick.img
207a9da1707SGlen Barbermini-memstick.img: system
208a9da1707SGlen Barber	sh ${.CURDIR}/${TARGET}/make-memstick.sh bootonly ${.TARGET}
209a9da1707SGlen Barber
21012ad0bb1SNathan Whitehornpackagesystem: base.txz kernel.txz ${EXTRA_PACKAGES}
211876acefaSHiroki Sato	sh ${.CURDIR}/scripts/make-manifest.sh *.txz > MANIFEST
212299a8b95SNathan Whitehorn	touch ${.TARGET}
21312ad0bb1SNathan Whitehorn
214dc244562SGlen Barberpkg-stage:
215dc244562SGlen Barber.if(exists(${.CURDIR}/${TARGET}/pkg-stage.conf))
216dc244562SGlen Barber	sh ${.CURDIR}/scripts/pkg-stage.sh ${.CURDIR}/${TARGET}/pkg-stage.conf \
217dc244562SGlen Barber		${REVISION}
218dc244562SGlen Barber.endif
219dc244562SGlen Barber
2208cec99b6SGlen Barbercdrom: disc1.iso bootonly.iso
221dc244562SGlen Barberdvdrom: dvd1.iso
22212ad0bb1SNathan Whitehornftp: packagesystem
223299a8b95SNathan Whitehorn	rm -rf ftp
224876acefaSHiroki Sato	mkdir -p ftp
225299a8b95SNathan Whitehorn	cp *.txz MANIFEST ftp
22612ad0bb1SNathan Whitehorn
2270bd47e83SNathan Whitehornrelease:
2280bd47e83SNathan Whitehorn	${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} obj
2290bd47e83SNathan Whitehorn	${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} ${RELEASE_TARGETS}
23012ad0bb1SNathan Whitehorn
23112ad0bb1SNathan Whitehornclean:
232876acefaSHiroki Sato	chflags -R noschg .
233299a8b95SNathan Whitehorn	rm -rf dist ftp
23412ad0bb1SNathan Whitehorn	rm -f packagesystem
235299a8b95SNathan Whitehorn	rm -f *.txz MANIFEST
23612ad0bb1SNathan Whitehorn	rm -f system
237dc244562SGlen Barber	rm -rf release bootonly dvd
238849861d0SGlen Barber	rm -f ${IMAGES}
239299a8b95SNathan Whitehorn
240299a8b95SNathan Whitehorninstall:
241876acefaSHiroki Sato.if defined(DESTDIR) && !empty(DESTDIR)
242876acefaSHiroki Sato	mkdir -p ${DESTDIR}
243876acefaSHiroki Sato.endif
244de17cbccSHiroki Sato	cp -a ftp ${DESTDIR}/
245de17cbccSHiroki Sato.for I in ${IMAGES}
246de17cbccSHiroki Sato	cp -p ${I} ${DESTDIR}/${OSRELEASE}-${I}
247de17cbccSHiroki Sato.endfor
248de17cbccSHiroki Sato	cd ${DESTDIR} && sha256 ${OSRELEASE}* > ${DESTDIR}/CHECKSUM.SHA256
249de17cbccSHiroki Sato	cd ${DESTDIR} && md5 ${OSRELEASE}* > ${DESTDIR}/CHECKSUM.MD5
250