xref: /freebsd/release/Makefile (revision 849861d03f87c0cb6a4e9d0319b667b6ad12244c)
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)
73c334738SGlen Barber#  memstick: Builds memory stick image (memstick.img)
8a9da1707SGlen Barber#  mini-memstick: Builds minimal memory stick image (mini-memstick.img)
912ad0bb1SNathan Whitehorn#  ftp: Sets up FTP distribution area (ftp)
1012ad0bb1SNathan Whitehorn#  release: Build all media and FTP distribution area
11299a8b95SNathan Whitehorn#  install: Copies all release media into ${DESTDIR}
12bd668f6fSPoul-Henning Kamp#
1312ad0bb1SNathan Whitehorn# Variables affecting the build process:
1412ad0bb1SNathan Whitehorn#  WORLDDIR: location of src tree -- must have built world and default kernel
1512ad0bb1SNathan Whitehorn#            (by default, the directory above this one)
1612ad0bb1SNathan Whitehorn#  PORTSDIR: location of ports tree to distribute (default: /usr/ports)
1712ad0bb1SNathan Whitehorn#  DOCDIR:   location of doc tree (default: /usr/doc)
1812ad0bb1SNathan Whitehorn#  NOPORTS:  if set, do not distribute ports tree
1912ad0bb1SNathan Whitehorn#  NOSRC:    if set, do not distribute source tree
2012ad0bb1SNathan Whitehorn#  NODOC:    if set, do not generate release documentation
2112ad0bb1SNathan Whitehorn#  TARGET/TARGET_ARCH: architecture of built release
22b03ddec9SJohn Baldwin#
23ab0e9cdcSPoul-Henning Kamp
2412ad0bb1SNathan WhitehornWORLDDIR?=	${.CURDIR}/..
2512ad0bb1SNathan WhitehornPORTSDIR?=	/usr/ports
2612ad0bb1SNathan WhitehornDOCDIR?=	/usr/doc
2712ad0bb1SNathan WhitehornRELNOTES_LANG?= en_US.ISO8859-1
28fff8eb57SJohn Baldwin
298f1f55e9SRuslan ErmilovTARGET?=	${MACHINE}
300bd47e83SNathan Whitehorn.if ${TARGET} == ${MACHINE}
310bd47e83SNathan WhitehornTARGET_ARCH?=	${MACHINE_ARCH}
328f1f55e9SRuslan Ermilov.else
330bd47e83SNathan WhitehornTARGET_ARCH?=	${TARGET}
348f1f55e9SRuslan Ermilov.endif
3512ad0bb1SNathan WhitehornIMAKE=		${MAKE} TARGET_ARCH=${TARGET_ARCH} TARGET=${TARGET}
36876acefaSHiroki SatoDISTDIR=	dist
378f1f55e9SRuslan Ermilov
38de17cbccSHiroki Sato# Define OSRELEASE by using newvars.sh
39de17cbccSHiroki Sato.if !defined(OSRELEASE) || empty(OSRELEASE)
40de17cbccSHiroki Sato.for _V in TYPE BRANCH REVISION
41de17cbccSHiroki Sato${_V}!=	eval $$(awk '/^${_V}=/{print}' ${.CURDIR}/../sys/conf/newvers.sh); echo $$${_V}
42de17cbccSHiroki Sato.endfor
43de17cbccSHiroki Sato.for _V in ${TARGET_ARCH}
44de17cbccSHiroki Sato.if !empty(TARGET:M${_V})
45de17cbccSHiroki SatoOSRELEASE=	${TYPE}-${REVISION}-${BRANCH}-${TARGET}
46de17cbccSHiroki Sato.else
47de17cbccSHiroki SatoOSRELEASE=	${TYPE}-${REVISION}-${BRANCH}-${TARGET}-${TARGET_ARCH}
48de17cbccSHiroki Sato.endif
49de17cbccSHiroki Sato.endfor
50de17cbccSHiroki Sato.endif
51de17cbccSHiroki Sato
5212ad0bb1SNathan Whitehorn.if !exists(${DOCDIR})
5312ad0bb1SNathan WhitehornNODOC= true
5412ad0bb1SNathan Whitehorn.endif
5512ad0bb1SNathan Whitehorn.if !exists(${PORTSDIR})
5612ad0bb1SNathan WhitehornNOPORTS= true
57dd1a1b3dSJoerg Wunsch.endif
58dd1a1b3dSJoerg Wunsch
5912ad0bb1SNathan WhitehornEXTRA_PACKAGES=
606daa108fSRuslan Ermilov.if !defined(NOPORTS)
6112ad0bb1SNathan WhitehornEXTRA_PACKAGES+= ports.txz
626daa108fSRuslan Ermilov.endif
634731faa3SJordan K. Hubbard.if !defined(NOSRC)
6412ad0bb1SNathan WhitehornEXTRA_PACKAGES+= src.txz
652e3a1557SKen Smith.endif
66a1b193b5SJohn Baldwin.if !defined(NODOC)
6712ad0bb1SNathan WhitehornEXTRA_PACKAGES+= reldoc
68b2200964SJohn Baldwin.endif
69b2200964SJohn Baldwin
7012ad0bb1SNathan WhitehornRELEASE_TARGETS= ftp
71876acefaSHiroki SatoIMAGES=
7212ad0bb1SNathan Whitehorn.if exists(${.CURDIR}/${TARGET}/mkisoimages.sh)
7312ad0bb1SNathan WhitehornRELEASE_TARGETS+= cdrom
748cec99b6SGlen BarberIMAGES+=	disc1.iso bootonly.iso
756daa108fSRuslan Ermilov.endif
7612ad0bb1SNathan Whitehorn.if exists(${.CURDIR}/${TARGET}/make-memstick.sh)
773c334738SGlen BarberRELEASE_TARGETS+= memstick.img
78a9da1707SGlen BarberRELEASE_TARGETS+= mini-memstick.img
793c334738SGlen BarberIMAGES+=	memstick.img
80a9da1707SGlen BarberIMAGES+=	mini-memstick.img
81e738d1eaSJohn Baldwin.endif
82e738d1eaSJohn Baldwin
838eb4e096SRuslan Ermilov.include <bsd.obj.mk>
8412ad0bb1SNathan Whitehorn
8512ad0bb1SNathan Whitehornbase.txz:
86876acefaSHiroki Sato	mkdir -p ${DISTDIR}
87876acefaSHiroki Sato	cd ${WORLDDIR} && ${IMAKE} distributeworld DISTDIR=${.OBJDIR}/${DISTDIR}
8812ad0bb1SNathan Whitehorn# Set up mergemaster root database
89672d7ddbSSean Bruno	sh ${.CURDIR}/scripts/mm-mtree.sh -m ${WORLDDIR} -F \
90876acefaSHiroki Sato	    "TARGET_ARCH=${TARGET_ARCH} TARGET=${TARGET}" -D "${.OBJDIR}/${DISTDIR}/base"
91bfc3bab8SNathan Whitehorn# Package all components
92876acefaSHiroki Sato	cd ${WORLDDIR} && ${IMAKE} packageworld DISTDIR=${.OBJDIR}/${DISTDIR}
93876acefaSHiroki Sato	mv ${DISTDIR}/*.txz .
9412ad0bb1SNathan Whitehorn
9512ad0bb1SNathan Whitehornkernel.txz:
96876acefaSHiroki Sato	mkdir -p ${DISTDIR}
97876acefaSHiroki Sato	cd ${WORLDDIR} && ${IMAKE} distributekernel packagekernel DISTDIR=${.OBJDIR}/${DISTDIR}
98876acefaSHiroki Sato	mv ${DISTDIR}/kernel*.txz .
9912ad0bb1SNathan Whitehorn
10012ad0bb1SNathan Whitehornsrc.txz:
101876acefaSHiroki Sato	mkdir -p ${DISTDIR}/usr
10212ad0bb1SNathan Whitehorn	ln -fs ${WORLDDIR} ${DISTDIR}/usr/src
1039f5907dbSGlen Barber	cd ${DISTDIR} && tar cLvJf ${.OBJDIR}/src.txz --exclude .svn --exclude .zfs \
104c4acc58dSEd Maste	    --exclude CVS --exclude @ --exclude usr/src/release/dist usr/src
10512ad0bb1SNathan Whitehorn
10612ad0bb1SNathan Whitehornports.txz:
107876acefaSHiroki Sato	mkdir -p ${DISTDIR}/usr
10812ad0bb1SNathan Whitehorn	ln -fs ${PORTSDIR} ${DISTDIR}/usr/ports
10912ad0bb1SNathan Whitehorn	cd ${DISTDIR} && tar cLvJf ${.OBJDIR}/ports.txz \
1106f4fc344SNathan Whitehorn	    --exclude CVS --exclude .svn \
11112ad0bb1SNathan Whitehorn	    --exclude usr/ports/distfiles --exclude usr/ports/packages \
11212ad0bb1SNathan Whitehorn	    --exclude 'usr/ports/INDEX*' --exclude work usr/ports
11312ad0bb1SNathan Whitehorn
11412ad0bb1SNathan Whitehornreldoc:
11512ad0bb1SNathan Whitehorn	cd ${.CURDIR}/doc && ${MAKE} all install clean 'FORMATS=html txt' \
11612ad0bb1SNathan Whitehorn	    INSTALL_COMPRESSED='' URLS_ABSOLUTE=YES DOCDIR=${.OBJDIR}/rdoc
117876acefaSHiroki Sato	mkdir -p reldoc
11812ad0bb1SNathan Whitehorn.for i in hardware readme relnotes errata
11953089271STijl Coosemans	ln -f rdoc/${RELNOTES_LANG}/${i}/article.txt reldoc/${i:tu}.TXT
12053089271STijl Coosemans	ln -f rdoc/${RELNOTES_LANG}/${i}/article.html reldoc/${i:tu}.HTM
12112ad0bb1SNathan Whitehorn.endfor
122876acefaSHiroki Sato	cp rdoc/${RELNOTES_LANG}/readme/docbook.css reldoc
12312ad0bb1SNathan Whitehorn
12412ad0bb1SNathan Whitehornsystem: packagesystem
12512ad0bb1SNathan Whitehorn# Install system
126876acefaSHiroki Sato	mkdir -p release
1276e352319SNathan Whitehorn	cd ${WORLDDIR} && ${IMAKE} installkernel installworld distribution \
12858ddb0a6SGlen Barber		DESTDIR=${.OBJDIR}/release WITHOUT_RESCUE=1 WITHOUT_KERNEL_SYMBOLS=1 \
12958ddb0a6SGlen Barber		WITHOUT_PROFILE=1
13012ad0bb1SNathan Whitehorn# Copy distfiles
131876acefaSHiroki Sato	mkdir -p release/usr/freebsd-dist
132876acefaSHiroki Sato	cp *.txz MANIFEST release/usr/freebsd-dist
13312ad0bb1SNathan Whitehorn# Copy documentation, if generated
13412ad0bb1SNathan Whitehorn.if !defined(NODOC)
135876acefaSHiroki Sato	cp reldoc/* release
13612ad0bb1SNathan Whitehorn.endif
13712ad0bb1SNathan Whitehorn# Set up installation environment
138de17cbccSHiroki Sato	ln -fs /tmp/bsdinstall_etc/resolv.conf release/etc/resolv.conf
139876acefaSHiroki Sato	echo sendmail_enable=\"NONE\" > release/etc/rc.conf
140876acefaSHiroki Sato	echo hostid_enable=\"NO\" >> release/etc/rc.conf
141876acefaSHiroki Sato	cp ${.CURDIR}/rc.local release/etc
142876acefaSHiroki Sato	touch ${.TARGET}
14312ad0bb1SNathan Whitehorn
14446c413feSNathan Whitehornbootonly: packagesystem
14546c413feSNathan Whitehorn# Install system
146876acefaSHiroki Sato	mkdir -p bootonly
14746c413feSNathan Whitehorn	cd ${WORLDDIR} && ${IMAKE} installkernel installworld distribution \
14846c413feSNathan Whitehorn	    DESTDIR=${.OBJDIR}/bootonly WITHOUT_AMD=1 WITHOUT_AT=1 \
14956b72efeSDag-Erling Smørgrav	    WITHOUT_GAMES=1 WITHOUT_GROFF=1 \
15046c413feSNathan Whitehorn	    WITHOUT_INSTALLLIB=1 WITHOUT_LIB32=1 WITHOUT_MAIL=1 \
15101dae98eSNathan Whitehorn	    WITHOUT_NCP=1 WITHOUT_TOOLCHAIN=1 WITHOUT_PROFILE=1 \
15201dae98eSNathan Whitehorn	    WITHOUT_INSTALLIB=1 WITHOUT_RESCUE=1 WITHOUT_DICT=1 \
15301dae98eSNathan Whitehorn	    WITHOUT_KERNEL_SYMBOLS=1
15446c413feSNathan Whitehorn# Copy manifest only (no distfiles) to get checksums
155876acefaSHiroki Sato	mkdir -p bootonly/usr/freebsd-dist
156876acefaSHiroki Sato	cp MANIFEST bootonly/usr/freebsd-dist
15746c413feSNathan Whitehorn# Copy documentation, if generated
15846c413feSNathan Whitehorn.if !defined(NODOC)
159876acefaSHiroki Sato	cp reldoc/* bootonly
16046c413feSNathan Whitehorn.endif
16146c413feSNathan Whitehorn# Set up installation environment
162de17cbccSHiroki Sato	ln -fs /tmp/bsdinstall_etc/resolv.conf bootonly/etc/resolv.conf
163876acefaSHiroki Sato	echo sendmail_enable=\"NONE\" > bootonly/etc/rc.conf
164876acefaSHiroki Sato	echo hostid_enable=\"NO\" >> bootonly/etc/rc.conf
165876acefaSHiroki Sato	cp ${.CURDIR}/rc.local bootonly/etc
16646c413feSNathan Whitehorn
1678cec99b6SGlen Barberrelease.iso: disc1.iso
1688cec99b6SGlen Barberdisc1.iso: system
169876acefaSHiroki Sato	sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b FreeBSD_Install ${.TARGET} release
17012ad0bb1SNathan Whitehorn
17146c413feSNathan Whitehornbootonly.iso: bootonly
172876acefaSHiroki Sato	sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b FreeBSD_Install ${.TARGET} bootonly
17346c413feSNathan Whitehorn
174cb95a96bSGlen Barbermemstick: memstick.img
1753c334738SGlen Barbermemstick.img: system
176876acefaSHiroki Sato	sh ${.CURDIR}/${TARGET}/make-memstick.sh release ${.TARGET}
17712ad0bb1SNathan Whitehorn
178a9da1707SGlen Barbermini-memstick: mini-memstick.img
179a9da1707SGlen Barbermini-memstick.img: system
180a9da1707SGlen Barber	sh ${.CURDIR}/${TARGET}/make-memstick.sh bootonly ${.TARGET}
181a9da1707SGlen Barber
18212ad0bb1SNathan Whitehornpackagesystem: base.txz kernel.txz ${EXTRA_PACKAGES}
183876acefaSHiroki Sato	sh ${.CURDIR}/scripts/make-manifest.sh *.txz > MANIFEST
184299a8b95SNathan Whitehorn	touch ${.TARGET}
18512ad0bb1SNathan Whitehorn
1868cec99b6SGlen Barbercdrom: disc1.iso bootonly.iso
18712ad0bb1SNathan Whitehornftp: packagesystem
188299a8b95SNathan Whitehorn	rm -rf ftp
189876acefaSHiroki Sato	mkdir -p ftp
190299a8b95SNathan Whitehorn	cp *.txz MANIFEST ftp
19112ad0bb1SNathan Whitehorn
1920bd47e83SNathan Whitehornrelease:
1930bd47e83SNathan Whitehorn	${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} obj
1940bd47e83SNathan Whitehorn	${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} ${RELEASE_TARGETS}
19512ad0bb1SNathan Whitehorn
19612ad0bb1SNathan Whitehornclean:
197876acefaSHiroki Sato	chflags -R noschg .
198299a8b95SNathan Whitehorn	rm -rf dist ftp
19912ad0bb1SNathan Whitehorn	rm -f packagesystem
200299a8b95SNathan Whitehorn	rm -f *.txz MANIFEST
20112ad0bb1SNathan Whitehorn	rm -f system
202299a8b95SNathan Whitehorn	rm -rf release bootonly
203*849861d0SGlen Barber	rm -f ${IMAGES}
204299a8b95SNathan Whitehorn
205299a8b95SNathan Whitehorninstall:
206876acefaSHiroki Sato.if defined(DESTDIR) && !empty(DESTDIR)
207876acefaSHiroki Sato	mkdir -p ${DESTDIR}
208876acefaSHiroki Sato.endif
209de17cbccSHiroki Sato	cp -a ftp ${DESTDIR}/
210de17cbccSHiroki Sato.for I in ${IMAGES}
211de17cbccSHiroki Sato	cp -p ${I} ${DESTDIR}/${OSRELEASE}-${I}
212de17cbccSHiroki Sato.endfor
213de17cbccSHiroki Sato	cd ${DESTDIR} && sha256 ${OSRELEASE}* > ${DESTDIR}/CHECKSUM.SHA256
214de17cbccSHiroki Sato	cd ${DESTDIR} && md5 ${OSRELEASE}* > ${DESTDIR}/CHECKSUM.MD5
215