xref: /freebsd/release/Makefile (revision 2e3a155793cd943ffd0be040d425fbbb5005d048)
197d92980SPeter Wemm# $FreeBSD$
20202c140SRodney W. Grimes#
3dba36bb9SRuslan Ermilov# make release [BUILDNAME=somename] CHROOTDIR=/some/dir CVSROOT=/cvs/dir \
4faec9c80SJeroen Ruigrok van der Werven#     [RELEASETAG=tag]
5bd668f6fSPoul-Henning Kamp#
6faec9c80SJeroen Ruigrok van der Werven# Where "/some/dir" is the pathname of a directory on a some filesystem with
7faec9c80SJeroen Ruigrok van der Werven# at least 1000MB of free space, "somename" is what you want the release to
8faec9c80SJeroen Ruigrok van der Werven# call itself, "/cvs/dir" is where our source repo resides and, optionally,
9faec9c80SJeroen Ruigrok van der Werven# which CVS "tag" name should be used when checking out the sources to build
10faec9c80SJeroen Ruigrok van der Werven# the release (default is HEAD).
11bd668f6fSPoul-Henning Kamp#
12dba36bb9SRuslan Ermilov# Please note: the md(4) driver must be present in the kernel
13919b0026SDavid E. O'Brien# (either by being compiled in or available as a kld(4) module),
145355286aSColin Percival# otherwise the target 'release.8' and possibly others will fail.
15f1a03fb6SAndreas Klemm#
160874402dSMurray Stokely# Note: If you add options to this file, please keep release(7) updated!
170874402dSMurray Stokely#
18aeb6d603SJordan K. Hubbard# Set these, release builder!
19d013a27bSJoerg Wunsch#
20d013a27bSJoerg Wunsch# Fixed version:
21c15e0967SKen Smith#BUILDNAME=8.0-CURRENT
22d013a27bSJoerg Wunsch#
23d013a27bSJoerg Wunsch# Automatic SNAP versioning:
24fcab936bSDag-Erling SmørgravDATE != date +%Y%m%d
25c15e0967SKen SmithBASE = 8.0
2664938abfSJordan K. HubbardBUILDNAME?=${BASE}-${DATE}-SNAP
27d013a27bSJoerg Wunsch#
28fe85fe95SJordan K. Hubbard#CHROOTDIR=/junk/release
293da2229cSBrian Somers# If this is a -stable snapshot, then set
30c15e0967SKen Smith#RELEASETAG=RELENG_7
31d751ad7fSJohn W. De Boskey#
3298b2ae09SMark Murray# To test a release with a source tree containing patches and
3398b2ae09SMark Murray# other work. This tree will get copied instead of getting the
3498b2ae09SMark Murray# src/ tree from a CVS checkout. For "rerelease", this will NOT
3598b2ae09SMark Murray# be copied; cvs update will be used instead.
3698b2ae09SMark Murray#EXTSRCDIR=/usr/src
3798b2ae09SMark Murray#
38fcb9ab1eSYoshihiro Takahashi# To use a checked-out ports collection directory instead of
39fcb9ab1eSYoshihiro Takahashi# checking out from a local CVS repository, set this option.
40fcb9ab1eSYoshihiro Takahashi#EXTPORTSDIR=/usr/ports
41fcb9ab1eSYoshihiro Takahashi#
42d751ad7fSJohn W. De Boskey# To add other options to the CVS subcommands (co,up), set
432b3f8b22SMakoto Matsushita#CVSCMDARGS="-D '01/01/2002 00:00:00 UTC'"
443f17d264SSatoshi Asami#
45d751ad7fSJohn W. De Boskey# To add other options to the CVS command, set
46d751ad7fSJohn W. De Boskey#CVSARGS="-lfq"
47d751ad7fSJohn W. De Boskey#
48d751ad7fSJohn W. De Boskey# To prefix the cvs command
49d751ad7fSJohn W. De Boskey#CVSPREFIX="/usr/bin/time"
50d751ad7fSJohn W. De Boskey#
5198b2ae09SMark Murray# Where the CVS repository is
5298b2ae09SMark Murray#CVSROOT="/home/ncvs"
5398b2ae09SMark Murray#
543f17d264SSatoshi Asami# Non-zero if ${RELEASETAG} is in the form "RELENG_ver_RELEASE"; we
553f17d264SSatoshi Asami# are building an official release.  Otherwise, we are building for
563f17d264SSatoshi Asami# a branch.
573f17d264SSatoshi Asami.if defined(RELEASETAG)
58be1234f2SPoul-Henning KampISRELEASE!=	expr "${RELEASETAG}" : '^RELENG_.*_RELEASE$$' || true
593f17d264SSatoshi Asami.if ${ISRELEASE} != 0
603f17d264SSatoshi Asami# Convert "RELENG_ver_RELEASE" to "RELEASE_ver" for ports and doc trees.
613f17d264SSatoshi AsamiAUXRELEASETAG!=	echo ${RELEASETAG} | sed -e 's/^RELENG_/RELEASE_/' -e 's/_RELEASE$$//'
625be3b5d9SJordan K. HubbardDOCRELEASETAG?=		${AUXRELEASETAG}
635be3b5d9SJordan K. HubbardPORTSRELEASETAG?=	${AUXRELEASETAG}
643f17d264SSatoshi Asami.endif
653f17d264SSatoshi Asami.endif
66ab0e9cdcSPoul-Henning Kamp
67fff8eb57SJohn Baldwin# If you want to pass flags to the world build such as -j X, use
68fff8eb57SJohn Baldwin# WORLD_FLAGS.  Similarly, you can specify make flags for kernel
69fff8eb57SJohn Baldwin# builds via KERNEL_FLAGS.
702272d4a4SScott Long#WORLD_FLAGS=-j4
712272d4a4SScott Long#KERNEL_FLAGS=-j4
72fff8eb57SJohn Baldwin
738f1f55e9SRuslan ErmilovTARGET_ARCH?=	${MACHINE_ARCH}
748f1f55e9SRuslan Ermilov.if ${TARGET_ARCH} == ${MACHINE_ARCH}
758f1f55e9SRuslan ErmilovTARGET?=	${MACHINE}
768f1f55e9SRuslan Ermilov.else
778f1f55e9SRuslan ErmilovTARGET?=	${TARGET_ARCH}
788f1f55e9SRuslan Ermilov.endif
795dc63117SRuslan ErmilovCROSSENV=	TARGET_ARCH=${TARGET_ARCH} TARGET=${TARGET}
805dc63117SRuslan ErmilovCROSSMAKE=	${MAKE} ${CROSSENV}
8161c2d47aSRuslan ErmilovNATIVEMAKE=	${MAKE} TARGET_ARCH=${MACHINE_ARCH} TARGET=${MACHINE}
828f1f55e9SRuslan Ermilov
830c9cba52SMike Smith# If you are using a local CVS repository with components stored in
840c9cba52SMike Smith# non-standard modules, override these on the make commandline or
850c9cba52SMike Smith# in the environment.
860c9cba52SMike SmithRELEASESRCMODULE?=	src
870c9cba52SMike SmithRELEASEDOCMODULE?=	doc
880c9cba52SMike SmithRELEASEPORTSMODULE?=	ports
890c9cba52SMike Smith
90dd1a1b3dSJoerg Wunsch# Uncomment this to disable the doc.1 target.  Docs normally require
91dd1a1b3dSJoerg Wunsch# the ports tree, so NOPORTS can be set together with NODOC in order
92dd1a1b3dSJoerg Wunsch# to have neither ports or docs.  If only NOPORTS is set to YES, but
93dd1a1b3dSJoerg Wunsch# docs are still desired, the DOMINIMALDOCPORTS logic below will only
94dd1a1b3dSJoerg Wunsch# install the ports that are minimally required for the docs.  This is
95dd1a1b3dSJoerg Wunsch# intended as a compromise, less disk space is required than for using
9623ef6da7STom Rhodes# the entire ports collection (and much less time due to the huge number
97dd1a1b3dSJoerg Wunsch# of directories it would create), but still quite a bit as well as some
98dd1a1b3dSJoerg Wunsch# CPU cycles (some of the programs are C++, and things like ghostscript
99dd1a1b3dSJoerg Wunsch# belong to the required ports nevertheless).
100dd1a1b3dSJoerg Wunsch#
10121203b38SBruce A. Mah# Setting this also disables building of release note documentation
10221203b38SBruce A. Mah# (RELNOTESng).
10385486998SJordan K. Hubbard#NODOC=  YES
104d6c7028cSJohn Hay#NOPORTS=  YES
1058ed3802bSBruce A. Mah
106182d7632SRuslan Ermilov# When retrieving ports using the pkg_add -r method, set your proxies to these.
107182d7632SRuslan Ermilov# src/release/${arch}/mkisoimages.sh can use these.
108182d7632SRuslan Ermilov#HTTP_PROXY?=	www.example.com
109182d7632SRuslan Ermilov#FTP_PROXY?=	ftp.example.com
110182d7632SRuslan Ermilov
111b2200964SJohn Baldwin# When creating ISO images, point ${CD_PACKAGE_TREE} to a directory containing
112b2200964SJohn Baldwin# the package split by an earlier invocation of the 'package-split' target.
113b2200964SJohn Baldwin#CD_PACKAGE_TREE=	/path/to/pkg
114182d7632SRuslan Ermilov
115182d7632SRuslan Ermilov# Extra source tarballs; each argument is a pair of source dir and
116182d7632SRuslan Ermilov# distribution name.  The dist name should not exceed 7 characters
117182d7632SRuslan Ermilov# (another "s" for "source" will be prepended).
118182d7632SRuslan Ermilov#EXTRA_SRC=	games/fortune fortune
119182d7632SRuslan Ermilov
1207a7a00adSRuslan Ermilov# Modify this definition if you want the release notes
12139ab86fdSBruce A. Mah# and other release documentation in a language other than English.
1227a7a00adSRuslan ErmilovRELNOTES_LANG?=	en_US.ISO8859-1
1238ed3802bSBruce A. Mah
124dd1a1b3dSJoerg Wunsch# As an alternative to installing the entire ports collection (which
125dd1a1b3dSJoerg Wunsch# can take a huge amount of time, in particular on slower disks),
126dd1a1b3dSJoerg Wunsch# setting ${MINIMALDOCPORTS} allows to install and build just those
127dd1a1b3dSJoerg Wunsch# ports that are really required for getting the docs up & running.
128dd1a1b3dSJoerg Wunsch.if defined(NOPORTS) && !defined(NODOC)
129dd1a1b3dSJoerg WunschDOMINIMALDOCPORTS=	YES
130dd1a1b3dSJoerg Wunsch.include "Makefile.inc.docports"
131d8e78869SMarcel MoolenaarRELEASEPORTSMODULE=	${MINIMALDOCPORTS} ports/sysutils/cdrtools
132dd1a1b3dSJoerg Wunsch.endif
133dd1a1b3dSJoerg Wunsch
134dd1a1b3dSJoerg Wunsch# Helper variable
135dd1a1b3dSJoerg Wunsch.if defined(NOPORTS)
136dd1a1b3dSJoerg Wunsch.if !defined(DOMINIMALDOCPORTS) || ${DOMINIMALDOCPORTS} != "YES"
137dd1a1b3dSJoerg WunschNOPORTSATALL=	YES
138dd1a1b3dSJoerg Wunsch.endif
139dd1a1b3dSJoerg Wunsch.endif
140dd1a1b3dSJoerg Wunsch
141485b9268SKen Smith#
142485b9268SKen Smith# Doing 'make index' in /usr/ports requires Perl.
143485b9268SKen SmithMAKEINDEXPORTS=	lang/perl5.8
144a7042915SRuslan Ermilov# By default, documentation (Handbook, FAQ, etc.) is built for all
145a7042915SRuslan Ermilov# the languages.  To speed up building, set the DOC_LANG to just
146a7042915SRuslan Ermilov# the languages you need.  (The language for the release notes is
147a7042915SRuslan Ermilov# controlled by the RELNOTES_LANG variable above.)
148a7042915SRuslan Ermilov#DOC_LANG=	en_US.ISO8859-1
1492f332092SJordan K. HubbardDOCPORTS=	textproc/docproj
15040227c90SMakoto Matsushita# Set this to wherever the distfiles required by release procedures.
15140227c90SMakoto Matsushita.if defined(DOCDISTFILES)
15240227c90SMakoto Matsushita# Respect DOCDISTFILES which is used before.
15340227c90SMakoto MatsushitaRELEASEDISTFILES?=	${DOCDISTFILES}
15440227c90SMakoto Matsushita.else
15540227c90SMakoto MatsushitaRELEASEDISTFILES?=	${.CURDIR}/../../ports/distfiles
15640227c90SMakoto Matsushita.endif
157ce51a9fcSJordan K. Hubbard# Set this to 1 if you want -P to be used for automatic keyboard detection
158ce51a9fcSJordan K. Hubbard# on the boot floppy.  WARNING: Breaks on some Athlon (K7) motherboards.
159ce51a9fcSJordan K. HubbardAUTO_KEYBOARD_DETECT?= 0
160ce51a9fcSJordan K. Hubbard
16121203b38SBruce A. Mah.if !defined(NODOC)
162e1ae210aSBruce A. MahDIST_DOCS_ARCH_INDEP=	hardware readme relnotes errata
163f08071c0SBruce A. MahDIST_DOCS_ARCH_DEP=
1648ed3802bSBruce A. Mah.endif
165ed517874SJordan K. Hubbard
166bd668f6fSPoul-Henning Kamp# Things which without too much trouble can be considered variables
16701df2ec3SDavid E. O'Brien# BASE_DISTS are special in that they get full /etc installation sets.
1687284556fSJordan K. Hubbard#
169ece6831dSRuslan ErmilovOTHER_DISTS?=	catpages manpages games proflibs dict info doc ${ARCH_DISTS}
17001df2ec3SDavid E. O'BrienBASE_DISTS?=	base
171ece6831dSRuslan Ermilov.if ${TARGET_ARCH} == "amd64"
172ece6831dSRuslan ErmilovARCH_DISTS?=	lib32
173ece6831dSRuslan Ermilov.endif
174c6d8b958SDavid E. O'BrienDISTRIBUTIONS?=	${BASE_DISTS} ${OTHER_DISTS}
175785bd4b4SPoul-Henning Kamp
1769fe7600bSSam Leffler#
1779fe7600bSSam Leffler# Build and package both GENERIC and SMP kernels if the target
1789fe7600bSSam Leffler# has both configuration files.  Otherwise only GENERIC is done.
1799fe7600bSSam Leffler#
180eb765a4dSRuslan Ermilov.if exists(${.CURDIR}/../sys/${TARGET}/conf/SMP)
181fdb71eeeSSam LefflerKERNELS_BASE?=	GENERIC SMP
182fdb71eeeSSam Leffler.else
183fdb71eeeSSam LefflerKERNELS_BASE?=	GENERIC
1849fe7600bSSam Leffler.endif
1859fe7600bSSam Leffler
1867c474103SPoul-Henning Kamp# mountpoint for filesystems.
1877c474103SPoul-Henning KampMNT=			/mnt
188518a1d34SPoul-Henning Kamp
189a5ddb8cfSJordan K. Hubbard# Various floppy image parameters.
190a5ddb8cfSJordan K. Hubbard#
191b98c5f70STatsumi Hosokawa
19294223a53SDavid E. O'Brien.undef MAKE_FLOPPIES
1938f1f55e9SRuslan Ermilov.if ${TARGET_ARCH} == "i386"
19494223a53SDavid E. O'BrienMAKE_FLOPPIES=		true
1952e3a1557SKen SmithMAKE_DVD=
1961bf7496cSKen SmithSEPARATE_LIVEFS=
1977404bf51SKen SmithSPLIT_MFSROOT=
1988f1f55e9SRuslan Ermilov.if ${TARGET} == "pc98"
199c0731f81SJohn BaldwinSMALLFLOPPYSIZE=	1200
200c0731f81SJohn BaldwinSMALLFLOPPYSPLITSIZE=	1152
201c0731f81SJohn BaldwinSMALLFLOPPYLABEL=	fd1200
20213ff581dSJohn BaldwinSPLIT_MFSROOT=
203a40915d7SYoshihiro Takahashi.endif
204c0731f81SJohn BaldwinFLOPPYSIZE=		1440
205c0731f81SJohn BaldwinFLOPPYSPLITSIZE=	1392
206c0731f81SJohn BaldwinFLOPPYINODE=		40000
207c0731f81SJohn BaldwinFLOPPYLABEL=		fd1440
208d943f83bSJohn BaldwinBOOTINODE=		80000
209d943f83bSJohn BaldwinMFSSIZE=		4320
210d943f83bSJohn BaldwinMFSINODE=		8000
211c0731f81SJohn BaldwinMFSLABEL=		minimum3
212c26d9e5aSJake Burkholder.elif ${TARGET_ARCH} == "sparc64"
213c9030dc8SRuslan ErmilovDISKLABEL=		sunlabel
214c26d9e5aSJake BurkholderMFSSIZE=		4096
215c26d9e5aSJake BurkholderMFSINODE=		8192
216c26d9e5aSJake BurkholderMFSLABEL=		auto
217a4f9e93cSRuslan ErmilovMINIROOT=
218710d4ca3SMarcel Moolenaar.elif ${TARGET_ARCH} == "ia64"
21970d8932fSMarcel MoolenaarDISKLABEL=		""
220d943f83bSJohn BaldwinMFSSIZE=		8192
221710d4ca3SMarcel MoolenaarMFSINODE=		8192
222710d4ca3SMarcel MoolenaarMFSLABEL=		auto
223f16d1c7cSJohn BaldwinSEPARATE_LIVEFS=
2242d7d81e9SPeter Wemm.elif ${TARGET_ARCH} == "amd64"
225c5245e57SJohn BaldwinMAKE_FLOPPIES=		true
2262e3a1557SKen SmithMAKE_DVD=
227c5245e57SJohn BaldwinFLOPPYSIZE=		1440
228c5245e57SJohn BaldwinFLOPPYSPLITSIZE=	1392
229c5245e57SJohn BaldwinFLOPPYINODE=		40000
230c5245e57SJohn BaldwinFLOPPYLABEL=		fd1440
231c5245e57SJohn BaldwinBOOTINODE=		80000
2322d7d81e9SPeter WemmMFSSIZE=		4096
2332d7d81e9SPeter WemmMFSINODE=		8192
2342d7d81e9SPeter WemmMFSLABEL=		auto
235eb173edbSKen SmithSEPARATE_LIVEFS=
23665030cb8SKen SmithSPLIT_MFSROOT=
237fa7bd283SPeter Grehan.elif ${TARGET_ARCH} == "powerpc"
238fa7bd283SPeter GrehanDISKLABEL=		""
239fa7bd283SPeter GrehanMFSSIZE=		4096
240fa7bd283SPeter GrehanMFSINODE=		8192
241fa7bd283SPeter GrehanMFSLABEL=		auto
24224aade12SPeter GrehanSEPARATE_LIVEFS=
2437f047619SJoerg Wunsch.endif
244f0414231SDavid E. O'Brien.if defined(NO_FLOPPIES)
245f0414231SDavid E. O'Brien.undef MAKE_FLOPPIES
246f0414231SDavid E. O'Brien.endif
2470202c140SRodney W. Grimes
2485795760cSRuslan Ermilov.if exists(/sbin/bsdlabel)
2495795760cSRuslan ErmilovDISKLABEL?=		bsdlabel
2505795760cSRuslan Ermilov.else
251c9030dc8SRuslan ErmilovDISKLABEL?=		disklabel
2525795760cSRuslan Ermilov.endif
253c9030dc8SRuslan Ermilov
254569acadfSDavid E. O'BrienZIPPER=			gzip -9 --no-name
255569acadfSDavid E. O'BrienZIPNSPLIT=		${ZIPPER} -c | split -b 1392k -
25600063f88SPoul-Henning Kamp
2577284556fSJordan K. Hubbard# Things which may get you into trouble if you change them
25848327bc9SPoul-Henning KampMTREEFILES=		${.CURDIR}/../etc/mtree
25972995602SDavid E. O'Brien_R?=			/R
260335d64e6SJordan K. HubbardRD=			${_R}/stage
261febbbc67SBruce A. MahRND=			${RD}/release.doc
262335d64e6SJordan K. HubbardFD=			${_R}/ftp
263335d64e6SJordan K. HubbardCD=			${_R}/cdrom
2646daa108fSRuslan ErmilovCD_BOOT=		${CD}/bootonly
2651bac119bSJordan K. HubbardCD_DISC1=		${CD}/disc1
2661bac119bSJordan K. HubbardCD_DISC2=		${CD}/disc2
2672e3a1557SKen Smith.if defined(MAKE_DVD)
2682e3a1557SKen SmithCD_DVD=			${CD}/dvd
2692e3a1557SKen Smith.endif
270639fe104SKen Smith.if !defined(NODOC)
271639fe104SKen SmithCD_DOCS=		${CD}/docs
272639fe104SKen Smith.endif
273b2200964SJohn Baldwin.if defined(SEPARATE_LIVEFS)
274b2200964SJohn BaldwinCD_LIVEFS=		${CD}/livefs
27592f6e2c8SJohn Baldwin.else
27692f6e2c8SJohn BaldwinCD_LIVEFS=		${CD_DISC1}
27788f69650SKen Smith.endif
27892f6e2c8SJohn Baldwin_MK?=			${CHROOTDIR}/mk
27988f69650SKen Smith
2800c5b292cSJordan K. Hubbard# Where the bootstrap ports (see DOCPORTS) get installed.
2810c5b292cSJordan K. HubbardLOCALDIR=		/usr/local/bin
2820c5b292cSJordan K. Hubbard
283a4f9e93cSRuslan Ermilov.if ${TARGET} != ${MACHINE} && ${DISKLABEL} == "bsdlabel"
284c9030dc8SRuslan ErmilovDOFS_SH=	${.CURDIR}/scripts/doFS.sh ${DISKLABEL} ${TARGET}
285f3fb0a6cSMarcel Moolenaar.else
286c9030dc8SRuslan ErmilovDOFS_SH=	${.CURDIR}/scripts/doFS.sh ${DISKLABEL} ""
287f3fb0a6cSMarcel Moolenaar.endif
288f3fb0a6cSMarcel Moolenaar
289c26d9e5aSJake BurkholderCRUNCH_TARGETS=	boot
2903cd22041SRuslan Ermilov.if ${TARGET_ARCH} == "i386"
2913cd22041SRuslan ErmilovCRUNCH_TARGETS+=fixit
2923cd22041SRuslan Ermilov.if ${TARGET} == "pc98"
2933cd22041SRuslan ErmilovCRUNCH_TARGETS+=fixit-small
294c26d9e5aSJake Burkholder.endif
2953cd22041SRuslan Ermilov.endif
2963525074dSPoul-Henning Kamp
29794223a53SDavid E. O'Brien.if defined(MAKE_FLOPPIES)
298aaf3e5b0SJohn BaldwinEXTRAS= floppies.1
299aaf3e5b0SJohn Baldwin.if ${TARGET_ARCH} == "i386"
300aaf3e5b0SJohn BaldwinEXTRAS+= floppies.2
301aaf3e5b0SJohn Baldwin.endif
302aaf3e5b0SJohn BaldwinEXTRAS+= floppies.3
303c0731f81SJohn Baldwin.endif
304c0731f81SJohn BaldwinEXTRAS+= ftp.1
3050e25a727SJohn Baldwin.if !defined(NOCDROM)
30692f6e2c8SJohn BaldwinEXTRAS+= cdrom.1 cdrom.2 cdrom.3
3072ef74d22SJordan K. Hubbard.if defined(MAKE_ISOS)
3082ef74d22SJordan K. HubbardEXTRAS+= iso.1
30998f15514SMurray Stokely.endif
310d943f83bSJohn Baldwin.if ${TARGET} == "pc98"
311ef6cf7f1SYoshihiro TakahashiBOOTABLE="-G"
3126ebe9601SRuslan Ermilov.else
31329921a60SYoshihiro TakahashiBOOTABLE="-b"
31429921a60SYoshihiro Takahashi.endif
3152ef74d22SJordan K. Hubbard.endif
316793e8c6fSJordan K. Hubbard
317793e8c6fSJordan K. Hubbard.if !defined(NODOC)
31821203b38SBruce A. MahDOCREL= doc.1 doc.2
319793e8c6fSJordan K. Hubbard.endif
320793e8c6fSJordan K. Hubbard
321e738d1eaSJohn Baldwin.if !make(release) && !make(rerelease) && !make(package-split)
3225dc63117SRuslan ErmilovBINMAKE!=	cd ${.CURDIR}/..; ${MAKE} -V BINMAKE
3235dc63117SRuslan ErmilovWMAKEENV!=	cd ${.CURDIR}/..; \
3245dc63117SRuslan Ermilov		${BINMAKE} ${CROSSENV} -f Makefile.inc1 -V WMAKEENV
3255dc63117SRuslan ErmilovWMAKE=		${WMAKEENV} ${BINMAKE}
3269b72ad91SRuslan Ermilov.endif
3276bde859fSRuslan Ermilov
328d9d84e07SJohn BaldwinCVS_SRCARGS=	-P
329d9d84e07SJohn Baldwin.if defined(RELEASETAG)
330d9d84e07SJohn BaldwinCVS_SRCARGS+=	-r ${RELEASETAG}
331d9d84e07SJohn Baldwin.endif
332d9d84e07SJohn Baldwin
333d9d84e07SJohn BaldwinCVS_DOCARGS=	-P
334d9d84e07SJohn Baldwin.if defined(DOCRELEASETAG)
335d9d84e07SJohn BaldwinCVS_DOCARGS+=	-r ${DOCRELEASETAG}
336d9d84e07SJohn Baldwin.endif
337d9d84e07SJohn Baldwin
338d9d84e07SJohn BaldwinCVS_PORTSARGS=	-P
339d9d84e07SJohn Baldwin.if defined(PORTSRELEASETAG)
340d9d84e07SJohn BaldwinCVS_PORTSARGS+=	-r ${PORTSRELEASETAG}
341d9d84e07SJohn Baldwin.endif
342d9d84e07SJohn Baldwin
34300a7eeebSRuslan ErmilovWORLDDIR?=	${.CURDIR}/..
34400a7eeebSRuslan Ermilov
345dba36bb9SRuslan Ermilovrelease rerelease:
346574c2247SJordan K. Hubbard.if !defined(CHROOTDIR) || !defined(BUILDNAME) || !defined(CVSROOT)
347574c2247SJordan K. Hubbard	@echo "To make a release you must set CHROOTDIR, BUILDNAME and CVSROOT" && false
3487eb11201SPoul-Henning Kamp.endif
349dd1a1b3dSJoerg Wunsch.if defined(NOPORTSATALL) && !defined(NODOC)
350d191a99cSJohn Baldwin	@echo "Ports are required for building the docs.  Either set NODOC or"
351dd1a1b3dSJoerg Wunsch	@echo "unset NOPORTS, or set at least DOMINIMALDOCPORTS to YES!"
352d191a99cSJohn Baldwin	@exit 1
353d191a99cSJohn Baldwin.endif
354db8714afSJohn Baldwin.if defined(LOCAL_PATCHES) && !empty(LOCAL_PATCHES)
355db8714afSJohn Baldwin.for p in ${LOCAL_PATCHES}
356db8714afSJohn Baldwin.if !exists(${p})
357db8714afSJohn Baldwin	@echo "The patch file ${p} does not exist!"
358db8714afSJohn Baldwin	@exit 1
359db8714afSJohn Baldwin.endif
360db8714afSJohn Baldwin.endfor
361db8714afSJohn Baldwin.endif
362db8714afSJohn Baldwin.if defined(LOCAL_SCRIPT) && !exists(${LOCAL_SCRIPT})
363db8714afSJohn Baldwin	@echo "The local script ${LOCAL_SCRIPT} does not exist!"
364db8714afSJohn Baldwin	@exit 1
365db8714afSJohn Baldwin.endif
366288fe4dbSPoul-Henning Kamp.if make(release)
367682078bdSRodney W. Grimes.if exists(${CHROOTDIR})
36872ac7e4dSJohn Polstra# The first command will fail on a handful of files that have their schg
36972ac7e4dSJohn Polstra# flags set.  But it greatly speeds up the next two commands.
37037c38153SRuslan Ermilov	# NB: clear any vestigial devfs mount, just in case
3716ceb41c2SSam Leffler	-umount ${CHROOTDIR}/dev > /dev/null 2>&1
37227b5e4fdSJordan K. Hubbard	-rm -rf ${CHROOTDIR} 2>/dev/null
37337966461SRuslan Ermilov	-chflags -R 0 ${CHROOTDIR}/.
374b7738481SJoerg Wunsch	-rm -rf ${CHROOTDIR}
375682078bdSRodney W. Grimes.endif
376335d64e6SJordan K. Hubbard	mkdir -p ${CHROOTDIR}
377b1a8a181SRuslan Ermilov	@echo ">>> make release for ${TARGET} started on `LC_ALL=C TZ=GMT date`"
3785740a2b6SRuslan Ermilov	cd ${WORLDDIR} && ${NATIVEMAKE} -DWITHOUT_GAMES -DWITHOUT_HTML -DWITHOUT_LIB32 \
3795740a2b6SRuslan Ermilov	    -DWITHOUT_MAN -DWITHOUT_NLS -DWITHOUT_PROFILE installworld DESTDIR=${CHROOTDIR}
3803b090ef7SJohn Baldwin	cd ${WORLDDIR} && ${NATIVEMAKE} distribution DESTDIR=${CHROOTDIR}
3818e8d540fSSADA Kenji	if [ -f /etc/resolv.conf ]; then \
3828e8d540fSSADA Kenji		cp -p /etc/resolv.conf ${CHROOTDIR}/etc; \
3838e8d540fSSADA Kenji	fi
384d101bd64SYoshihiro Takahashi.if defined(EXTLOCALDIR)
385d101bd64SYoshihiro Takahashi	rm -rf ${CHROOTDIR}/usr/local
386a4b4ec99SJuli Mallett	cd ${CHROOTDIR}/usr && cp -R -H ${EXTLOCALDIR} local
387d101bd64SYoshihiro Takahashi.endif
388d9d84e07SJohn Baldwin	rm -rf ${CHROOTDIR}/usr/src
389d9d84e07SJohn Baldwin.if defined(EXTSRCDIR)
390d9d84e07SJohn Baldwin	cd ${CHROOTDIR}/usr && \
391a4b4ec99SJuli Mallett	    cp -R -H ${EXTSRCDIR} src
392bd668f6fSPoul-Henning Kamp.else
393d9d84e07SJohn Baldwin	cd ${CHROOTDIR}/usr && \
394b34a415eSDavid E. O'Brien	    ${CVSPREFIX} cvs -R ${CVSARGS} -d ${CVSROOT} \
395b34a415eSDavid E. O'Brien	    co ${CVSCMDARGS} ${CVS_SRCARGS} ${RELEASESRCMODULE}
396288fe4dbSPoul-Henning Kamp.endif
3979c758be2SRuslan Ermilov.if defined(LOCAL_PATCHES) && !empty(LOCAL_PATCHES)
3989c758be2SRuslan Ermilov.for p in ${LOCAL_PATCHES}
3998a34b67aSJun Kuriyama	patch -d ${CHROOTDIR}/usr/${RELEASESRCMODULE} ${PATCH_FLAGS} < ${p}
4009c758be2SRuslan Ermilov.endfor
40162bb2153SPaul Traina.endif
402db8714afSJohn Baldwin.if defined(LOCAL_SCRIPT)
403b34a415eSDavid E. O'Brien	cd ${CHROOTDIR} && env CHROOTDIR=${CHROOTDIR} BUILDNAME=${BUILDNAME} \
404b34a415eSDavid E. O'Brien	    RELEASETAG=${RELEASETAG} ${LOCAL_SCRIPT}
40548f1b394SJordan K. Hubbard.endif
406d9d84e07SJohn Baldwin	rm -rf ${CHROOTDIR}/usr/ports
407d9d84e07SJohn Baldwin.if !defined(NOPORTSATALL)
408fcb9ab1eSYoshihiro Takahashi.if defined(EXTPORTSDIR)
409fcb9ab1eSYoshihiro Takahashi	cd ${CHROOTDIR}/usr && cp -R -H ${EXTPORTSDIR} ports
410fcb9ab1eSYoshihiro Takahashi	# If there are distfiles downloaded removing them
411fcb9ab1eSYoshihiro Takahashi	rm -rf ports/distfiles/*
412fcb9ab1eSYoshihiro Takahashi.else
413b34a415eSDavid E. O'Brien	cd ${CHROOTDIR}/usr && ${CVSPREFIX} cvs -R ${CVSARGS} -d ${CVSROOT} \
414b34a415eSDavid E. O'Brien	    co ${CVSCMDARGS} ${CVS_PORTSARGS} ${RELEASEPORTSMODULE}
415d9d84e07SJohn Baldwin.endif
416fcb9ab1eSYoshihiro Takahashi.endif
417aeb6d603SJordan K. Hubbard.if !defined(NODOC)
418d9d84e07SJohn Baldwin	rm -rf ${CHROOTDIR}/usr/doc
419d9d84e07SJohn Baldwin.if defined(EXTDOCDIR)
420a4b4ec99SJuli Mallett	cd ${CHROOTDIR}/usr && cp -R -H ${EXTDOCDIR} doc
4213f17d264SSatoshi Asami.else
422b34a415eSDavid E. O'Brien	cd ${CHROOTDIR}/usr && ${CVSPREFIX} cvs -R ${CVSARGS} -d ${CVSROOT} \
423b34a415eSDavid E. O'Brien	    co ${CVSCMDARGS} ${CVS_DOCARGS} ${RELEASEDOCMODULE}
4243f17d264SSatoshi Asami.endif
42540227c90SMakoto Matsushita	if [ -d ${RELEASEDISTFILES}/ ]; then \
42640227c90SMakoto Matsushita		cp -rp ${RELEASEDISTFILES} ${CHROOTDIR}/usr/ports/distfiles; \
427b389e7aaSMakoto Matsushita	else \
428d7c4abbfSMakoto Matsushita		mkdir -p ${CHROOTDIR}/usr/ports/distfiles; \
4298e8d540fSSADA Kenji	fi
4303ea0ca53SDavid E. O'Brien.if !defined(NO_PREFETCHDISTFILES)
4313ea0ca53SDavid E. O'Brien	@cd ${.CURDIR} && ${MAKE} fetch-distfiles
432bb5e8f3fSJohn Baldwin.endif
433aeb6d603SJordan K. Hubbard.endif
434288fe4dbSPoul-Henning Kamp.endif
435288fe4dbSPoul-Henning Kamp.if make(rerelease)
436e50a1ba2SRuslan Ermilov.if !defined(RELEASENOUPDATE) && !defined(EXTSRCDIR)
437288fe4dbSPoul-Henning Kamp.if !defined(RELEASETAG)
438b34a415eSDavid E. O'Brien	cd ${CHROOTDIR}/usr/src && ${CVSPREFIX} cvs -R ${CVSARGS} -q \
439b34a415eSDavid E. O'Brien	    update ${CVSCMDARGS} -P -d -A
440288fe4dbSPoul-Henning Kamp.else
441b34a415eSDavid E. O'Brien	cd ${CHROOTDIR}/usr/src && ${CVSPREFIX} cvs -R ${CVSARGS} -q \
442b34a415eSDavid E. O'Brien	    update ${CVSCMDARGS} -P -d -r ${RELEASETAG}
443288fe4dbSPoul-Henning Kamp.endif
444b4f72168SRuslan Ermilov	rm -f ${CHROOTDIR}/tmp/.world_done
445fcb9ab1eSYoshihiro Takahashi.if !defined(NOPORTS) && !defined(EXTPORTSDIR)
446b34a415eSDavid E. O'Brien	cd ${CHROOTDIR}/usr/ports && ${CVSPREFIX} cvs -R ${CVSARGS} -q \
447b34a415eSDavid E. O'Brien	    update ${CVSCMDARGS} -P -d
44892f6e2c8SJohn Baldwin	rm -f ${CHROOTDIR}/tmp/.skip_ports_index
4496e5cd2d2SJordan K. Hubbard.endif
450dd1a1b3dSJoerg Wunsch.if defined(DOMINIMALDOCPORTS) && ${DOMINIMALDOCPORTS} == "YES"
451dd1a1b3dSJoerg Wunsch	for i in ${MINIMALDOCPORTS}; do \
452b34a415eSDavid E. O'Brien	    ( cd ${CHROOTDIR}/usr/$$i && ${CVSPREFIX} cvs -R ${CVSARGS} -q \
453b34a415eSDavid E. O'Brien		update ${CVSCMDARGS} -P -d ) ; \
454dd1a1b3dSJoerg Wunsch	done
455dd1a1b3dSJoerg Wunsch.endif
456aeb6d603SJordan K. Hubbard.if !defined(NODOC)
457b34a415eSDavid E. O'Brien	cd ${CHROOTDIR}/usr/doc && ${CVSPREFIX} cvs -R ${CVSARGS} -q \
458b34a415eSDavid E. O'Brien	    update ${CVSCMDARGS} -P -d
459aeb6d603SJordan K. Hubbard.endif
460288fe4dbSPoul-Henning Kamp.endif
461bd668f6fSPoul-Henning Kamp.endif
4627284556fSJordan K. Hubbard	# Add version information to those things that need it.
463b4f72168SRuslan Ermilov	if [ ! -f ${CHROOTDIR}/tmp/.world_done ]; then \
464b4f72168SRuslan Ermilov		cd ${CHROOTDIR}/usr/src/sys/conf && \
465288fe4dbSPoul-Henning Kamp		mv newvers.sh foo && \
466b4f72168SRuslan Ermilov		sed "s/^RELEASE=.*/RELEASE=${BUILDNAME}/" foo > newvers.sh && \
467b4f72168SRuslan Ermilov		rm foo; \
468b4f72168SRuslan Ermilov	fi
469d4983966SPaul Traina	-test -f install.cfg && cp install.cfg ${CHROOTDIR}/usr/src/release
4700febff82SDavid E. O'Brien	echo "#!/bin/sh"			> ${_MK}
4710febff82SDavid E. O'Brien	echo "set -ex"				>> ${_MK}
4720febff82SDavid E. O'Brien	echo "trap 'umount /dev || true' 0"	>> ${_MK}
4730febff82SDavid E. O'Brien	echo "_RELTARGET=\$${1:-doRELEASE}"	>> ${_MK}
4747a7a00adSRuslan Ermilov.for var in \
4753e4ac74dSRuslan Ermilov	AUTO_KEYBOARD_DETECT \
4763e4ac74dSRuslan Ermilov	BUILDNAME \
477b2200964SJohn Baldwin	CD_PACKAGE_TREE \
4783e4ac74dSRuslan Ermilov	DISTRIBUTIONS \
4793e4ac74dSRuslan Ermilov	DOC_LANG \
4803e4ac74dSRuslan Ermilov	DOMINIMALDOCPORTS \
4813e4ac74dSRuslan Ermilov	EXTRA_SRC \
48277d79f0cSMakoto Matsushita	FTP_PASSIVE_MODE \
48377d79f0cSMakoto Matsushita	FTP_PROXY \
48477d79f0cSMakoto Matsushita	HTTP_PROXY \
4853e4ac74dSRuslan Ermilov	KERNELS \
486fdb71eeeSSam Leffler	KERNELS_BASE \
4873e4ac74dSRuslan Ermilov	KERNEL_FLAGS \
4882e3a1557SKen Smith	MAKE_DVD \
48994223a53SDavid E. O'Brien	MAKE_FLOPPIES \
4903e4ac74dSRuslan Ermilov	MAKE_ISOS \
4913e4ac74dSRuslan Ermilov	NOCDROM \
4923e4ac74dSRuslan Ermilov	NODOC \
4933e4ac74dSRuslan Ermilov	NOPORTS \
49483c7ade9SRuslan Ermilov	NO_SHARED \
4953e4ac74dSRuslan Ermilov	NOSRC \
4963e4ac74dSRuslan Ermilov	NO_CPU_CFLAGS \
4973e4ac74dSRuslan Ermilov	NO_CPU_COPTFLAGS \
498f0414231SDavid E. O'Brien	NO_FLOPPIES \
4993e4ac74dSRuslan Ermilov	RELEASETAG \
5003e4ac74dSRuslan Ermilov	RELNOTES_LANG \
50192f6e2c8SJohn Baldwin	SEPARATE_LIVEFS \
5023e4ac74dSRuslan Ermilov	TARGET \
5033e4ac74dSRuslan Ermilov	TARGET_ARCH \
5043e4ac74dSRuslan Ermilov	WORLD_FLAGS
5057a7a00adSRuslan Ermilov.if defined(${var})
5060febff82SDavid E. O'Brien	echo "export ${var}=\"${${var}}\""	>> ${_MK}
50746e90709SJoerg Wunsch.endif
5087a7a00adSRuslan Ermilov.endfor
50943276d06SJoerg Wunsch	# Don't remove this, or the build will fall over!
5100febff82SDavid E. O'Brien	echo "export RELEASEDIR=${_R}"		>> ${_MK}
5110febff82SDavid E. O'Brien	echo "export PATH=/bin:/usr/bin:/sbin:/usr/sbin:${LOCALDIR}"	>> ${_MK}
5120febff82SDavid E. O'Brien	echo "export MANBUILDCAT=YES"		>> ${_MK}
5136ceb41c2SSam Leffler	# NB: these may fail if the host is running w/o devfs
5140febff82SDavid E. O'Brien	echo "umount /dev >/dev/null 2>&1 || true" >> ${_MK}
5150febff82SDavid E. O'Brien	echo "mount -t devfs devfs /dev >/dev/null 2>&1 || true"	>> ${_MK}
5164963cb93SRuslan Ermilov	echo "if [ ! -c /dev/null ]; then" >> ${_MK}
5174963cb93SRuslan Ermilov	echo "	echo /dev/null is not a device!" >> ${_MK}
5184963cb93SRuslan Ermilov	echo "	exit 1" >> ${_MK}
5194963cb93SRuslan Ermilov	echo "fi" >> ${_MK}
520d9aeaacbSMakoto Matsushita	echo "if [ -x /etc/rc.d/ldconfig ]; then" >> ${_MK}
521ab0a016cSYoshihiro Takahashi	echo "	/etc/rc.d/ldconfig start"	>> ${_MK}
522d9aeaacbSMakoto Matsushita	echo "else"				>> ${_MK}
523d9aeaacbSMakoto Matsushita	echo "	ldconfig /lib /usr/lib /usr/local/lib || true" >> ${_MK}
524d9aeaacbSMakoto Matsushita	echo "fi"				>> ${_MK}
5250febff82SDavid E. O'Brien	echo "if [ ! -f /tmp/.world_done ]; then" >> ${_MK}
5260febff82SDavid E. O'Brien	echo "	cd /usr/src"			>> ${_MK}
527f45a5bbdSRuslan Ermilov	echo "	${CROSSMAKE} ${WORLD_FLAGS} -DNO_CLEAN buildworld && \\" >> ${_MK}
528ab5e8655SBrian Somers	echo "	touch /tmp/.world_done || exit 1" >> ${_MK}
5290febff82SDavid E. O'Brien	echo "fi"				>> ${_MK}
530485b9268SKen Smith	echo "if [ ! -f /tmp/.skip_ports_index ]; then" >> ${_MK}
531485b9268SKen Smith	echo "	echo \">>> make index started on \`LC_ALL=C TZ=GMT date\`\"" >> ${_MK}
532485b9268SKen Smith	echo "	for i in ${MAKEINDEXPORTS}"	>> ${_MK}
533485b9268SKen Smith	echo "	do"			>> ${_MK}
534485b9268SKen Smith	echo "		cd /usr/ports/\$${i}"	>> ${_MK}
535485b9268SKen Smith	echo "		env -i FTP_PASSIVE_MODE=$${FTP_PASSIVE_MODE:-no} PATH=$${PATH} \\" >> ${_MK}
536485b9268SKen Smith	echo "		make all install clean BATCH=yes FORCE_PKG_REGISTER=yes" >> ${_MK}
537485b9268SKen Smith	echo "	done"				>> ${_MK}
538485b9268SKen Smith	echo "	cd /usr/ports"			>> ${_MK}
539485b9268SKen Smith	echo "	rm -f INDEX*"			>> ${_MK}
540485b9268SKen Smith	echo "	make index -DINDEX_PRISTINE"	>> ${_MK}
54188f69650SKen Smith	echo "	rm -f INDEX*.tmp"		>> ${_MK}
542485b9268SKen Smith	echo "	touch /tmp/.skip_ports_index"	>> ${_MK}
543485b9268SKen Smith	echo "	echo \">>> make index finished on \`LC_ALL=C TZ=GMT date\`\"" >> ${_MK}
544485b9268SKen Smith	echo "fi"				>> ${_MK}
5450febff82SDavid E. O'Brien	echo "cd /usr/src/release"		>> ${_MK}
5460febff82SDavid E. O'Brien	echo "make obj"				>> ${_MK}
5470febff82SDavid E. O'Brien	echo "make \$${_RELTARGET}"		>> ${_MK}
5480febff82SDavid E. O'Brien	echo "echo \">>> make ${.TARGET} for ${TARGET} finished on \`LC_ALL=C TZ=GMT date\`\"" >> ${_MK}
5490febff82SDavid E. O'Brien	chmod 755 ${_MK}
550485b9268SKen Smith.if defined(NOPORTS)
551485b9268SKen Smith	touch ${CHROOTDIR}/tmp/.skip_ports_index
552485b9268SKen Smith.endif
553b34a415eSDavid E. O'Brien	# Ensure md.ko is loaded if md(4) is not statically compiled into
554b34a415eSDavid E. O'Brien	# the kernel
5555262ab24SDavid E. O'Brien	-mdconfig 2>/dev/null
5565bff5851SDavid E. O'Brien	env -i /usr/sbin/chroot `dirname ${_MK}` /`basename ${_MK}`
55720e5d523SJordan K. Hubbard
558bd668f6fSPoul-Henning Kampclean:
5597b07d01fSRuslan Ermilov	rm -rf ${CRUNCH_TARGETS:S/$/_crunch/} release.[0-8] ${EXTRAS}
560bd668f6fSPoul-Henning Kamp
5613ea0ca53SDavid E. O'Brienfetch-distfiles:
562485b9268SKen Smith	@for i in ${MAKEINDEXPORTS}; do \
563485b9268SKen Smith		cd ${CHROOTDIR}/usr/ports/$$i && \
564485b9268SKen Smith			make PORTSDIR=${CHROOTDIR}/usr/ports BATCH=yes \
565485b9268SKen Smith			checksum-recursive ; \
566485b9268SKen Smith	done
5673ea0ca53SDavid E. O'Brien	@for i in ${DOCPORTS}; do \
5683ea0ca53SDavid E. O'Brien		cd ${CHROOTDIR}/usr/ports/$$i && \
5693ea0ca53SDavid E. O'Brien			make PORTSDIR=${CHROOTDIR}/usr/ports BATCH=yes \
5703ea0ca53SDavid E. O'Brien			WITHOUT_X11=yes JADETEX=no WITHOUT_PYTHON=yes \
5713ea0ca53SDavid E. O'Brien			checksum-recursive ; \
5723ea0ca53SDavid E. O'Brien	done
5733ea0ca53SDavid E. O'Brien
574335d64e6SJordan K. Hubbard# Clean out ${_R} and make the directory structure.
575bd668f6fSPoul-Henning Kamprelease.1:
576335d64e6SJordan K. Hubbard	mkdir -p ${_R}
577cd8d8dacSJordan K. Hubbard	-rm -rf ${_R}/* 2> /dev/null
578335d64e6SJordan K. Hubbard	-chflags -R noschg ${_R}/.
579335d64e6SJordan K. Hubbard	rm -rf ${_R}/*
580bd668f6fSPoul-Henning Kamp	mkdir ${RD}
58194223a53SDavid E. O'Brien.if defined(MAKE_FLOPPIES)
582bd668f6fSPoul-Henning Kamp	mkdir ${RD}/floppies
5831dae6ea9SRuslan Ermilov.endif
584e12c4355SPoul-Henning Kamp	mkdir ${RD}/trees
585d943f83bSJohn Baldwin	for i in ${DISTRIBUTIONS}; do \
586288fe4dbSPoul-Henning Kamp		mkdir ${RD}/trees/$$i && \
58711017a68SMarcel Moolenaar		mtree -deU -f ${MTREEFILES}/BSD.root.dist \
588288fe4dbSPoul-Henning Kamp		    -p ${RD}/trees/$$i > /dev/null && \
58911017a68SMarcel Moolenaar		mtree -deU -f ${MTREEFILES}/BSD.usr.dist \
590288fe4dbSPoul-Henning Kamp		    -p ${RD}/trees/$$i/usr > /dev/null && \
59111017a68SMarcel Moolenaar		mtree -deU -f ${MTREEFILES}/BSD.include.dist \
592288fe4dbSPoul-Henning Kamp		    -p ${RD}/trees/$$i/usr/include > /dev/null && \
59311017a68SMarcel Moolenaar		mtree -deU -f ${MTREEFILES}/BSD.var.dist \
594e12c4355SPoul-Henning Kamp		    -p ${RD}/trees/$$i/var > /dev/null ; \
59548327bc9SPoul-Henning Kamp	done
5969fe7600bSSam Leffler	mkdir ${RD}/kernels
597fdb71eeeSSam Leffler	for i in ${KERNELS_BASE} ${KERNELS}; do \
598fdb71eeeSSam Leffler		mkdir -p ${RD}/kernels/$${i}; \
5999fe7600bSSam Leffler	done
600d3c93cefSRuslan Ermilov	touch ${.TARGET}
6017f986648SPoul-Henning Kamp
602bd668f6fSPoul-Henning Kamp# Install the system into the various distributions.
603bd668f6fSPoul-Henning Kamprelease.2:
60495dc12e1SRuslan Ermilov	cd ${.CURDIR}/.. && ${CROSSMAKE} distrib-dirs DESTDIR=${RD}/trees/base
605d885836cSRuslan Ermilov	cd ${.CURDIR}/.. && ${CROSSMAKE} ${WORLD_FLAGS} distributeworld \
606d885836cSRuslan Ermilov	    DISTDIR=${RD}/trees
607d3c93cefSRuslan Ermilov	touch ${.TARGET}
608ff85b6e3SRuslan Ermilov
60997febce7SJoerg Wunsch# Make and install the generic kernel(s).
6105355286aSColin Percivalrelease.3:
611fdb71eeeSSam Leffler.for kernel in ${KERNELS_BASE} ${KERNELS}
6126bde859fSRuslan Ermilov	cd ${.CURDIR}/..; \
61374064f9fSRuslan Ermilov	${CROSSMAKE} ${KERNEL_FLAGS} \
6149fe7600bSSam Leffler 	    KERNCONF=${kernel} kernel \
6159fe7600bSSam Leffler 	    DESTDIR=${RD}/kernels KODIR=/${kernel}
6169fe7600bSSam Leffler.endfor
617d3c93cefSRuslan Ermilov	touch ${.TARGET}
618bd668f6fSPoul-Henning Kamp
61901feef2cSPoul-Henning Kamp# Make and install the three crunched binaries which live on the floppies.
620bd668f6fSPoul-Henning Kamp# You are not supposed to like this :-)
6215355286aSColin Percivalrelease.4:
622518a1d34SPoul-Henning Kamp	rm -rf ${RD}/crunch
623518a1d34SPoul-Henning Kamp	mkdir -p ${RD}/crunch
62458888af3SRuslan Ermilov.for j in ${CRUNCH_TARGETS}
6253cd22041SRuslan Ermilov.if exists(${.CURDIR}/${TARGET}/${j}_crunch.conf)
62658888af3SRuslan Ermilov	rm -rf ${j}_crunch
62758888af3SRuslan Ermilov	mkdir ${j}_crunch
62895dc12e1SRuslan Ermilov	cd ${j}_crunch; ${WMAKEENV} MAKEFLAGS="-m ${.CURDIR}/../share/mk" \
6295876d743SKen Smith	    NO_WERROR= crunchgen -o \
630b34a415eSDavid E. O'Brien	    ${.CURDIR}/${TARGET}/${j}_crunch.conf
63158888af3SRuslan Ermilov	cd ${j}_crunch; ${WMAKE} -f ${j}_crunch.mk subclean
632eedbbe40SRuslan Ermilov	cd ${.CURDIR}/..; ${BINMAKE} -f Makefile.inc1 _build-tools
6339090f0c2SMarcel Moolenaar	cd ${j}_crunch; CFLAGS="-Os -pipe" ${WMAKE} -f ${j}_crunch.mk \
6349090f0c2SMarcel Moolenaar	    -DNO_CPU_CFLAGS all
63555ee3f14SRuslan Ermilov	${WMAKEENV} strip -R .comment ${j}_crunch/${j}_crunch
63658888af3SRuslan Ermilov	mv ${j}_crunch/${j}_crunch ${RD}/crunch/${j}
6373cd22041SRuslan Ermilov.endif
63858888af3SRuslan Ermilov.endfor
639d3c93cefSRuslan Ermilov	touch ${.TARGET}
640bd668f6fSPoul-Henning Kamp
64130e8b491SPoul-Henning Kamp#
64230e8b491SPoul-Henning Kamp# --==## Fix up the distributions. ##==--
64330e8b491SPoul-Henning Kamp#
6445355286aSColin Percivalrelease.5:
6457284556fSJordan K. Hubbard	# Create any "synthetic dists" now.
6467284556fSJordan K. Hubbard	@for i in ${DISTRIBUTIONS}; do \
6477284556fSJordan K. Hubbard		if [ -f ${.CURDIR}/scripts/$${i}-make.sh ]; then \
6487284556fSJordan K. Hubbard			echo -n "Running $$i dist creation script... "; \
64966422f5bSPeter Wemm			env RD=${RD} sh ${.CURDIR}/scripts/$${i}-make.sh || echo "$$i distribution script returned bad status."; \
65058183fc7SJordan K. Hubbard			echo "Done."; \
6517284556fSJordan K. Hubbard		fi \
6527284556fSJordan K. Hubbard	done \
6537284556fSJordan K. Hubbard
65430e8b491SPoul-Henning Kamp	# Remove all the directories we don't need.
65527d44115SPoul-Henning Kamp	-cd ${RD}/trees && \
656ece6831dSRuslan Ermilov		(find ${OTHER_DISTS} -path '*/var/empty' | xargs chflags noschg; \
657c5897626SColin Percival		find ${OTHER_DISTS} -depth -type d -empty -print | xargs rmdir)
658d3c93cefSRuslan Ermilov	touch ${.TARGET}
659f14786ddSJordan K. Hubbard
66030e8b491SPoul-Henning Kamp#
6617284556fSJordan K. Hubbard# --==## Package up the tarballs from assembled trees ##==--
66230e8b491SPoul-Henning Kamp#
6635355286aSColin Percivalrelease.6:
66495e34bfcSJordan K. Hubbard	rm -rf ${RD}/dists
66595e34bfcSJordan K. Hubbard	mkdir -p ${RD}/dists
66695e34bfcSJordan K. Hubbard	@for i in ${DISTRIBUTIONS} ; \
66795e34bfcSJordan K. Hubbard	do \
66895e34bfcSJordan K. Hubbard		if [ -d ${RD}/trees/$${i} ] ; then \
66930e8b491SPoul-Henning Kamp			cd ${.CURDIR} && $(MAKE) doTARBALL \
67030e8b491SPoul-Henning Kamp				SD=${RD}/trees/$${i} \
671288fe4dbSPoul-Henning Kamp				TN=$$i TD=$$i ARG="." && \
67295e34bfcSJordan K. Hubbard			echo "$${i} distribution is finished."; \
67395e34bfcSJordan K. Hubbard		fi ; \
67495e34bfcSJordan K. Hubbard	done
675fdb71eeeSSam Leffler	@for i in ${KERNELS_BASE} ${KERNELS} ; \
6769fe7600bSSam Leffler	do \
6779fe7600bSSam Leffler		if [ -d ${RD}/kernels/$${i} ] ; then \
6789fe7600bSSam Leffler			cd ${.CURDIR} && $(MAKE) doTARBALL \
6799fe7600bSSam Leffler				SD=${RD}/kernels \
6809fe7600bSSam Leffler				TN=$$i TD=kernels ARG="$$i" && \
6819fe7600bSSam Leffler			echo "$${i} distribution is finished."; \
6829fe7600bSSam Leffler		fi ; \
6839fe7600bSSam Leffler	done
6846daa108fSRuslan Ermilov.if !defined(NOPORTS)
6856daa108fSRuslan Ermilov	# XXX: Inline stripped version of doTARBALL
6866daa108fSRuslan Ermilov	@rm -rf ${RD}/dists/ports/ports*
6876daa108fSRuslan Ermilov	@mkdir -p ${RD}/dists/ports
6886daa108fSRuslan Ermilov	@echo rolling ports/ports tarball
689042df2e2SRuslan Ermilov	@tar --exclude CVS --exclude .svn --exclude 'ports/distfiles/*' \
69092f6e2c8SJohn Baldwin	  -czf ${RD}/dists/ports/ports.tgz -C /usr ports
6916daa108fSRuslan Ermilov	@cp ${.CURDIR}/scripts/ports-install.sh ${RD}/dists/ports/install.sh
6926daa108fSRuslan Ermilov	@(cd ${RD}/dists/ports; \
6934a457aa6SHiroki Sato	  rm -f CHECKSUM.MD5 CHECKSUM.SHA256; \
6940f12c50eSKen Smith	  md5 * > .CHECKSUM.MD5; \
6954a457aa6SHiroki Sato	  sha256 * > .CHECKSUM.SHA256; \
6964a457aa6SHiroki Sato	  mv .CHECKSUM.MD5 CHECKSUM.MD5; \
6974a457aa6SHiroki Sato	  mv .CHECKSUM.SHA256 CHECKSUM.SHA256)
6986daa108fSRuslan Ermilov	@echo "ports distribution is finished."
6996daa108fSRuslan Ermilov.endif
700d3c93cefSRuslan Ermilov	touch ${.TARGET}
70195e34bfcSJordan K. Hubbard
70295e34bfcSJordan K. Hubbard
70330e8b491SPoul-Henning Kamp#
70430e8b491SPoul-Henning Kamp# --==## Make source dists ##==--
70530e8b491SPoul-Henning Kamp#
7065355286aSColin Percivalrelease.7:
7074731faa3SJordan K. Hubbard.if !defined(NOSRC)
708288fe4dbSPoul-Henning Kamp	@cd ${.CURDIR} && $(MAKE) doTARBALL SD=/usr/src \
70995e34bfcSJordan K. Hubbard		TD=src TN=sbase ARG="[A-Z]*"
710fb29e2cfSJordan K. Hubbard	@for i in `cd /usr/src && echo [a-z]*` ; do \
71130e8b491SPoul-Henning Kamp		if [ -d /usr/src/$$i ] ; then \
71230e8b491SPoul-Henning Kamp			cd ${.CURDIR} && $(MAKE) doTARBALL \
713470f825fSJordan K. Hubbard				TN=`echo s$$i | tr -d '.' | \
714470f825fSJordan K. Hubbard				    sed -e 's/usr/u/' \
715470f825fSJordan K. Hubbard					-e 's/kerberos5/krb5/'` \
71630e8b491SPoul-Henning Kamp				SD=/usr/src TD=src ARG="$$i" ; \
71795e34bfcSJordan K. Hubbard		fi ; \
71895e34bfcSJordan K. Hubbard	done
71940b0c0d9SPeter Wemm.if defined(EXTRA_SRC)
720288fe4dbSPoul-Henning Kamp	@set ${EXTRA_SRC} && \
72140b0c0d9SPeter Wemm	while [ $$# -ge 2 ] ; do \
72230e8b491SPoul-Henning Kamp		if [ -d /usr/src/$$1 ] ; then \
72330e8b491SPoul-Henning Kamp			cd ${.CURDIR} && $(MAKE) doTARBALL \
72430e8b491SPoul-Henning Kamp				SD=/usr/src TN="s$$2" TD=src ARG="$$1" ; \
72530e8b491SPoul-Henning Kamp		fi && shift && shift ; \
72640b0c0d9SPeter Wemm	done
72740b0c0d9SPeter Wemm.endif
7280f12c50eSKen Smith	(cd ${RD}/dists/src; \
7294a457aa6SHiroki Sato	  rm -f CHECKSUM.MD5 CHECKSUM.SHA256; \
7300f12c50eSKen Smith	  md5 * > .CHECKSUM.MD5; \
7314a457aa6SHiroki Sato	  sha256 * > .CHECKSUM.SHA256; \
7324a457aa6SHiroki Sato	  mv .CHECKSUM.MD5 CHECKSUM.MD5; \
7334a457aa6SHiroki Sato	  mv .CHECKSUM.SHA256 CHECKSUM.SHA256)
73495e34bfcSJordan K. Hubbard	@echo "src distribution is finished."
7354731faa3SJordan K. Hubbard.endif
736d3c93cefSRuslan Ermilov	touch ${.TARGET}
73795e34bfcSJordan K. Hubbard
738c0731f81SJohn Baldwin# Build the memory root filesystem.
7395355286aSColin Percivalrelease.8:
74055852204SRuslan Ermilov	cp ${RD}/trees/base/etc/disktab /etc
741409f9329SJordan K. Hubbard	rm -rf ${RD}/mfsfd
742409f9329SJordan K. Hubbard	mkdir ${RD}/mfsfd
743409f9329SJordan K. Hubbard	cd ${RD}/mfsfd && \
74409104034SScott Long		mkdir -p etc/defaults dev mnt stand/etc/defaults stand/help \
74509104034SScott Long		var/empty
7463df0e2afSPoul-Henning Kamp	@cd ${.CURDIR} && $(MAKE) installCRUNCH CRUNCH=boot \
747a91fd119SPoul-Henning Kamp		DIR=${RD}/mfsfd/stand ZIP=false
748dc2475c5SJohn Baldwin	( cd ${RD}/mfsfd && \
749dc2475c5SJohn Baldwin	  for dir in bin sbin ; do \
750dc2475c5SJohn Baldwin		ln -sf /stand $$dir; \
751dc2475c5SJohn Baldwin	  done )
7523cb04a4dSRuslan Ermilov	cp ${RD}/trees/base/sbin/dhclient-script ${RD}/mfsfd/stand
75309104034SScott Long	cp ${.CURDIR}/../etc/master.passwd ${RD}/mfsfd/etc/master.passwd
754f9b5f9c1SRuslan Ermilov	cp ${RD}/trees/base/etc/*pwd.db ${RD}/mfsfd/etc/
755d3b19355SRuslan Ermilov	( for F in defaults/rc.conf netconfig protocols ; do \
75664dc0a3eSDavid E. O'Brien		sed -e '/^#.*$$/d' -e 's/[:space:]*#.*$$//g' \
75701df2ec3SDavid E. O'Brien		${RD}/trees/base/etc/$$F > ${RD}/mfsfd/stand/etc/$$F ; \
75864dc0a3eSDavid E. O'Brien	  done )
759a191fd1bSAlfred Perlstein	grep -E '^(ftp|nameserver|domain|sunrpc|cmd|nfsd)[^-\w]' \
7606bde859fSRuslan Ermilov	    ${RD}/trees/base/etc/services | \
76164dc0a3eSDavid E. O'Brien	    sed -e '/^#.*$$/d' -e 's/[:space:]*#.*$$//g' \
76264dc0a3eSDavid E. O'Brien	    > ${RD}/mfsfd/stand/etc/services
763bc5ffda6SJun Kuriyama	grep 'operator' ${RD}/trees/base/etc/group \
764bc5ffda6SJun Kuriyama	    > ${RD}/mfsfd/stand/etc/group
765a191fd1bSAlfred Perlstein	ln ${RD}/mfsfd/stand/etc/services ${RD}/mfsfd/etc/services
766bc5ffda6SJun Kuriyama	ln ${RD}/mfsfd/stand/etc/group ${RD}/mfsfd/etc/group
767a191fd1bSAlfred Perlstein	ln ${RD}/mfsfd/stand/etc/netconfig ${RD}/mfsfd/etc/netconfig
768407ac59aSJohn Hay	cp ${RD}/trees/base/COPYRIGHT ${RD}/mfsfd/stand/help/COPYRIGHT.hlp
76921203b38SBruce A. Mah.if !defined(NODOC)
7708ed3802bSBruce A. Mah	@for i in ${DIST_DOCS_ARCH_INDEP}; do \
771b34a415eSDavid E. O'Brien	  cp ${RND}/${RELNOTES_LANG}/$$i/article.txt \
772b34a415eSDavid E. O'Brien	      ${RD}/mfsfd/stand/help/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
7738ed3802bSBruce A. Mah	done
7748ed3802bSBruce A. Mah	@for i in ${DIST_DOCS_ARCH_DEP}; do \
775b34a415eSDavid E. O'Brien	  cp ${RND}/${RELNOTES_LANG}/$$i/${TARGET}/article.txt \
776b34a415eSDavid E. O'Brien	      ${RD}/mfsfd/stand/help/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
7778ed3802bSBruce A. Mah	done
7788ed3802bSBruce A. Mah.endif
779b34a415eSDavid E. O'Brien	-test -f ${.CURDIR}/install.cfg \
780b34a415eSDavid E. O'Brien	    && cp ${.CURDIR}/install.cfg ${RD}/mfsfd
78171696ba3SJordan K. Hubbard	@mkdir -p ${RD}/mfsfd/boot
782fa7bd283SPeter Grehan.if ${TARGET_ARCH} != "ia64" && ${TARGET_ARCH} != "powerpc"
7836bde859fSRuslan Ermilov	@cp ${RD}/trees/base/boot/boot* ${RD}/mfsfd/boot
784710d4ca3SMarcel Moolenaar.endif
785c07665ebSPeter Wemm.if ${TARGET} == "i386" || ${TARGET_ARCH} == "amd64"
7866bde859fSRuslan Ermilov	@cp ${RD}/trees/base/boot/mbr ${RD}/mfsfd/boot
787c06157d4SRuslan Ermilov.endif
788042df2e2SRuslan Ermilov	@tar --exclude CVS --exclude .svn -cf - \
789042df2e2SRuslan Ermilov		-C ${.CURDIR}/../usr.sbin/sysinstall help | \
79092e86f99SJordan K. Hubbard		tar xf - -C ${RD}/mfsfd/stand
7916daa108fSRuslan Ermilov	@mkdir -p ${RD}/mfsroot
7928bf7ab35SRuslan Ermilov	sh -e ${DOFS_SH} ${RD}/mfsroot/mfsroot ${RD} ${MNT} \
7933d610ec8SRuslan Ermilov	    ${MFSSIZE} ${RD}/mfsfd ${MFSINODE} ${MFSLABEL}
794569acadfSDavid E. O'Brien	@${ZIPPER} -fv ${RD}/mfsroot/mfsroot
7953d610ec8SRuslan Ermilov	touch ${.TARGET}
7963d610ec8SRuslan Ermilov
797c0731f81SJohn BaldwinKERNFLOPPYSET=		${RD}/floppyset/kern/kernel.gz
798c0731f81SJohn Baldwin.if defined(SMALLFLOPPYSIZE)
799c0731f81SJohn BaldwinSMALLKERNFLOPPYSET=	${RD}/floppyset/kern-small/kernel.gz
800319f35a3SRuslan Ermilov.endif
801c0731f81SJohn Baldwin.if defined(SPLIT_MFSROOT)
802c0731f81SJohn BaldwinMFSROOTFLOPPYSET=	${RD}/floppyset/mfsroot/mfsroot.gz
803c0731f81SJohn Baldwin.if defined(SMALLFLOPPYSIZE)
804c0731f81SJohn BaldwinSMALLMFSROOTFLOPPYSET=	${RD}/floppyset/mfsroot-small/mfsroot.gz
805c26d9e5aSJake Burkholder.endif
8064a2d414fSRuslan Ermilov.endif
807c0731f81SJohn Baldwin
808c0731f81SJohn Baldwin# Build boot and install floppies.
809c0731f81SJohn Baldwinfloppies.1:
810569acadfSDavid E. O'Brien	@${ZIPPER} -c ${RD}/kernels/GENERIC/kernel > ${RD}/kernels/kernel.gz
811c0731f81SJohn Baldwin	@echo "Making the kernel boot floppies..."
812c0731f81SJohn Baldwin	@cd ${.CURDIR} && ${MAKE} makeFloppySet FLOPPYBASE=kern \
813c0731f81SJohn Baldwin	    FLOPPYDESC="Kernel" SPLITFILE=${RD}/kernels/kernel.gz
814c0731f81SJohn Baldwin.if defined(SMALLFLOPPYSIZE)
815c0731f81SJohn Baldwin	@echo "Making the small kernel boot floppies..."
816c0731f81SJohn Baldwin	@cd ${.CURDIR} && ${MAKE} makeFloppySet FLOPPYBASE=kern-small \
817c0731f81SJohn Baldwin	    FLOPPYDESC="Kernel" SPLITFILE=${RD}/kernels/kernel.gz \
818c0731f81SJohn Baldwin	    FDSIZE="SMALL"
819a40915d7SYoshihiro Takahashi.endif
820c0731f81SJohn Baldwin.if defined(SPLIT_MFSROOT)
821c0731f81SJohn Baldwin	@echo "Making the mfsroot boot floppies..."
822c0731f81SJohn Baldwin	@cd ${.CURDIR} && ${MAKE} makeFloppySet FLOPPYBASE=mfsroot \
823c0731f81SJohn Baldwin	    FLOPPYDESC="Memory Filesystem" SPLITFILE=${RD}/mfsroot/mfsroot.gz
824c0731f81SJohn Baldwin.if defined(SMALLFLOPPYSIZE)
825c0731f81SJohn Baldwin	@echo "Making the small mfsroot boot floppies..."
826c0731f81SJohn Baldwin	@cd ${.CURDIR} && ${MAKE} makeFloppySet FLOPPYBASE=mfsroot-small \
827c0731f81SJohn Baldwin	    FLOPPYDESC="Memory Filesystem" SPLITFILE=${RD}/mfsroot/mfsroot.gz \
828c0731f81SJohn Baldwin	    FDSIZE="SMALL"
829c0731f81SJohn Baldwin.endif
830c0731f81SJohn Baldwin	@cd ${.CURDIR} && ${MAKE} buildBootFloppy FSIMAGE="boot" \
831c0731f81SJohn Baldwin	    KERNFILE="${KERNFLOPPYSET}.split ${KERNFLOPPYSET}.boot" \
832c0731f81SJohn Baldwin	    MFSROOTFILE="${MFSROOTFLOPPYSET}.split ${MFSROOTFLOPPYSET}.boot"
833c0731f81SJohn Baldwin.if defined(SMALLFLOPPYSIZE)
8346ab88893SYoshihiro Takahashi	@cd ${.CURDIR} && ${MAKE} buildBootFloppy FSIMAGE="boot-small" \
835c0731f81SJohn Baldwin	    KERNFILE="${SMALLKERNFLOPPYSET}.split ${SMALLKERNFLOPPYSET}.boot" \
836c0731f81SJohn Baldwin	    MFSROOTFILE="${SMALLMFSROOTFLOPPYSET}.split ${SMALLMFSROOTFLOPPYSET}.boot" \
837c0731f81SJohn Baldwin	    FDSIZE="SMALL"
838c0731f81SJohn Baldwin.endif
839c0731f81SJohn Baldwin.else	# !SPLIT_MFSROOT
840c0731f81SJohn Baldwin	@cd ${.CURDIR} && ${MAKE} buildBootFloppy FSIMAGE="boot" \
841c0731f81SJohn Baldwin	    KERNFILE="${KERNFLOPPYSET}.split ${KERNFLOPPYSET}.boot" \
842c0731f81SJohn Baldwin	    MFSROOTFILE=${RD}/mfsroot/mfsroot.gz
843c0731f81SJohn Baldwin.if defined(SMALLFLOPPYSIZE)
8446ab88893SYoshihiro Takahashi	@cd ${.CURDIR} && ${MAKE} buildBootFloppy FSIMAGE="boot-small" \
845c0731f81SJohn Baldwin	    KERNFILE="${SMALLKERNFLOPPYSET}.split ${SMALLKERNFLOPPYSET}.boot" \
846c0731f81SJohn Baldwin	    MFSROOTFILE=${RD}/mfsroot/mfsroot.gz \
847c0731f81SJohn Baldwin	    FDSIZE="SMALL"
848c0731f81SJohn Baldwin.endif
849c0731f81SJohn Baldwin.endif	# SPLIT_MFSROOT
850c0731f81SJohn Baldwin	touch ${.TARGET}
851c0731f81SJohn Baldwin
852c0731f81SJohn Baldwin# Build fixit floppy.
853c0731f81SJohn Baldwinfloppies.2:
85492e86f99SJordan K. Hubbard	@echo "Making fixit floppy."
85592e86f99SJordan K. Hubbard	@rm -rf ${RD}/fixitfd
85692e86f99SJordan K. Hubbard	@mkdir ${RD}/fixitfd
85792e86f99SJordan K. Hubbard	@cd ${RD}/fixitfd && \
858fbc6f9e0SJoerg Wunsch	    mkdir -p dev stand bin sbin etc mnt mnt1 mnt2 mnt3 mnt4 tmp \
859d26a815bSJordan K. Hubbard	    usr/share/misc
86001df2ec3SDavid E. O'Brien	@cp ${RD}/trees/base/etc/spwd.db ${RD}/trees/base/etc/group \
861ef812d2fSJun Kuriyama	    ${RD}/fixitfd/etc
862ef812d2fSJun Kuriyama	@sed -e 's/#.*//' ${RD}/trees/base/etc/protocols \
863ef812d2fSJun Kuriyama	    > ${RD}/fixitfd/etc/protocols
864ef812d2fSJun Kuriyama	@sed -e 's/#.*//' ${RD}/trees/base/usr/share/misc/scsi_modes \
865ef812d2fSJun Kuriyama	    > ${RD}/fixitfd/usr/share/misc/scsi_modes
86692e86f99SJordan K. Hubbard	@cp ${.CURDIR}/fixit.profile ${RD}/fixitfd/.profile
86792e86f99SJordan K. Hubbard	@cp ${.CURDIR}/fixit.services ${RD}/fixitfd/etc/services
86892e86f99SJordan K. Hubbard	@cp ${.CURDIR}/scripts/tar.sh ${RD}/fixitfd/stand/tar
86992e86f99SJordan K. Hubbard	@chmod 555 ${RD}/fixitfd/stand/tar
870c0731f81SJohn Baldwin.if defined(SMALLFLOPPYSIZE)
871c2bed627SYoshihiro Takahashi	@cd ${.CURDIR} && ${MAKE} installCRUNCH CRUNCH=fixit-small \
872c2bed627SYoshihiro Takahashi	    DIR=${RD}/fixitfd/stand ZIP=false
873b34a415eSDavid E. O'Brien	@sh -e ${DOFS_SH} ${RD}/floppies/fixit-small.flp ${RD} ${MNT} \
874c0731f81SJohn Baldwin	    ${SMALLFLOPPYSIZE} ${RD}/fixitfd ${FLOPPYINODE} ${SMALLFLOPPYLABEL}
875c2bed627SYoshihiro Takahashi	@rm -rf ${RD}/fixitfd/stand
876c2bed627SYoshihiro Takahashi	@mkdir ${RD}/fixitfd/stand
877c2bed627SYoshihiro Takahashi.endif
878c2bed627SYoshihiro Takahashi	@cd ${.CURDIR} && ${MAKE} installCRUNCH CRUNCH=fixit \
879c2bed627SYoshihiro Takahashi	    DIR=${RD}/fixitfd/stand ZIP=false
880b34a415eSDavid E. O'Brien	@sh -e ${DOFS_SH} ${RD}/floppies/fixit.flp ${RD} ${MNT} \
881c0731f81SJohn Baldwin	    ${FLOPPYSIZE} ${RD}/fixitfd ${FLOPPYINODE} ${FLOPPYLABEL}
882c0731f81SJohn Baldwin	touch ${.TARGET}
883c0731f81SJohn Baldwin
884c0731f81SJohn Baldwin# Do our last minute floppies directory setup
885c0731f81SJohn Baldwinfloppies.3:
88613fc8773SBruce A. Mah	@(cd ${RD}/floppies; md5 *.flp > CHECKSUM.MD5)
8870f12c50eSKen Smith	@(cd ${RD}/floppies; sha256 *.flp > CHECKSUM.SHA256)
888d3c93cefSRuslan Ermilov	touch ${.TARGET}
8893bc93c76SPoul-Henning Kamp
89030e8b491SPoul-Henning Kamp#
89130e8b491SPoul-Henning Kamp# --==## Setup a suitable ftp-area ##==--
89230e8b491SPoul-Henning Kamp#
893e12c4355SPoul-Henning Kampftp.1:
89492e86f99SJordan K. Hubbard	@echo "Setting up FTP distribution area"
89592e86f99SJordan K. Hubbard	@mkdir -p ${FD}
89634594ab9SJordan K. Hubbard	-@ln -s . ${FD}/${BUILDNAME}
89794223a53SDavid E. O'Brien.if defined(MAKE_FLOPPIES)
89892e86f99SJordan K. Hubbard	@cd ${RD} && find floppies -print | cpio -dumpl ${FD}
8991dae6ea9SRuslan Ermilov.endif
90092e86f99SJordan K. Hubbard	@cd ${RD}/dists && find . -print | cpio -dumpl ${FD}
90121203b38SBruce A. Mah.if !defined(NODOC)
9028ed3802bSBruce A. Mah	@for i in ${DIST_DOCS_ARCH_INDEP}; do \
903b34a415eSDavid E. O'Brien		cp ${RND}/${RELNOTES_LANG}/$$i/article.txt \
904b34a415eSDavid E. O'Brien		    ${FD}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
905b34a415eSDavid E. O'Brien		cp ${RND}/${RELNOTES_LANG}/$$i/article.html \
906b34a415eSDavid E. O'Brien		    ${FD}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \
9078ed3802bSBruce A. Mah	done
9088ed3802bSBruce A. Mah	@for i in ${DIST_DOCS_ARCH_DEP}; do \
909b34a415eSDavid E. O'Brien		cp ${RND}/${RELNOTES_LANG}/$$i/${TARGET}/article.txt \
910b34a415eSDavid E. O'Brien		    ${FD}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
911b34a415eSDavid E. O'Brien		cp ${RND}/${RELNOTES_LANG}/$$i/${TARGET}/article.html \
912b34a415eSDavid E. O'Brien		    ${FD}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \
9138ed3802bSBruce A. Mah	done
914febbbc67SBruce A. Mah	@cp ${RND}/${RELNOTES_LANG}/readme/docbook.css ${FD}
9158ed3802bSBruce A. Mah.endif
91692e86f99SJordan K. Hubbard	@echo "CD_VERSION = ${BUILDNAME}" > ${FD}/cdrom.inf
917d3c93cefSRuslan Ermilov	touch ${.TARGET}
9183bc93c76SPoul-Henning Kamp
91992f6e2c8SJohn Baldwin# Build a live filesystem cdrom image
920c5b0a909SPoul-Henning Kampcdrom.1:
92192f6e2c8SJohn Baldwin	@echo "Building CDROM live filesystem image"
92292f6e2c8SJohn Baldwin	@mkdir -p ${CD_LIVEFS}
92392e86f99SJordan K. Hubbard	@for i in ${DISTRIBUTIONS} ; \
924c5b0a909SPoul-Henning Kamp	do \
925c5b0a909SPoul-Henning Kamp		if [ -d ${RD}/trees/$${i} ] ; then \
926ad5ebf3fSDag-Erling Smørgrav			chflags -R noschg ${RD}/trees/$${i} || true ; \
92701feef2cSPoul-Henning Kamp			( cd ${RD}/trees/$${i} && \
92892f6e2c8SJohn Baldwin			    find . -depth -print | cpio -dumpl ${CD_LIVEFS} ) ; \
929c5b0a909SPoul-Henning Kamp		fi \
930c5b0a909SPoul-Henning Kamp	done
9312e3a1557SKen Smith.if defined(MAKE_DVD)
9322e3a1557SKen Smith	@echo "Building DVD filesystem image as well as CDROM"
9332e3a1557SKen Smith	@mkdir -p ${CD_DVD}/${BUILDNAME}
9342e3a1557SKen Smith	@for i in ${DISTRIBUTIONS} ; \
9352e3a1557SKen Smith	do \
9362e3a1557SKen Smith		if [ -d ${RD}/trees/$${i} ] ; then \
9372e3a1557SKen Smith			chflags -R noschg ${RD}/trees/$${i} || true ; \
9382e3a1557SKen Smith			( cd ${RD}/trees/$${i} && \
9392e3a1557SKen Smith			    find . -depth -print | cpio -dumpl ${CD_DVD} ) ; \
9402e3a1557SKen Smith		fi \
9412e3a1557SKen Smith	done
9422e3a1557SKen Smith.endif
9439fe7600bSSam Leffler	@echo "Copy GENERIC kernel to boot area"
9449fe7600bSSam Leffler	@cp -Rp ${RD}/kernels/GENERIC/ ${CD_LIVEFS}/boot/kernel
945f24c80e2SSimon L. B. Nielsen	@rm -f ${CD_LIVEFS}/boot/kernel/*.symbols
94692f6e2c8SJohn Baldwin	@rm -f ${CD_LIVEFS}/.profile
94792f6e2c8SJohn Baldwin	@cp ${.CURDIR}/fixit.profile ${CD_LIVEFS}/.profile
9480cdbdea6STai-hwa Liang	@ln -sf /rescue ${CD_LIVEFS}/stand
94992f6e2c8SJohn Baldwin	@echo "Setting up CDROM boot area"
95092f6e2c8SJohn Baldwin	@rm -f ${CD_LIVEFS}/boot/loader.conf
95192f6e2c8SJohn Baldwin	@cp ${RD}/mfsroot/mfsroot.gz ${CD_LIVEFS}/boot/mfsroot.gz
95292f6e2c8SJohn Baldwin	@echo 'mfsroot_load="YES"' > ${CD_LIVEFS}/boot/loader.conf
95392f6e2c8SJohn Baldwin	@echo 'mfsroot_type="mfs_root"' >> ${CD_LIVEFS}/boot/loader.conf
95492f6e2c8SJohn Baldwin	@echo 'mfsroot_name="/boot/mfsroot"' >> ${CD_LIVEFS}/boot/loader.conf
95592f6e2c8SJohn Baldwin.if exists(${RD}/trees/base/boot/device.hints)
95692f6e2c8SJohn Baldwin	# Break the link to device.hints so we can modify it
95792f6e2c8SJohn Baldwin	@rm -f ${CD_LIVEFS}/boot/device.hints
95892f6e2c8SJohn Baldwin	@cp ${RD}/trees/base/boot/device.hints ${CD_LIVEFS}/boot/device.hints
95992f6e2c8SJohn Baldwin.endif
9602e3a1557SKen Smith.if defined(MAKE_DVD)
9612e3a1557SKen Smith	@cp -Rp ${RD}/kernels/GENERIC/ ${CD_DVD}/boot/kernel
9622e3a1557SKen Smith	@rm -f ${CD_DVD}/boot/kernel/*.symbols
9632e3a1557SKen Smith	@rm -f ${CD_DVD}/.profile
9642e3a1557SKen Smith	@cp ${.CURDIR}/fixit.profile ${CD_DVD}/.profile
9652e3a1557SKen Smith	@ln -sf /rescue ${CD_DVD}/stand
96692f6e2c8SJohn Baldwin	@echo "CD_VERSION = ${BUILDNAME}" > ${CD_LIVEFS}/cdrom.inf
9672e3a1557SKen Smith	@echo "CD_VERSION = ${BUILDNAME}" > ${CD_DVD}/cdrom.inf
9682e3a1557SKen Smith	@rm -f ${CD_DVD}/boot/loader.conf
9692e3a1557SKen Smith	@cp ${RD}/mfsroot/mfsroot.gz ${CD_DVD}/boot/mfsroot.gz
9702e3a1557SKen Smith	@echo 'mfsroot_load="YES"' > ${CD_DVD}/boot/loader.conf
9712e3a1557SKen Smith	@echo 'mfsroot_type="mfs_root"' >> ${CD_DVD}/boot/loader.conf
9722e3a1557SKen Smith	@echo 'mfsroot_name="/boot/mfsroot"' >> ${CD_DVD}/boot/loader.conf
9732e3a1557SKen Smith.if exists(${RD}/trees/base/boot/device.hints)
9742e3a1557SKen Smith	@rm -f ${CD_DVD}/boot/device.hints
9752e3a1557SKen Smith	@cp ${RD}/trees/base/boot/device.hints ${CD_DVD}/boot/device.hints
9762e3a1557SKen Smith.endif
9772e3a1557SKen Smith.endif
97892f6e2c8SJohn Baldwin	touch ${.TARGET}
97992f6e2c8SJohn Baldwin
980b2200964SJohn Baldwin# Build disc1 and disc2 cdrom images
98192f6e2c8SJohn Baldwincdrom.2:
98292f6e2c8SJohn Baldwin	@echo "Building CDROM disc1 filesystem image"
98392f6e2c8SJohn Baldwin	@mkdir -p ${CD_DISC1}/${BUILDNAME}
98492f6e2c8SJohn Baldwin.if defined(MAKE_FLOPPIES)
98592f6e2c8SJohn Baldwin	@cd ${RD} && find floppies -print | cpio -dumpl ${CD_DISC1}
98692f6e2c8SJohn Baldwin.endif
98792f6e2c8SJohn Baldwin	@cd ${RD}/dists && find . -print | cpio -dumpl ${CD_DISC1}/${BUILDNAME}
98821203b38SBruce A. Mah.if !defined(NODOC)
9898ed3802bSBruce A. Mah	@for i in ${DIST_DOCS_ARCH_INDEP}; do \
990b34a415eSDavid E. O'Brien	  cp ${RND}/${RELNOTES_LANG}/$$i/article.txt \
991b34a415eSDavid E. O'Brien	      ${CD_DISC1}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
992b34a415eSDavid E. O'Brien	  cp ${RND}/${RELNOTES_LANG}/$$i/article.html \
993b34a415eSDavid E. O'Brien	      ${CD_DISC1}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \
9948ed3802bSBruce A. Mah	done
9958ed3802bSBruce A. Mah	@for i in ${DIST_DOCS_ARCH_DEP}; do \
996b34a415eSDavid E. O'Brien	  cp ${RND}/${RELNOTES_LANG}/$$i/${TARGET}/article.txt \
997b34a415eSDavid E. O'Brien	      ${CD_DISC1}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
998b34a415eSDavid E. O'Brien	  cp ${RND}/${RELNOTES_LANG}/$$i/${TARGET}/article.html \
999b34a415eSDavid E. O'Brien	      ${CD_DISC1}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \
10008ed3802bSBruce A. Mah	done
1001febbbc67SBruce A. Mah	@cp ${RND}/${RELNOTES_LANG}/readme/docbook.css ${CD_DISC1}
10028ed3802bSBruce A. Mah.endif
100392f6e2c8SJohn Baldwin.if defined(SEPARATE_LIVEFS)
100492f6e2c8SJohn Baldwin	@cp -Rp ${CD_LIVEFS}/boot ${CD_DISC1}
100592f6e2c8SJohn Baldwin	@echo "CD_VERSION = ${BUILDNAME}" > ${CD_DISC1}/cdrom.inf
1006f09470adSBrooks Davis.endif
10079bc245fbSMarcel Moolenaar	@echo "CD_VOLUME = 1" >> ${CD_DISC1}/cdrom.inf
1008b2200964SJohn Baldwin	@echo "Building CDROM disc2 filesystem image"
1009b2200964SJohn Baldwin	@mkdir -p ${CD_DISC2}
1010b2200964SJohn Baldwin	@echo "CD_VERSION = ${BUILDNAME}" > ${CD_DISC2}/cdrom.inf
1011b2200964SJohn Baldwin	@echo "CD_VOLUME = 2" >> ${CD_DISC2}/cdrom.inf
10122e3a1557SKen Smith.if defined(MAKE_DVD)
10132e3a1557SKen Smith.if defined(MAKE_FLOPPIES)
10142e3a1557SKen Smith	@cd ${RD} && find floppies -print | cpio -dumpl ${CD_DVD}
10152e3a1557SKen Smith.endif
10162e3a1557SKen Smith	@cd ${RD}/dists && find . -print | cpio -dumpl ${CD_DVD}/${BUILDNAME}
10172e3a1557SKen Smith.if !defined(NODOC)
10182e3a1557SKen Smith	@for i in ${DIST_DOCS_ARCH_INDEP}; do \
10192e3a1557SKen Smith	  cp ${RND}/${RELNOTES_LANG}/$$i/article.txt \
10202e3a1557SKen Smith	      ${CD_DVD}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
10212e3a1557SKen Smith	  cp ${RND}/${RELNOTES_LANG}/$$i/article.html \
10222e3a1557SKen Smith	      ${CD_DVD}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \
10232e3a1557SKen Smith	done
10242e3a1557SKen Smith	@for i in ${DIST_DOCS_ARCH_DEP}; do \
10252e3a1557SKen Smith	  cp ${RND}/${RELNOTES_LANG}/$$i/${TARGET}/article.txt \
10262e3a1557SKen Smith	      ${CD_DVD}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
10272e3a1557SKen Smith	  cp ${RND}/${RELNOTES_LANG}/$$i/${TARGET}/article.html \
10282e3a1557SKen Smith	      ${CD_DVD}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \
10292e3a1557SKen Smith	done
10302e3a1557SKen Smith	@cp ${RND}/${RELNOTES_LANG}/readme/docbook.css ${CD_DVD}
10312e3a1557SKen Smith.endif
10322e3a1557SKen Smith	@echo "CD_VERSION = ${BUILDNAME}" > ${CD_DVD}/cdrom.inf
10332e3a1557SKen Smith	@echo "CD_VOLUME = 1" >> ${CD_DVD}/cdrom.inf
10342e3a1557SKen Smith.endif
1035a1b193b5SJohn Baldwin.if !defined(NODOC)
1036639fe104SKen Smith	echo "Building CDROM docs filesystem image"
1037639fe104SKen Smith	@mkdir -p ${CD_DOCS}
1038639fe104SKen Smith	@echo "CD_VERSION = ${BUILDNAME}" > ${CD_DOCS}/cdrom.inf
1039639fe104SKen Smith	@mkdir -p ${CD_DOCS}/usr/share/doc
10402e3a1557SKen Smith.if defined(MAKE_DVD)
10412e3a1557SKen Smith	@mkdir -p ${CD_DVD}/usr/share/doc
10422e3a1557SKen Smith.endif
1043a1b193b5SJohn Baldwin	@for i in `ls ${CD_LIVEFS}/usr/share/doc`; do \
1044a1b193b5SJohn Baldwin		if [ -L ${CD_LIVEFS}/usr/share/doc/$$i -o \
1045a1b193b5SJohn Baldwin		    -d /usr/doc/$$i ]; then \
1046a1b193b5SJohn Baldwin			mv ${CD_LIVEFS}/usr/share/doc/$$i \
1047639fe104SKen Smith			    ${CD_DOCS}/usr/share/doc; \
1048a1b193b5SJohn Baldwin		fi \
1049a1b193b5SJohn Baldwin	done
10502e3a1557SKen Smith.if defined(MAKE_DVD)
10512e3a1557SKen Smith	@cd ${CD_DOCS}/usr/share/doc && find . -print | \
10522e3a1557SKen Smith	    cpio -dumpl ${CD_DVD}/usr/share/doc
10532e3a1557SKen Smith.endif
1054a1b193b5SJohn Baldwin.endif
105592f6e2c8SJohn Baldwin	touch ${.TARGET}
105692f6e2c8SJohn Baldwin
105792f6e2c8SJohn Baldwin#
105892f6e2c8SJohn Baldwin# --==## Setup a suitable cdrom-area ##==--
105992f6e2c8SJohn Baldwin#
106092f6e2c8SJohn Baldwincdrom.3:
10616daa108fSRuslan Ermilov.if defined(CD_BOOT)
106292f6e2c8SJohn Baldwin	@echo "Building bootonly CDROM filesystem image"
106392f6e2c8SJohn Baldwin	@mkdir -p ${CD_BOOT}
106492f6e2c8SJohn Baldwin	@cp -Rp ${CD_LIVEFS}/boot ${CD_BOOT}
1065b2200964SJohn Baldwin	@echo "CD_VERSION = ${BUILDNAME}" > ${CD_BOOT}/cdrom.inf
1066a4f9e93cSRuslan Ermilov.if defined(MINIROOT)
106792f6e2c8SJohn Baldwin	@echo "Building bootonly UFS filesystem image"
1068a4f9e93cSRuslan Ermilov	@mkdir -p ${FD}/miniroot
1069a4f9e93cSRuslan Ermilov	@sh -e ${DOFS_SH} ${FD}/miniroot/miniroot.ufs \
1070a4f9e93cSRuslan Ermilov	    ${RD} ${MNT} 0 ${CD_BOOT} 8192 auto
1071569acadfSDavid E. O'Brien	@${ZIPPER} -v ${FD}/miniroot/miniroot.ufs
1072a4f9e93cSRuslan Ermilov.endif
1073dfbc75ffSYoshihiro Takahashi.endif
1074d3c93cefSRuslan Ermilov	touch ${.TARGET}
1075c5b0a909SPoul-Henning Kamp
1076b2200964SJohn Baldwin.if make(iso.1)
1077b2200964SJohn Baldwin.if defined(CD_PACKAGE_TREE)
1078b2200964SJohn Baldwin.if exists(${CD_PACKAGE_TREE}/disc1)
1079b2200964SJohn BaldwinCD_DISC1_PKGS=	${CD_PACKAGE_TREE}/disc1
1080b2200964SJohn Baldwin.endif
1081b2200964SJohn Baldwin.if exists(${CD_PACKAGE_TREE}/disc2)
1082b2200964SJohn BaldwinCD_DISC2_PKGS=	${CD_PACKAGE_TREE}/disc2
1083b2200964SJohn Baldwin.endif
10842e3a1557SKen Smith.if exists(${CD_PACKAGE_TREE}/dvd)
10852e3a1557SKen SmithCD_DVD_PKGS=	${CD_PACKAGE_TREE}/dvd
10862e3a1557SKen Smith.endif
1087b2200964SJohn Baldwin.endif
1088b2200964SJohn Baldwin.endif
1089b2200964SJohn Baldwin
10902ef74d22SJordan K. Hubbardiso.1:
1091c1fc2282SRuslan Ermilov.if exists(${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh)
109230fa4984SDavid E. O'Brien	@echo "Creating ISO images..."
10936daa108fSRuslan Ermilov.if defined(CD_BOOT)
10946daa108fSRuslan Ermilov	@sh ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh ${BOOTABLE} \
1095b2200964SJohn Baldwin	    FreeBSD_bootonly \
10966daa108fSRuslan Ermilov	    ${CD}/${BUILDNAME}-${TARGET}-bootonly.iso ${CD_BOOT}
10976daa108fSRuslan Ermilov.endif
109830fa4984SDavid E. O'Brien	@sh ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh ${BOOTABLE} \
1099b2200964SJohn Baldwin	    FreeBSD_Install \
1100b2200964SJohn Baldwin	    ${CD}/${BUILDNAME}-${TARGET}-disc1.iso ${CD_DISC1} \
1101b2200964SJohn Baldwin	    ${CD_DISC1_PKGS}
1102b2200964SJohn Baldwin	@sh ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh \
1103b2200964SJohn Baldwin	    FreeBSD_Packages \
1104b2200964SJohn Baldwin	    ${CD}/${BUILDNAME}-${TARGET}-disc2.iso ${CD_DISC2} \
1105b2200964SJohn Baldwin	    ${CD_DISC2_PKGS}
11062e3a1557SKen Smith.if defined(MAKE_DVD)
11072e3a1557SKen Smith	@sh ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh ${BOOTABLE} \
11082e3a1557SKen Smith	    FreeBSD_Install \
11092e3a1557SKen Smith	    ${CD}/${BUILDNAME}-${TARGET}-dvd.iso ${CD_DVD} \
11102e3a1557SKen Smith	    ${CD_DVD_PKGS}
11112e3a1557SKen Smith.endif
1112639fe104SKen Smith.if !defined(NODOC)
1113639fe104SKen Smith	@sh ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh \
1114639fe104SKen Smith	    FreeBSD_Documentation \
1115639fe104SKen Smith	    ${CD}/${BUILDNAME}-${TARGET}-docs.iso ${CD_DOCS}
1116639fe104SKen Smith.endif
111792f6e2c8SJohn Baldwin.if defined(SEPARATE_LIVEFS)
111830fa4984SDavid E. O'Brien	@sh ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh ${BOOTABLE} \
1119b2200964SJohn Baldwin	    FreeBSD_LiveFS \
1120b2200964SJohn Baldwin	    ${CD}/${BUILDNAME}-${TARGET}-livefs.iso ${CD_LIVEFS}
112130fa4984SDavid E. O'Brien.endif
11220f12c50eSKen Smith	@echo "Generating MD5 and SHA256 sums..."
1123eb9bb3eeSDavid E. O'Brien	@(cd ${CD} && md5 *.iso > ${BUILDNAME}-${TARGET}-iso.CHECKSUM.MD5)
11240f12c50eSKen Smith	@(cd ${CD} && sha256 *.iso > ${BUILDNAME}-${TARGET}-iso.CHECKSUM.SHA256)
1125d3c93cefSRuslan Ermilov	touch ${.TARGET}
112630fa4984SDavid E. O'Brien.else
1127c1fc2282SRuslan Ermilov	@echo "Do not know how to create an ISO for ${TARGET_ARCH}."
112830fa4984SDavid E. O'Brien.endif
11292ef74d22SJordan K. Hubbard
11308ed3802bSBruce A. Mah#
11318ed3802bSBruce A. Mah# --==## Documentation Project files such as the Handbook and FAQ ##==--
11328ed3802bSBruce A. Mah#
1133793e8c6fSJordan K. Hubbarddoc.1:
113492e86f99SJordan K. Hubbard	@echo "Making docs..."
113592e86f99SJordan K. Hubbard	@for i in ${DOCPORTS}; do \
1136da037ed3SRuslan Ermilov	    cd /usr/ports/$$i && \
1137cd9568c7SMarcel Moolenaar	    env -i FTP_PASSIVE_MODE=$${FTP_PASSIVE_MODE:-no} PATH=$${PATH} \
1138cd9568c7SMarcel Moolenaar		make all install clean BATCH=yes WITHOUT_X11=yes JADETEX=no \
1139cd9568c7SMarcel Moolenaar		WITHOUT_PYTHON=yes FORCE_PKG_REGISTER=yes; \
1140b59d8897SJordan K. Hubbard	done
1141b34a415eSDavid E. O'Brien	@cd /usr/doc && make all install 'FORMATS=html html-split txt' \
11429f2d40abSHiroki Sato	    INSTALL_COMPRESSED='' DOCDIR=${RD}/trees/base/usr/share/doc \
11439f2d40abSHiroki Sato	    URLS_ABSOLUTE=YES
1144d3c93cefSRuslan Ermilov	touch ${.TARGET}
1145793e8c6fSJordan K. Hubbard
11468ed3802bSBruce A. Mah#
11478ed3802bSBruce A. Mah# --==## RELNOTESng:  Next-generation replacements for *.TXT files ##==--
11488ed3802bSBruce A. Mah#
11498ed3802bSBruce A. Mahdoc.2:
11508ed3802bSBruce A. Mah	@echo "Making release documentation..."
1151ba547cb4SYoshihiro Takahashi	@cd ${.CURDIR}/doc && make all install clean 'FORMATS=html txt' \
115252957bbfSBruce A. Mah	    INSTALL_COMPRESSED='' URLS_ABSOLUTE=YES DOCDIR=${RND}
1153d3c93cefSRuslan Ermilov	touch ${.TARGET}
11548ed3802bSBruce A. Mah
11557eb11201SPoul-Henning Kamp# Various "subroutine" and other supporting targets.
11567eb11201SPoul-Henning Kamp
1157470f825fSJordan K. Hubbard# RD=
1158470f825fSJordan K. Hubbard# SD=
1159470f825fSJordan K. Hubbard# TD=
1160470f825fSJordan K. Hubbard# ARG=
1161bd668f6fSPoul-Henning KampdoTARBALL:
1162bd668f6fSPoul-Henning Kamp.if !defined(SD)
1163288fe4dbSPoul-Henning Kamp	@echo "SD undefined in doTARBALL" && exit 1
1164bd668f6fSPoul-Henning Kamp.endif
1165bd668f6fSPoul-Henning Kamp.if !defined(TD)
116619cc96f6SDavid E. O'Brien	@echo "TD undefined in doTARBALL" && exit 1
1167bd668f6fSPoul-Henning Kamp.endif
1168bd668f6fSPoul-Henning Kamp.if !defined(ARG)
1169288fe4dbSPoul-Henning Kamp	@echo "ARG undefined in doTARBALL" && exit 1
1170bd668f6fSPoul-Henning Kamp.endif
117192e86f99SJordan K. Hubbard	@rm -rf ${RD}/dists/${TD}/${TN}*
117292e86f99SJordan K. Hubbard	@mkdir -p ${RD}/dists/${TD}
117392e86f99SJordan K. Hubbard	@( cd ${SD} && \
117471098935SRuslan Ermilov		tn=`echo ${TN} | tr 'A-Z' 'a-z'` && \
1175d2b98961SPoul-Henning Kamp		echo rolling ${TD}/$$tn tarball &&\
1176042df2e2SRuslan Ermilov		tar --exclude CVS --exclude .svn --exclude obj --exclude BOOTMFS -cf - ${ARG} | \
117795e34bfcSJordan K. Hubbard		${ZIPNSPLIT} ${RD}/dists/${TD}/$$tn. && \
1178b34a415eSDavid E. O'Brien		sh ${.CURDIR}/scripts/info.sh ${RD}/dists/${TD}/$$tn \
1179b34a415eSDavid E. O'Brien		    > ${RD}/dists/${TD}/$$tn.inf && \
11801e104a1eSJordan K. Hubbard		if [ -f ${.CURDIR}/scripts/$${TD}-install.sh ]; then \
1181b34a415eSDavid E. O'Brien			cp -p ${.CURDIR}/scripts/$${TD}-install.sh \
1182cbfec51aSSam Leffler			    ${RD}/dists/${TD}/install.sh && \
1183cbfec51aSSam Leffler			chmod +x ${RD}/dists/${TD}/install.sh; \
11841e104a1eSJordan K. Hubbard		fi && \
118516c61233SJordan K. Hubbard		if [ "${SD}" != "/usr/src" ]; then \
118611017a68SMarcel Moolenaar			mtree -c -i -p ${SD}/${ARG} \
118716c61233SJordan K. Hubbard			  -k gname,md5digest,mode,nlink,uname,size,link,type \
118891f2535eSJordan K. Hubbard			  > ${RD}/dists/${TD}/$$tn.mtree ; \
118991f2535eSJordan K. Hubbard		else \
119091f2535eSJordan K. Hubbard			true; \
119191f2535eSJordan K. Hubbard		fi; \
119291f2535eSJordan K. Hubbard		( cd ${RD}/dists/${TD}; \
11934a457aa6SHiroki Sato		rm -f CHECKSUM.MD5 CHECKSUM.SHA256; \
11940f12c50eSKen Smith		md5 * > .CHECKSUM.MD5; \
11954a457aa6SHiroki Sato		sha256 * > .CHECKSUM.SHA256; \
11964a457aa6SHiroki Sato		mv .CHECKSUM.MD5 CHECKSUM.MD5; \
11974a457aa6SHiroki Sato		mv .CHECKSUM.SHA256 CHECKSUM.SHA256) \
119891f2535eSJordan K. Hubbard	)
11997eb11201SPoul-Henning Kamp
12005355286aSColin PercivaldoRELEASE: release.1 release.2 ${DOCREL} release.3 release.4 \
12015355286aSColin Percival    release.5 release.6 release.7 release.8 ${EXTRAS}
12027eb11201SPoul-Henning Kamp	@echo "Release done"
12037eb11201SPoul-Henning Kamp
12040ead1f1dSJordan K. Hubbardfloppies:
12055355286aSColin Percival	@rm -f release.4 release.8 floppies.[123]
12065355286aSColin Percival	@cd ${.CURDIR} && ${MAKE} release.4 release.8 floppies.1 floppies.2 \
1207c0731f81SJohn Baldwin	    floppies.3
120892e86f99SJordan K. Hubbard	@cd ${RD} && find floppies -print | cpio -dumpl ${FD}
12090ead1f1dSJordan K. Hubbard
1210518a1d34SPoul-Henning KampinstallCRUNCH:
1211518a1d34SPoul-Henning Kamp.if !defined(CRUNCH)
1212288fe4dbSPoul-Henning Kamp	@echo "CRUNCH undefined in installCRUNCH" && exit 1
1213518a1d34SPoul-Henning Kamp.endif
1214518a1d34SPoul-Henning Kamp.if !defined(DIR)
1215288fe4dbSPoul-Henning Kamp	@echo "DIR undefined in installCRUNCH" && exit 1
1216518a1d34SPoul-Henning Kamp.endif
1217518a1d34SPoul-Henning Kamp.if !defined(ZIP)
1218288fe4dbSPoul-Henning Kamp	@echo "ZIP undefined in installCRUNCH" && exit 1
1219518a1d34SPoul-Henning Kamp.endif
122092e86f99SJordan K. Hubbard	@if ${ZIP} ; then \
1221569acadfSDavid E. O'Brien		${ZIPPER} < ${RD}/crunch/${CRUNCH} > ${DIR}/${CRUNCH}_crunch ; \
1222518a1d34SPoul-Henning Kamp	else \
1223518a1d34SPoul-Henning Kamp		ln -f ${RD}/crunch/${CRUNCH} ${DIR}/${CRUNCH}_crunch ; \
1224518a1d34SPoul-Henning Kamp	fi
122592e86f99SJordan K. Hubbard	@chmod 555 ${DIR}/${CRUNCH}_crunch
12268f1f55e9SRuslan Ermilov	@if [ -f ${.CURDIR}/${TARGET}/${CRUNCH}_crunch.conf ] ; then \
12278f1f55e9SRuslan Ermilov		for i in `crunchgen -l ${.CURDIR}/${TARGET}/${CRUNCH}_crunch.conf` ; do \
1228518a1d34SPoul-Henning Kamp			ln -f ${DIR}/${CRUNCH}_crunch ${DIR}/$$i ; \
12297ec62217SYoshihiro Takahashi		done \
12307ec62217SYoshihiro Takahashi	else \
12317ec62217SYoshihiro Takahashi		for i in `crunchgen -l ${.CURDIR}/${CRUNCH}_crunch.conf` ; do \
12327ec62217SYoshihiro Takahashi			ln -f ${DIR}/${CRUNCH}_crunch ${DIR}/$$i ; \
12337ec62217SYoshihiro Takahashi		done \
12347ec62217SYoshihiro Takahashi	fi
1235288fe4dbSPoul-Henning Kamp
1236288fe4dbSPoul-Henning Kamp#
1237c0731f81SJohn Baldwin# --==## Build a floppy set for a splitfs file ##==--
1238288fe4dbSPoul-Henning Kamp#
1239c0731f81SJohn Baldwin# FLOPPYBASE - basename of floppy image files
1240c0731f81SJohn Baldwin# FLOPPYDESC - description of floppy set
1241c0731f81SJohn Baldwin# SPLITFILE - filename of the file to split
1242c0731f81SJohn Baldwin# FDSIZE - if specified and "small", small floppy is created
1243c0731f81SJohn Baldwin
1244c0731f81SJohn Baldwin.if make(makeFloppySet)
1245c0731f81SJohn BaldwinSPLITDIR=	${RD}/floppyset/${FLOPPYBASE}
1246c0731f81SJohn Baldwin.if defined(FDSIZE) && ${FDSIZE} == "SMALL"
1247c0731f81SJohn BaldwinFLPSPLITSIZE=	${SMALLFLOPPYSPLITSIZE}
1248c0731f81SJohn BaldwinFLPSIZE=	${SMALLFLOPPYSIZE}
1249c0731f81SJohn BaldwinFLPLABEL=	${SMALLFLOPPYLABEL}
1250c0731f81SJohn Baldwin.else
1251c0731f81SJohn BaldwinFLPSPLITSIZE=	${FLOPPYSPLITSIZE}
1252c0731f81SJohn BaldwinFLPSIZE=	${FLOPPYSIZE}
1253c0731f81SJohn BaldwinFLPLABEL=	${FLOPPYLABEL}
1254319f35a3SRuslan Ermilov.endif
1255c0731f81SJohn Baldwin.endif
1256c0731f81SJohn Baldwin
1257c0731f81SJohn BaldwinmakeFloppySet:
1258c0731f81SJohn Baldwin.if !defined(FLOPPYBASE)
1259c0731f81SJohn Baldwin	@echo "FLOPPYBASE undefined in ${.TARGET}" && exit 1
1260c0731f81SJohn Baldwin.endif
1261c0731f81SJohn Baldwin.if !defined(FLOPPYDESC)
1262c0731f81SJohn Baldwin	@echo "FLOPPYDESC undefined in ${.TARGET}" && exit 1
1263c0731f81SJohn Baldwin.endif
1264c0731f81SJohn Baldwin.if !defined(SPLITFILE)
1265c0731f81SJohn Baldwin	@echo "SPLITFILE undefined in ${.TARGET}" && exit 1
1266c0731f81SJohn Baldwin.endif
1267e45b43aaSRuslan Ermilov	sh ${.CURDIR}/scripts/split-file.sh ${SPLITFILE} \
1268c0731f81SJohn Baldwin	    ${RD}/floppyset/${FLOPPYBASE} ${FLPSPLITSIZE} "${FLOPPYDESC}"
1269c0731f81SJohn Baldwin	( splitfile=${SPLITDIR}/`basename ${SPLITFILE}`.split ; \
1270c0731f81SJohn Baldwin	lines=`cat $${splitfile} | wc -l`; \
127185231d66SRuslan Ermilov	lines=$$(($$lines - 1)) ; \
1272c0731f81SJohn Baldwin	for line in `jot $$lines`; do \
1273c0731f81SJohn Baldwin		file=`head -n $$(($${line} + 1)) $${splitfile} | tail -1 | cut -f 1 -d ' '` ; \
1274c0731f81SJohn Baldwin		sh -e ${DOFS_SH} ${RD}/floppies/${FLOPPYBASE}$${line}.flp \
1275c0731f81SJohn Baldwin		${RD} ${MNT} ${FLPSIZE} ${SPLITDIR}/$${file} \
1276c0731f81SJohn Baldwin		${BOOTINODE} ${FLPLABEL}; \
1277c0731f81SJohn Baldwin	done )
1278c0731f81SJohn Baldwin
1279c0731f81SJohn Baldwin#
1280c0731f81SJohn Baldwin# --==## Build a boot floppy ##==--
1281c0731f81SJohn Baldwin#
1282c0731f81SJohn Baldwin# FSIMAGE - base floppy image name
1283c0731f81SJohn Baldwin# FDSIZE - if specified and "small", small floppy is created
1284c0731f81SJohn Baldwin# KERNFILE - path to kernel split file
1285c0731f81SJohn Baldwin# MFSROOTFILE - path to mfsroot split file
1286c0731f81SJohn Baldwin
1287c0731f81SJohn Baldwin.if make(buildBootFloppy)
1288c0731f81SJohn BaldwinIMAGEDIR=	${RD}/image.${FSIMAGE}
128913ff581dSJohn BaldwinBOOTDIR=	${RD}/trees/base/boot
129013ff581dSJohn BaldwinHINTSFILE=	${BOOTDIR}/device.hints
1291deff04b4SYoshihiro TakahashiACPI_KO=	${RD}/kernels/GENERIC/acpi.ko
1292c0731f81SJohn BaldwinIMAGEFILE=	${RD}/floppies/${FSIMAGE}.flp
1293c0731f81SJohn Baldwin.if defined(FDSIZE) && ${FDSIZE} == "SMALL"
1294c0731f81SJohn BaldwinFLPSIZE=	${SMALLFLOPPYSIZE}
1295c0731f81SJohn BaldwinFLPLABEL=	${SMALLFLOPPYLABEL}
1296c0731f81SJohn Baldwin.else
1297c0731f81SJohn BaldwinFLPSIZE=	${FLOPPYSIZE}
1298c0731f81SJohn BaldwinFLPLABEL=	${FLOPPYLABEL}
1299c0731f81SJohn Baldwin.endif
1300c0731f81SJohn Baldwin.endif
1301c0731f81SJohn Baldwin
1302c0731f81SJohn BaldwinbuildBootFloppy:
1303c0731f81SJohn Baldwin.if !defined(FSIMAGE)
1304c0731f81SJohn Baldwin	@echo "FSIMAGE undefined in ${.TARGET}" && exit 1
1305c0731f81SJohn Baldwin.endif
1306c0731f81SJohn Baldwin.if !defined(KERNFILE)
1307c0731f81SJohn Baldwin	@echo "KERNFILE undefined in ${.TARGET}" && exit 1
1308c0731f81SJohn Baldwin.endif
1309c0731f81SJohn Baldwin.if !defined(MFSROOTFILE)
1310c0731f81SJohn Baldwin	@echo "MFSROOTFILE undefined in ${.TARGET}" && exit 1
1311c0731f81SJohn Baldwin.endif
1312c0731f81SJohn Baldwin	@echo "Running ${.TARGET} for ${FSIMAGE}"
1313c0731f81SJohn Baldwin	@rm -rf ${IMAGEDIR}
1314c0731f81SJohn Baldwin	@mkdir ${IMAGEDIR}
131592e86f99SJordan K. Hubbard	@echo "Setting up /boot directory for ${FSIMAGE} floppy"
1316c0731f81SJohn Baldwin	@mkdir -p ${IMAGEDIR}/boot
13178f1f55e9SRuslan Ermilov.if ${TARGET} == "i386"
1318b34a415eSDavid E. O'Brien	@${WMAKEENV} kgzip -v -l ${RD}/trees/base/usr/lib/kgzldr.o -o \
131913ff581dSJohn Baldwin	    ${IMAGEDIR}/boot/loader ${BOOTDIR}/loader
13204b60693cSMakoto Matsushita.else
132113ff581dSJohn Baldwin	@cp ${BOOTDIR}/loader ${IMAGEDIR}/boot
13224b60693cSMakoto Matsushita.endif
132313ff581dSJohn Baldwin	@cp -Rp ${BOOTDIR}/*.4th ${BOOTDIR}/defaults ${BOOTDIR}/loader.help \
132413ff581dSJohn Baldwin	    ${BOOTDIR}/loader.rc ${IMAGEDIR}/boot
132513ff581dSJohn Baldwin.if exists(${HINTSFILE})
1326f09470adSBrooks Davis	@cp ${HINTSFILE} ${IMAGEDIR}/boot/device.hints
1327569acadfSDavid E. O'Brien	@${ZIPPER} ${IMAGEDIR}/boot/device.hints
132813ff581dSJohn Baldwin.endif
1329569acadfSDavid E. O'Brien	@${ZIPPER} ${IMAGEDIR}/boot/*.4th ${IMAGEDIR}/boot/loader.help \
133013ff581dSJohn Baldwin	    ${IMAGEDIR}/boot/defaults/loader.conf
133113ff581dSJohn Baldwin	@echo 'bootfile="/kernel"' > ${IMAGEDIR}/boot/loader.conf
1332d943f83bSJohn Baldwin.if exists(${ACPI_KO})
1333569acadfSDavid E. O'Brien	@${ZIPPER} -c ${ACPI_KO} > ${IMAGEDIR}/acpi.ko.gz
133413ff581dSJohn Baldwin	@echo 'acpi_load="YES"' >> ${IMAGEDIR}/boot/loader.conf
133513ff581dSJohn Baldwin	@echo 'acpi_name="/acpi.ko"' >> ${IMAGEDIR}/boot/loader.conf
133613ff581dSJohn Baldwin	@echo 'acpi_before="read -p \"Insert boot floppy and press Enter\""' >> ${IMAGEDIR}/boot/loader.conf
1337d943f83bSJohn Baldwin.endif
133813ff581dSJohn Baldwin	@echo 'mfsroot_load="YES"' >> ${IMAGEDIR}/boot/loader.conf
133913ff581dSJohn Baldwin	@echo 'mfsroot_type="mfs_root"' >> ${IMAGEDIR}/boot/loader.conf
134013ff581dSJohn Baldwin	@echo 'mfsroot_name="/mfsroot"' >> ${IMAGEDIR}/boot/loader.conf
134113ff581dSJohn Baldwin.if !exists(${ACPI_KO})
134213ff581dSJohn Baldwin	@echo 'mfsroot_before="read -p \"Insert boot floppy and press Enter\""' >> ${IMAGEDIR}/boot/loader.conf
134313ff581dSJohn Baldwin.endif
134491dda500SYoshihiro Takahashi.if defined(SPLIT_MFSROOT)
134591dda500SYoshihiro Takahashi	@echo 'mfsroot_after="read -p \"Insert boot floppy and press Enter\""' >> ${IMAGEDIR}/boot/loader.conf
134691dda500SYoshihiro Takahashi.endif
13479f5cc52fSRuslan Ermilov.if ${TARGET_ARCH} == "i386" || ${TARGET_ARCH} == "amd64"
13489f5cc52fSRuslan Ermilov.if ${AUTO_KEYBOARD_DETECT}
1349c0731f81SJohn Baldwin	@echo "-P" >> ${IMAGEDIR}/boot.config
13508198d9b0SJordan K. Hubbard.endif
13519f5cc52fSRuslan Ermilov.endif
1352c0731f81SJohn Baldwin	@rm -f ${IMAGEFILE}
1353c0731f81SJohn Baldwin	@cp ${KERNFILE} ${MFSROOTFILE} ${IMAGEDIR}
1354c0731f81SJohn Baldwin	sh -e ${DOFS_SH} ${IMAGEFILE} ${RD} ${MNT} ${FLPSIZE} ${IMAGEDIR} \
1355c0731f81SJohn Baldwin	    ${BOOTINODE} ${FLPLABEL}
135692e86f99SJordan K. Hubbard	@echo "Created ${RD}/floppies/${FSIMAGE}.flp"
1357270ee878SJohn W. De Boskey
1358e738d1eaSJohn Baldwin.if make(package-split)
1359e738d1eaSJohn Baldwin# Targets related to making a package split
1360e738d1eaSJohn Baldwin#
1361e738d1eaSJohn Baldwin# PKG_COPY instructs the script to copy the actual package files rather than
1362e738d1eaSJohn Baldwin#     make hard links
1363e738d1eaSJohn Baldwin# PKG_TREE is the path to the package tree to be split
1364e738d1eaSJohn Baldwin# PKG_DEST is the path to the destination tree to create the split in
1365e738d1eaSJohn Baldwin# PKG_VERBOSE asks for verbose output of the layout process
13669bae572bSMarcel Moolenaar# PKG_INDEX is the path to the INDEX file. By default ${PKG_TREE}/INDEX.
1367e738d1eaSJohn Baldwin
1368e738d1eaSJohn Baldwin.if defined(PKG_COPY)
1369e738d1eaSJohn BaldwinPKG_DO_COPY=	cp
1370e738d1eaSJohn Baldwin.else
1371e738d1eaSJohn BaldwinPKG_DO_COPY=	ln
1372e738d1eaSJohn Baldwin.endif
13739bae572bSMarcel MoolenaarPKG_WRKIDX=	${PKG_DEST}/INDEX.master
1374e738d1eaSJohn BaldwinPKG_ENV?=
1375e738d1eaSJohn Baldwin.if defined(TARGET_ARCH)
1376e738d1eaSJohn BaldwinPKG_ENV+=	PKG_ARCH=${TARGET_ARCH}
1377e738d1eaSJohn Baldwin.endif
1378e738d1eaSJohn Baldwin.if defined(PKG_VERBOSE)
1379e738d1eaSJohn BaldwinPKG_ENV+=	PKG_VERBOSE=1
1380e738d1eaSJohn Baldwin.endif
13819bae572bSMarcel MoolenaarPKG_INDEX?=	${PKG_TREE}/INDEX
1382e738d1eaSJohn Baldwin
1383e738d1eaSJohn Baldwinpackage-split:
1384e738d1eaSJohn Baldwin.if !defined(PKG_TREE)
1385e738d1eaSJohn Baldwin	@echo "PKG_TREE must be defined" && exit 1
1386e738d1eaSJohn Baldwin.endif
1387e738d1eaSJohn Baldwin.if !defined(PKG_DEST)
1388e738d1eaSJohn Baldwin	@echo "PKG_DEST must be defined" && exit 1
1389e738d1eaSJohn Baldwin.endif
1390e738d1eaSJohn Baldwin	@env ${PKG_ENV} python ${.CURDIR}/scripts/package-split.py \
13919bae572bSMarcel Moolenaar	    ${PKG_INDEX} ${PKG_WRKIDX}
1392e738d1eaSJohn Baldwin	@env ${PKG_ENV} sh ${.CURDIR}/scripts/package-trees.sh ${PKG_DO_COPY} \
13939bae572bSMarcel Moolenaar	    ${PKG_WRKIDX} ${PKG_TREE} ${PKG_DEST}
1394e738d1eaSJohn Baldwin.endif
1395e738d1eaSJohn Baldwin
13968eb4e096SRuslan Ermilov.include <bsd.obj.mk>
1397