xref: /freebsd/release/Makefile (revision e738d1ea3d0375e2ce23827cbb9658fa4fc986a1)
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:
21a4ff160fSRuslan Ermilov#BUILDNAME=6.0-CURRENT
22d013a27bSJoerg Wunsch#
23d013a27bSJoerg Wunsch# Automatic SNAP versioning:
24fcab936bSDag-Erling SmørgravDATE != date +%Y%m%d
25a4ff160fSRuslan ErmilovBASE = 6.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
3016cca1b2SAlexander Langer#RELEASETAG=RELENG_4
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#
38d751ad7fSJohn W. De Boskey# To add other options to the CVS subcommands (co,up), set
392b3f8b22SMakoto Matsushita#CVSCMDARGS="-D '01/01/2002 00:00:00 UTC'"
403f17d264SSatoshi Asami#
41d751ad7fSJohn W. De Boskey# To add other options to the CVS command, set
42d751ad7fSJohn W. De Boskey#CVSARGS="-lfq"
43d751ad7fSJohn W. De Boskey#
44d751ad7fSJohn W. De Boskey# To prefix the cvs command
45d751ad7fSJohn W. De Boskey#CVSPREFIX="/usr/bin/time"
46d751ad7fSJohn W. De Boskey#
4798b2ae09SMark Murray# Where the CVS repository is
4898b2ae09SMark Murray#CVSROOT="/home/ncvs"
4998b2ae09SMark Murray#
503f17d264SSatoshi Asami# Non-zero if ${RELEASETAG} is in the form "RELENG_ver_RELEASE"; we
513f17d264SSatoshi Asami# are building an official release.  Otherwise, we are building for
523f17d264SSatoshi Asami# a branch.
533f17d264SSatoshi Asami.if defined(RELEASETAG)
54be1234f2SPoul-Henning KampISRELEASE!=	expr "${RELEASETAG}" : '^RELENG_.*_RELEASE$$' || true
553f17d264SSatoshi Asami.if ${ISRELEASE} != 0
563f17d264SSatoshi Asami# Convert "RELENG_ver_RELEASE" to "RELEASE_ver" for ports and doc trees.
573f17d264SSatoshi AsamiAUXRELEASETAG!=	echo ${RELEASETAG} | sed -e 's/^RELENG_/RELEASE_/' -e 's/_RELEASE$$//'
585be3b5d9SJordan K. HubbardDOCRELEASETAG?=		${AUXRELEASETAG}
595be3b5d9SJordan K. HubbardPORTSRELEASETAG?=	${AUXRELEASETAG}
603f17d264SSatoshi Asami.endif
613f17d264SSatoshi Asami.endif
62ab0e9cdcSPoul-Henning Kamp
63fff8eb57SJohn Baldwin# If you want to pass flags to the world build such as -j X, use
64fff8eb57SJohn Baldwin# WORLD_FLAGS.  Similarly, you can specify make flags for kernel
65fff8eb57SJohn Baldwin# builds via KERNEL_FLAGS.
662272d4a4SScott Long#WORLD_FLAGS=-j4
672272d4a4SScott Long#KERNEL_FLAGS=-j4
68fff8eb57SJohn Baldwin
698f1f55e9SRuslan ErmilovTARGET_ARCH?=	${MACHINE_ARCH}
708f1f55e9SRuslan Ermilov.if ${TARGET_ARCH} == ${MACHINE_ARCH}
718f1f55e9SRuslan ErmilovTARGET?=	${MACHINE}
728f1f55e9SRuslan Ermilov.else
738f1f55e9SRuslan ErmilovTARGET?=	${TARGET_ARCH}
748f1f55e9SRuslan Ermilov.endif
755dc63117SRuslan ErmilovCROSSENV=	TARGET_ARCH=${TARGET_ARCH} TARGET=${TARGET}
765dc63117SRuslan ErmilovCROSSMAKE=	${MAKE} ${CROSSENV}
7761c2d47aSRuslan ErmilovNATIVEMAKE=	${MAKE} TARGET_ARCH=${MACHINE_ARCH} TARGET=${MACHINE}
788f1f55e9SRuslan Ermilov
790c9cba52SMike Smith# If you are using a local CVS repository with components stored in
800c9cba52SMike Smith# non-standard modules, override these on the make commandline or
810c9cba52SMike Smith# in the environment.
820c9cba52SMike SmithRELEASESRCMODULE?=	src
830c9cba52SMike SmithRELEASEDOCMODULE?=	doc
840c9cba52SMike SmithRELEASEPORTSMODULE?=	ports
850c9cba52SMike Smith
86dd1a1b3dSJoerg Wunsch# Uncomment this to disable the doc.1 target.  Docs normally require
87dd1a1b3dSJoerg Wunsch# the ports tree, so NOPORTS can be set together with NODOC in order
88dd1a1b3dSJoerg Wunsch# to have neither ports or docs.  If only NOPORTS is set to YES, but
89dd1a1b3dSJoerg Wunsch# docs are still desired, the DOMINIMALDOCPORTS logic below will only
90dd1a1b3dSJoerg Wunsch# install the ports that are minimally required for the docs.  This is
91dd1a1b3dSJoerg Wunsch# intended as a compromise, less disk space is required than for using
9223ef6da7STom Rhodes# the entire ports collection (and much less time due to the huge number
93dd1a1b3dSJoerg Wunsch# of directories it would create), but still quite a bit as well as some
94dd1a1b3dSJoerg Wunsch# CPU cycles (some of the programs are C++, and things like ghostscript
95dd1a1b3dSJoerg Wunsch# belong to the required ports nevertheless).
96dd1a1b3dSJoerg Wunsch#
9721203b38SBruce A. Mah# Setting this also disables building of release note documentation
9821203b38SBruce A. Mah# (RELNOTESng).
9985486998SJordan K. Hubbard#NODOC=  YES
100d6c7028cSJohn Hay#NOPORTS=  YES
1018ed3802bSBruce A. Mah
102182d7632SRuslan Ermilov# When retrieving ports using the pkg_add -r method, set your proxies to these.
103182d7632SRuslan Ermilov# src/release/${arch}/mkisoimages.sh can use these.
104182d7632SRuslan Ermilov#HTTP_PROXY?=	www.example.com
105182d7632SRuslan Ermilov#FTP_PROXY?=	ftp.example.com
106182d7632SRuslan Ermilov
107182d7632SRuslan Ermilov# When creating ISO images, point ${CD_EXTRA_BITS} to a directory containing
108182d7632SRuslan Ermilov# extra packages or other files.  It will be appended to the disk 1 ISO.
109182d7632SRuslan Ermilov#CD_EXTRA_BITS=	/path/to/pkg
110182d7632SRuslan Ermilov
111182d7632SRuslan Ermilov# Extra source tarballs; each argument is a pair of source dir and
112182d7632SRuslan Ermilov# distribution name.  The dist name should not exceed 7 characters
113182d7632SRuslan Ermilov# (another "s" for "source" will be prepended).
114182d7632SRuslan Ermilov#EXTRA_SRC=	games/fortune fortune
115182d7632SRuslan Ermilov
1167a7a00adSRuslan Ermilov# Modify this definition if you want the release notes
11739ab86fdSBruce A. Mah# and other release documentation in a language other than English.
1187a7a00adSRuslan ErmilovRELNOTES_LANG?=	en_US.ISO8859-1
1198ed3802bSBruce A. Mah
120dd1a1b3dSJoerg Wunsch# As an alternative to installing the entire ports collection (which
121dd1a1b3dSJoerg Wunsch# can take a huge amount of time, in particular on slower disks),
122dd1a1b3dSJoerg Wunsch# setting ${MINIMALDOCPORTS} allows to install and build just those
123dd1a1b3dSJoerg Wunsch# ports that are really required for getting the docs up & running.
124dd1a1b3dSJoerg Wunsch.if defined(NOPORTS) && !defined(NODOC)
125dd1a1b3dSJoerg WunschDOMINIMALDOCPORTS=	YES
126dd1a1b3dSJoerg Wunsch.include "Makefile.inc.docports"
127d9d84e07SJohn BaldwinRELEASEPORTSMODULE=	${MINIMALDOCPORTS}
128dd1a1b3dSJoerg Wunsch.endif
129dd1a1b3dSJoerg Wunsch
1304f27387dSKen Smith# Make changing names of disc1/disc2 CD's possible.
13192f6e2c8SJohn BaldwinDISC1_LABEL?=	FreeBSD_Install
13292f6e2c8SJohn BaldwinDISC1_NAME?=	disc1
13392f6e2c8SJohn BaldwinDISC2_LABEL?=	FreeBSD_LiveFS
1344f27387dSKen SmithDISC2_NAME?=	disc2
1354f27387dSKen Smith
136dd1a1b3dSJoerg Wunsch# Helper variable
137dd1a1b3dSJoerg Wunsch.if defined(NOPORTS)
138dd1a1b3dSJoerg Wunsch.if !defined(DOMINIMALDOCPORTS) || ${DOMINIMALDOCPORTS} != "YES"
139dd1a1b3dSJoerg WunschNOPORTSATALL=	YES
140dd1a1b3dSJoerg Wunsch.endif
141dd1a1b3dSJoerg Wunsch.endif
142dd1a1b3dSJoerg Wunsch
143485b9268SKen Smith#
144485b9268SKen Smith# Doing 'make index' in /usr/ports requires Perl.
145485b9268SKen SmithMAKEINDEXPORTS=	lang/perl5.8
146a7042915SRuslan Ermilov# By default, documentation (Handbook, FAQ, etc.) is built for all
147a7042915SRuslan Ermilov# the languages.  To speed up building, set the DOC_LANG to just
148a7042915SRuslan Ermilov# the languages you need.  (The language for the release notes is
149a7042915SRuslan Ermilov# controlled by the RELNOTES_LANG variable above.)
150a7042915SRuslan Ermilov#DOC_LANG=	en_US.ISO8859-1
1512f332092SJordan K. HubbardDOCPORTS=	textproc/docproj
15240227c90SMakoto Matsushita# Set this to wherever the distfiles required by release procedures.
15340227c90SMakoto Matsushita.if defined(DOCDISTFILES)
15440227c90SMakoto Matsushita# Respect DOCDISTFILES which is used before.
15540227c90SMakoto MatsushitaRELEASEDISTFILES?=	${DOCDISTFILES}
15640227c90SMakoto Matsushita.else
15740227c90SMakoto MatsushitaRELEASEDISTFILES?=	${.CURDIR}/../../ports/distfiles
15840227c90SMakoto Matsushita.endif
159ce51a9fcSJordan K. Hubbard# Set this to 1 if you want -P to be used for automatic keyboard detection
160ce51a9fcSJordan K. Hubbard# on the boot floppy.  WARNING: Breaks on some Athlon (K7) motherboards.
161ce51a9fcSJordan K. HubbardAUTO_KEYBOARD_DETECT?= 0
162ce51a9fcSJordan K. Hubbard
16321203b38SBruce A. Mah.if !defined(NODOC)
1646b6ec8ebSGiorgos KeramidasDIST_DOCS_ARCH_INDEP=	readme errata
1658ed3802bSBruce A. MahDIST_DOCS_ARCH_DEP=	installation relnotes hardware
1668ed3802bSBruce A. Mah.endif
167ed517874SJordan K. Hubbard
168bd668f6fSPoul-Henning Kamp# Things which without too much trouble can be considered variables
16901df2ec3SDavid E. O'Brien# BASE_DISTS are special in that they get full /etc installation sets.
1707284556fSJordan K. Hubbard#
171de9a18ceSRuslan ErmilovOTHER_DISTS?=	catpages manpages games proflibs dict info doc
17201df2ec3SDavid E. O'BrienBASE_DISTS?=	base
173c6d8b958SDavid E. O'BrienDISTRIBUTIONS?=	${BASE_DISTS} ${OTHER_DISTS}
174785bd4b4SPoul-Henning Kamp
1757c474103SPoul-Henning Kamp# mountpoint for filesystems.
1767c474103SPoul-Henning KampMNT=			/mnt
177518a1d34SPoul-Henning Kamp
178a5ddb8cfSJordan K. Hubbard# Various floppy image parameters.
179a5ddb8cfSJordan K. Hubbard#
180b98c5f70STatsumi Hosokawa
18194223a53SDavid E. O'Brien.undef MAKE_FLOPPIES
1828f1f55e9SRuslan Ermilov.if ${TARGET_ARCH} == "i386"
18394223a53SDavid E. O'BrienMAKE_FLOPPIES=		true
1848f1f55e9SRuslan Ermilov.if ${TARGET} == "pc98"
185c0731f81SJohn BaldwinSMALLFLOPPYSIZE=	1200
186c0731f81SJohn BaldwinSMALLFLOPPYSPLITSIZE=	1152
187c0731f81SJohn BaldwinSMALLFLOPPYLABEL=	fd1200
18813ff581dSJohn BaldwinSPLIT_MFSROOT=
189a40915d7SYoshihiro Takahashi.endif
190c0731f81SJohn BaldwinFLOPPYSIZE=		1440
191c0731f81SJohn BaldwinFLOPPYSPLITSIZE=	1392
192c0731f81SJohn BaldwinFLOPPYINODE=		40000
193c0731f81SJohn BaldwinFLOPPYLABEL=		fd1440
194d943f83bSJohn BaldwinBOOTINODE=		80000
195d943f83bSJohn BaldwinMFSSIZE=		4320
196d943f83bSJohn BaldwinMFSINODE=		8000
197c0731f81SJohn BaldwinMFSLABEL=		minimum3
1988f1f55e9SRuslan Ermilov.elif ${TARGET_ARCH} == "alpha"
19994223a53SDavid E. O'BrienMAKE_FLOPPIES=		true
200aaf3e5b0SJohn BaldwinFLOPPYSIZE=		1440
201aaf3e5b0SJohn BaldwinFLOPPYSPLITSIZE=	1392
202aaf3e5b0SJohn BaldwinFLOPPYINODE=		40000
203aaf3e5b0SJohn BaldwinFLOPPYLABEL=		fd1440
204aaf3e5b0SJohn BaldwinBOOTINODE=		80000
205ac95fa50SMurray StokelyMFSSIZE=		4320
206b98c5f70STatsumi HosokawaMFSINODE=		8000
207114de50eSJohn BaldwinMFSLABEL=		auto
208aaf3e5b0SJohn BaldwinSPLIT_MFSROOT=
209c26d9e5aSJake Burkholder.elif ${TARGET_ARCH} == "sparc64"
210c9030dc8SRuslan ErmilovDISKLABEL=		sunlabel
211c26d9e5aSJake BurkholderMFSSIZE=		4096
212c26d9e5aSJake BurkholderMFSINODE=		8192
213c26d9e5aSJake BurkholderMFSLABEL=		auto
214a4f9e93cSRuslan ErmilovMINIROOT=
215710d4ca3SMarcel Moolenaar.elif ${TARGET_ARCH} == "ia64"
216d943f83bSJohn BaldwinMFSSIZE=		8192
217710d4ca3SMarcel MoolenaarMFSINODE=		8192
218710d4ca3SMarcel MoolenaarMFSLABEL=		auto
219f16d1c7cSJohn BaldwinSEPARATE_LIVEFS=
2202d7d81e9SPeter Wemm.elif ${TARGET_ARCH} == "amd64"
2212d7d81e9SPeter WemmMFSSIZE=		4096
2222d7d81e9SPeter WemmMFSINODE=		8192
2232d7d81e9SPeter WemmMFSLABEL=		auto
224fa7bd283SPeter Grehan.elif ${TARGET_ARCH} == "powerpc"
225fa7bd283SPeter GrehanDISKLABEL=		""
226fa7bd283SPeter GrehanMFSSIZE=		4096
227fa7bd283SPeter GrehanMFSINODE=		8192
228fa7bd283SPeter GrehanMFSLABEL=		auto
2297f047619SJoerg Wunsch.endif
230f0414231SDavid E. O'Brien.if defined(NO_FLOPPIES)
231f0414231SDavid E. O'Brien.undef MAKE_FLOPPIES
232f0414231SDavid E. O'Brien.endif
2330202c140SRodney W. Grimes
2345795760cSRuslan Ermilov.if exists(/sbin/bsdlabel)
2355795760cSRuslan ErmilovDISKLABEL?=		bsdlabel
2365795760cSRuslan Ermilov.else
237c9030dc8SRuslan ErmilovDISKLABEL?=		disklabel
2385795760cSRuslan Ermilov.endif
239c9030dc8SRuslan Ermilov
240c0731f81SJohn BaldwinZIPNSPLIT=		gzip --no-name -9 -c | split -b 1392k -
24100063f88SPoul-Henning Kamp
2427284556fSJordan K. Hubbard# Things which may get you into trouble if you change them
24348327bc9SPoul-Henning KampMTREEFILES=		${.CURDIR}/../etc/mtree
24472995602SDavid E. O'Brien_R?=			/R
245335d64e6SJordan K. HubbardRD=			${_R}/stage
246febbbc67SBruce A. MahRND=			${RD}/release.doc
247335d64e6SJordan K. HubbardFD=			${_R}/ftp
248335d64e6SJordan K. HubbardCD=			${_R}/cdrom
2496daa108fSRuslan Ermilov.if ${TARGET} != "pc98"
2506daa108fSRuslan ErmilovCD_BOOT=		${CD}/bootonly
2516daa108fSRuslan Ermilov.endif
2521bac119bSJordan K. HubbardCD_DISC1=		${CD}/disc1
25392f6e2c8SJohn Baldwin.if defined(SEPARATE_LIVEFS)
2541bac119bSJordan K. HubbardCD_DISC2=		${CD}/disc2
25592f6e2c8SJohn BaldwinCD_LIVEFS=		${CD_DISC2}
25692f6e2c8SJohn Baldwin.else
25792f6e2c8SJohn BaldwinCD_LIVEFS=		${CD_DISC1}
25888f69650SKen Smith.endif
25992f6e2c8SJohn Baldwin_MK?=			${CHROOTDIR}/mk
26088f69650SKen Smith
2610c5b292cSJordan K. Hubbard# Where the bootstrap ports (see DOCPORTS) get installed.
2620c5b292cSJordan K. HubbardLOCALDIR=		/usr/local/bin
2630c5b292cSJordan K. Hubbard
264a4f9e93cSRuslan Ermilov.if ${TARGET} != ${MACHINE} && ${DISKLABEL} == "bsdlabel"
265c9030dc8SRuslan ErmilovDOFS_SH=	${.CURDIR}/scripts/doFS.sh ${DISKLABEL} ${TARGET}
266f3fb0a6cSMarcel Moolenaar.else
267c9030dc8SRuslan ErmilovDOFS_SH=	${.CURDIR}/scripts/doFS.sh ${DISKLABEL} ""
268f3fb0a6cSMarcel Moolenaar.endif
269f3fb0a6cSMarcel Moolenaar
270c26d9e5aSJake BurkholderCRUNCH_TARGETS=	boot
2713cd22041SRuslan Ermilov.if ${TARGET_ARCH} == "i386"
2723cd22041SRuslan ErmilovCRUNCH_TARGETS+=fixit
2733cd22041SRuslan Ermilov.if ${TARGET} == "pc98"
2743cd22041SRuslan ErmilovCRUNCH_TARGETS+=fixit-small
275c26d9e5aSJake Burkholder.endif
2763cd22041SRuslan Ermilov.endif
2773525074dSPoul-Henning Kamp
27894223a53SDavid E. O'Brien.if defined(MAKE_FLOPPIES)
279aaf3e5b0SJohn BaldwinEXTRAS= floppies.1
280aaf3e5b0SJohn Baldwin.if ${TARGET_ARCH} == "i386"
281aaf3e5b0SJohn BaldwinEXTRAS+= floppies.2
282aaf3e5b0SJohn Baldwin.endif
283aaf3e5b0SJohn BaldwinEXTRAS+= floppies.3
284c0731f81SJohn Baldwin.endif
285c0731f81SJohn BaldwinEXTRAS+= ftp.1
2860e25a727SJohn Baldwin.if !defined(NOCDROM)
28792f6e2c8SJohn BaldwinEXTRAS+= cdrom.1 cdrom.2 cdrom.3
2882ef74d22SJordan K. Hubbard.if defined(MAKE_ISOS)
2892ef74d22SJordan K. HubbardEXTRAS+= iso.1
29098f15514SMurray Stokely.endif
291d943f83bSJohn Baldwin.if ${TARGET} == "pc98"
2926ebe9601SRuslan ErmilovBOOTABLE=
2936ebe9601SRuslan Ermilov.else
29429921a60SYoshihiro TakahashiBOOTABLE="-b"
29529921a60SYoshihiro Takahashi.endif
2962ef74d22SJordan K. Hubbard.endif
297793e8c6fSJordan K. Hubbard
298793e8c6fSJordan K. Hubbard.if !defined(NODOC)
29921203b38SBruce A. MahDOCREL= doc.1 doc.2
300793e8c6fSJordan K. Hubbard.endif
301793e8c6fSJordan K. Hubbard
302e738d1eaSJohn Baldwin.if !make(release) && !make(rerelease) && !make(package-split)
3035dc63117SRuslan ErmilovBINMAKE!=	cd ${.CURDIR}/..; ${MAKE} -V BINMAKE
3045dc63117SRuslan ErmilovWMAKEENV!=	cd ${.CURDIR}/..; \
3055dc63117SRuslan Ermilov		${BINMAKE} ${CROSSENV} -f Makefile.inc1 -V WMAKEENV
3065dc63117SRuslan ErmilovWMAKE=		${WMAKEENV} ${BINMAKE}
3079b72ad91SRuslan Ermilov.endif
3086bde859fSRuslan Ermilov
309d9d84e07SJohn BaldwinCVS_SRCARGS=	-P
310d9d84e07SJohn Baldwin.if defined(RELEASETAG)
311d9d84e07SJohn BaldwinCVS_SRCARGS+=	-r ${RELEASETAG}
312d9d84e07SJohn Baldwin.endif
313d9d84e07SJohn Baldwin
314d9d84e07SJohn BaldwinCVS_DOCARGS=	-P
315d9d84e07SJohn Baldwin.if defined(DOCRELEASETAG)
316d9d84e07SJohn BaldwinCVS_DOCARGS+=	-r ${DOCRELEASETAG}
317d9d84e07SJohn Baldwin.endif
318d9d84e07SJohn Baldwin
319d9d84e07SJohn BaldwinCVS_PORTSARGS=	-P
320d9d84e07SJohn Baldwin.if defined(PORTSRELEASETAG)
321d9d84e07SJohn BaldwinCVS_PORTSARGS+=	-r ${PORTSRELEASETAG}
322d9d84e07SJohn Baldwin.endif
323d9d84e07SJohn Baldwin
32400a7eeebSRuslan ErmilovWORLDDIR?=	${.CURDIR}/..
32500a7eeebSRuslan Ermilov
326dba36bb9SRuslan Ermilovrelease rerelease:
327574c2247SJordan K. Hubbard.if !defined(CHROOTDIR) || !defined(BUILDNAME) || !defined(CVSROOT)
328574c2247SJordan K. Hubbard	@echo "To make a release you must set CHROOTDIR, BUILDNAME and CVSROOT" && false
3297eb11201SPoul-Henning Kamp.endif
330dd1a1b3dSJoerg Wunsch.if defined(NOPORTSATALL) && !defined(NODOC)
331d191a99cSJohn Baldwin	@echo "Ports are required for building the docs.  Either set NODOC or"
332dd1a1b3dSJoerg Wunsch	@echo "unset NOPORTS, or set at least DOMINIMALDOCPORTS to YES!"
333d191a99cSJohn Baldwin	@exit 1
334d191a99cSJohn Baldwin.endif
335db8714afSJohn Baldwin.if defined(LOCAL_PATCHES) && !empty(LOCAL_PATCHES)
336db8714afSJohn Baldwin.for p in ${LOCAL_PATCHES}
337db8714afSJohn Baldwin.if !exists(${p})
338db8714afSJohn Baldwin	@echo "The patch file ${p} does not exist!"
339db8714afSJohn Baldwin	@exit 1
340db8714afSJohn Baldwin.endif
341db8714afSJohn Baldwin.endfor
342db8714afSJohn Baldwin.endif
343db8714afSJohn Baldwin.if defined(LOCAL_SCRIPT) && !exists(${LOCAL_SCRIPT})
344db8714afSJohn Baldwin	@echo "The local script ${LOCAL_SCRIPT} does not exist!"
345db8714afSJohn Baldwin	@exit 1
346db8714afSJohn Baldwin.endif
347288fe4dbSPoul-Henning Kamp.if make(release)
348682078bdSRodney W. Grimes.if exists(${CHROOTDIR})
34972ac7e4dSJohn Polstra# The first command will fail on a handful of files that have their schg
35072ac7e4dSJohn Polstra# flags set.  But it greatly speeds up the next two commands.
35137c38153SRuslan Ermilov	# NB: clear any vestigial devfs mount, just in case
3526ceb41c2SSam Leffler	-umount ${CHROOTDIR}/dev > /dev/null 2>&1
35327b5e4fdSJordan K. Hubbard	-rm -rf ${CHROOTDIR} 2>/dev/null
35437966461SRuslan Ermilov	-chflags -R 0 ${CHROOTDIR}/.
355b7738481SJoerg Wunsch	-rm -rf ${CHROOTDIR}
356682078bdSRodney W. Grimes.endif
357335d64e6SJordan K. Hubbard	mkdir -p ${CHROOTDIR}
358b1a8a181SRuslan Ermilov	@echo ">>> make release for ${TARGET} started on `LC_ALL=C TZ=GMT date`"
359582ef25fSRuslan Ermilov	cd ${WORLDDIR} && ${NATIVEMAKE} -DNO_GAMES -DNO_HTML -DNO_INFO -DNO_MAN \
360ab7a2947SRuslan Ermilov	    -DNO_PROFILE installworld DESTDIR=${CHROOTDIR}
3613b090ef7SJohn Baldwin	cd ${WORLDDIR} && ${NATIVEMAKE} distribution DESTDIR=${CHROOTDIR}
3628e8d540fSSADA Kenji	if [ -f /etc/resolv.conf ]; then \
3638e8d540fSSADA Kenji		cp -p /etc/resolv.conf ${CHROOTDIR}/etc; \
3648e8d540fSSADA Kenji	fi
365d101bd64SYoshihiro Takahashi.if defined(EXTLOCALDIR)
366d101bd64SYoshihiro Takahashi	rm -rf ${CHROOTDIR}/usr/local
367a4b4ec99SJuli Mallett	cd ${CHROOTDIR}/usr && cp -R -H ${EXTLOCALDIR} local
368d101bd64SYoshihiro Takahashi.endif
369d9d84e07SJohn Baldwin	rm -rf ${CHROOTDIR}/usr/src
370d9d84e07SJohn Baldwin.if defined(EXTSRCDIR)
371d9d84e07SJohn Baldwin	cd ${CHROOTDIR}/usr && \
372a4b4ec99SJuli Mallett	    cp -R -H ${EXTSRCDIR} src
373bd668f6fSPoul-Henning Kamp.else
374d9d84e07SJohn Baldwin	cd ${CHROOTDIR}/usr && \
375b34a415eSDavid E. O'Brien	    ${CVSPREFIX} cvs -R ${CVSARGS} -d ${CVSROOT} \
376b34a415eSDavid E. O'Brien	    co ${CVSCMDARGS} ${CVS_SRCARGS} ${RELEASESRCMODULE}
377288fe4dbSPoul-Henning Kamp.endif
3789c758be2SRuslan Ermilov.if defined(LOCAL_PATCHES) && !empty(LOCAL_PATCHES)
3799c758be2SRuslan Ermilov.for p in ${LOCAL_PATCHES}
3808a34b67aSJun Kuriyama	patch -d ${CHROOTDIR}/usr/${RELEASESRCMODULE} ${PATCH_FLAGS} < ${p}
3819c758be2SRuslan Ermilov.endfor
38262bb2153SPaul Traina.endif
383db8714afSJohn Baldwin.if defined(LOCAL_SCRIPT)
384b34a415eSDavid E. O'Brien	cd ${CHROOTDIR} && env CHROOTDIR=${CHROOTDIR} BUILDNAME=${BUILDNAME} \
385b34a415eSDavid E. O'Brien	    RELEASETAG=${RELEASETAG} ${LOCAL_SCRIPT}
38648f1b394SJordan K. Hubbard.endif
387d9d84e07SJohn Baldwin	rm -rf ${CHROOTDIR}/usr/ports
388d9d84e07SJohn Baldwin.if !defined(NOPORTSATALL)
389b34a415eSDavid E. O'Brien	cd ${CHROOTDIR}/usr && ${CVSPREFIX} cvs -R ${CVSARGS} -d ${CVSROOT} \
390b34a415eSDavid E. O'Brien	    co ${CVSCMDARGS} ${CVS_PORTSARGS} ${RELEASEPORTSMODULE}
391d9d84e07SJohn Baldwin.endif
392aeb6d603SJordan K. Hubbard.if !defined(NODOC)
393d9d84e07SJohn Baldwin	rm -rf ${CHROOTDIR}/usr/doc
394d9d84e07SJohn Baldwin.if defined(EXTDOCDIR)
395a4b4ec99SJuli Mallett	cd ${CHROOTDIR}/usr && cp -R -H ${EXTDOCDIR} doc
3963f17d264SSatoshi Asami.else
397b34a415eSDavid E. O'Brien	cd ${CHROOTDIR}/usr && ${CVSPREFIX} cvs -R ${CVSARGS} -d ${CVSROOT} \
398b34a415eSDavid E. O'Brien	    co ${CVSCMDARGS} ${CVS_DOCARGS} ${RELEASEDOCMODULE}
3993f17d264SSatoshi Asami.endif
40040227c90SMakoto Matsushita	if [ -d ${RELEASEDISTFILES}/ ]; then \
40140227c90SMakoto Matsushita		cp -rp ${RELEASEDISTFILES} ${CHROOTDIR}/usr/ports/distfiles; \
402b389e7aaSMakoto Matsushita	else \
403d7c4abbfSMakoto Matsushita		mkdir -p ${CHROOTDIR}/usr/ports/distfiles; \
4048e8d540fSSADA Kenji	fi
4053ea0ca53SDavid E. O'Brien.if !defined(NO_PREFETCHDISTFILES)
4063ea0ca53SDavid E. O'Brien	@cd ${.CURDIR} && ${MAKE} fetch-distfiles
407bb5e8f3fSJohn Baldwin.endif
408aeb6d603SJordan K. Hubbard.endif
409288fe4dbSPoul-Henning Kamp.endif
410288fe4dbSPoul-Henning Kamp.if make(rerelease)
411288fe4dbSPoul-Henning Kamp.if !defined(RELEASENOUPDATE)
412288fe4dbSPoul-Henning Kamp.if !defined(RELEASETAG)
413b34a415eSDavid E. O'Brien	cd ${CHROOTDIR}/usr/src && ${CVSPREFIX} cvs -R ${CVSARGS} -q \
414b34a415eSDavid E. O'Brien	    update ${CVSCMDARGS} -P -d -A
415288fe4dbSPoul-Henning Kamp.else
416b34a415eSDavid E. O'Brien	cd ${CHROOTDIR}/usr/src && ${CVSPREFIX} cvs -R ${CVSARGS} -q \
417b34a415eSDavid E. O'Brien	    update ${CVSCMDARGS} -P -d -r ${RELEASETAG}
418288fe4dbSPoul-Henning Kamp.endif
419b4f72168SRuslan Ermilov	rm -f ${CHROOTDIR}/tmp/.world_done
42097febce7SJoerg Wunsch.if !defined(NOPORTS)
421b34a415eSDavid E. O'Brien	cd ${CHROOTDIR}/usr/ports && ${CVSPREFIX} cvs -R ${CVSARGS} -q \
422b34a415eSDavid E. O'Brien	    update ${CVSCMDARGS} -P -d
42392f6e2c8SJohn Baldwin	rm -f ${CHROOTDIR}/tmp/.skip_ports_index
4246e5cd2d2SJordan K. Hubbard.endif
425dd1a1b3dSJoerg Wunsch.if defined(DOMINIMALDOCPORTS) && ${DOMINIMALDOCPORTS} == "YES"
426dd1a1b3dSJoerg Wunsch	for i in ${MINIMALDOCPORTS}; do \
427b34a415eSDavid E. O'Brien	    ( cd ${CHROOTDIR}/usr/$$i && ${CVSPREFIX} cvs -R ${CVSARGS} -q \
428b34a415eSDavid E. O'Brien		update ${CVSCMDARGS} -P -d ) ; \
429dd1a1b3dSJoerg Wunsch	done
430dd1a1b3dSJoerg Wunsch.endif
431aeb6d603SJordan K. Hubbard.if !defined(NODOC)
432b34a415eSDavid E. O'Brien	cd ${CHROOTDIR}/usr/doc && ${CVSPREFIX} cvs -R ${CVSARGS} -q \
433b34a415eSDavid E. O'Brien	    update ${CVSCMDARGS} -P -d
434aeb6d603SJordan K. Hubbard.endif
435288fe4dbSPoul-Henning Kamp.endif
436bd668f6fSPoul-Henning Kamp.endif
4377284556fSJordan K. Hubbard	# Add version information to those things that need it.
438b4f72168SRuslan Ermilov	if [ ! -f ${CHROOTDIR}/tmp/.world_done ]; then \
439b4f72168SRuslan Ermilov		cd ${CHROOTDIR}/usr/src/sys/conf && \
440288fe4dbSPoul-Henning Kamp		mv newvers.sh foo && \
441b4f72168SRuslan Ermilov		sed "s/^RELEASE=.*/RELEASE=${BUILDNAME}/" foo > newvers.sh && \
442b4f72168SRuslan Ermilov		rm foo; \
443b4f72168SRuslan Ermilov	fi
444d4983966SPaul Traina	-test -f install.cfg && cp install.cfg ${CHROOTDIR}/usr/src/release
4450febff82SDavid E. O'Brien	echo "#!/bin/sh"			> ${_MK}
4460febff82SDavid E. O'Brien	echo "set -ex"				>> ${_MK}
4470febff82SDavid E. O'Brien	echo "trap 'umount /dev || true' 0"	>> ${_MK}
4480febff82SDavid E. O'Brien	echo "_RELTARGET=\$${1:-doRELEASE}"	>> ${_MK}
4497a7a00adSRuslan Ermilov.for var in \
4503e4ac74dSRuslan Ermilov	AUTO_KEYBOARD_DETECT \
4513e4ac74dSRuslan Ermilov	BUILDNAME \
4523e4ac74dSRuslan Ermilov	CD_EXTRA_BITS \
4534f27387dSKen Smith	DISC1_LABEL \
4544f27387dSKen Smith	DISC1_NAME \
4554f27387dSKen Smith	DISC2_LABEL \
4564f27387dSKen Smith	DISC2_NAME \
4573e4ac74dSRuslan Ermilov	DISTRIBUTIONS \
4583e4ac74dSRuslan Ermilov	DOC_LANG \
4593e4ac74dSRuslan Ermilov	DOMINIMALDOCPORTS \
4603e4ac74dSRuslan Ermilov	EXTRA_SRC \
46177d79f0cSMakoto Matsushita	FTP_PASSIVE_MODE \
46277d79f0cSMakoto Matsushita	FTP_PROXY \
46377d79f0cSMakoto Matsushita	HTTP_PROXY \
4643e4ac74dSRuslan Ermilov	KERNELS \
4653e4ac74dSRuslan Ermilov	KERNEL_FLAGS \
46694223a53SDavid E. O'Brien	MAKE_FLOPPIES \
4673e4ac74dSRuslan Ermilov	MAKE_ISOS \
4683e4ac74dSRuslan Ermilov	NOCDROM \
4693e4ac74dSRuslan Ermilov	NODOC \
4703e4ac74dSRuslan Ermilov	NOPORTS \
47183c7ade9SRuslan Ermilov	NO_SHARED \
4723e4ac74dSRuslan Ermilov	NOSRC \
4733e4ac74dSRuslan Ermilov	NO_CPU_CFLAGS \
4743e4ac74dSRuslan Ermilov	NO_CPU_COPTFLAGS \
475f0414231SDavid E. O'Brien	NO_FLOPPIES \
4763e4ac74dSRuslan Ermilov	NO_SENDMAIL \
4773e4ac74dSRuslan Ermilov	RELEASETAG \
4783e4ac74dSRuslan Ermilov	RELNOTES_LANG \
47992f6e2c8SJohn Baldwin	SEPARATE_LIVEFS \
4803e4ac74dSRuslan Ermilov	TARGET \
4813e4ac74dSRuslan Ermilov	TARGET_ARCH \
4823e4ac74dSRuslan Ermilov	WORLD_FLAGS
4837a7a00adSRuslan Ermilov.if defined(${var})
4840febff82SDavid E. O'Brien	echo "export ${var}=\"${${var}}\""	>> ${_MK}
48546e90709SJoerg Wunsch.endif
4867a7a00adSRuslan Ermilov.endfor
48743276d06SJoerg Wunsch	# Don't remove this, or the build will fall over!
4880febff82SDavid E. O'Brien	echo "export RELEASEDIR=${_R}"		>> ${_MK}
4890febff82SDavid E. O'Brien	echo "export PATH=/bin:/usr/bin:/sbin:/usr/sbin:${LOCALDIR}"	>> ${_MK}
4900febff82SDavid E. O'Brien	echo "export MANBUILDCAT=YES"		>> ${_MK}
4916ceb41c2SSam Leffler	# NB: these may fail if the host is running w/o devfs
4920febff82SDavid E. O'Brien	echo "umount /dev >/dev/null 2>&1 || true" >> ${_MK}
4930febff82SDavid E. O'Brien	echo "mount -t devfs devfs /dev >/dev/null 2>&1 || true"	>> ${_MK}
494d9aeaacbSMakoto Matsushita	echo "if [ -x /etc/rc.d/ldconfig ]; then" >> ${_MK}
495ab0a016cSYoshihiro Takahashi	echo "	/etc/rc.d/ldconfig start"	>> ${_MK}
496d9aeaacbSMakoto Matsushita	echo "else"				>> ${_MK}
497d9aeaacbSMakoto Matsushita	echo "	ldconfig /lib /usr/lib /usr/local/lib || true" >> ${_MK}
498d9aeaacbSMakoto Matsushita	echo "fi"				>> ${_MK}
4990febff82SDavid E. O'Brien	echo "if [ ! -f /tmp/.world_done ]; then" >> ${_MK}
5000febff82SDavid E. O'Brien	echo "	cd /usr/src"			>> ${_MK}
501f45a5bbdSRuslan Ermilov	echo "	${CROSSMAKE} ${WORLD_FLAGS} -DNO_CLEAN buildworld && \\" >> ${_MK}
502ab5e8655SBrian Somers	echo "	touch /tmp/.world_done || exit 1" >> ${_MK}
5030febff82SDavid E. O'Brien	echo "fi"				>> ${_MK}
504485b9268SKen Smith	echo "if [ ! -f /tmp/.skip_ports_index ]; then" >> ${_MK}
505485b9268SKen Smith	echo "	echo \">>> make index started on \`LC_ALL=C TZ=GMT date\`\"" >> ${_MK}
506485b9268SKen Smith	echo "	for i in ${MAKEINDEXPORTS}"	>> ${_MK}
507485b9268SKen Smith	echo "	do"			>> ${_MK}
508485b9268SKen Smith	echo "		cd /usr/ports/\$${i}"	>> ${_MK}
509485b9268SKen Smith	echo "		env -i FTP_PASSIVE_MODE=$${FTP_PASSIVE_MODE:-no} PATH=$${PATH} \\" >> ${_MK}
510485b9268SKen Smith	echo "		make all install clean BATCH=yes FORCE_PKG_REGISTER=yes" >> ${_MK}
511485b9268SKen Smith	echo "	done"				>> ${_MK}
512485b9268SKen Smith	echo "	cd /usr/ports"			>> ${_MK}
513485b9268SKen Smith	echo "	rm -f INDEX*"			>> ${_MK}
514485b9268SKen Smith	echo "	make index -DINDEX_PRISTINE"	>> ${_MK}
51588f69650SKen Smith	echo "	rm -f INDEX*.tmp"		>> ${_MK}
516485b9268SKen Smith	echo "	touch /tmp/.skip_ports_index"	>> ${_MK}
517485b9268SKen Smith	echo "	echo \">>> make index finished on \`LC_ALL=C TZ=GMT date\`\"" >> ${_MK}
518485b9268SKen Smith	echo "fi"				>> ${_MK}
5190febff82SDavid E. O'Brien	echo "cd /usr/src/release"		>> ${_MK}
5200febff82SDavid E. O'Brien	echo "make obj"				>> ${_MK}
5210febff82SDavid E. O'Brien	echo "make \$${_RELTARGET}"		>> ${_MK}
5220febff82SDavid E. O'Brien	echo "echo \">>> make ${.TARGET} for ${TARGET} finished on \`LC_ALL=C TZ=GMT date\`\"" >> ${_MK}
5230febff82SDavid E. O'Brien	chmod 755 ${_MK}
524485b9268SKen Smith.if defined(NOPORTS)
525485b9268SKen Smith	touch ${CHROOTDIR}/tmp/.skip_ports_index
526485b9268SKen Smith.endif
527b34a415eSDavid E. O'Brien	# Ensure md.ko is loaded if md(4) is not statically compiled into
528b34a415eSDavid E. O'Brien	# the kernel
5295262ab24SDavid E. O'Brien	-mdconfig 2>/dev/null
5305bff5851SDavid E. O'Brien	env -i /usr/sbin/chroot `dirname ${_MK}` /`basename ${_MK}`
53120e5d523SJordan K. Hubbard
532bd668f6fSPoul-Henning Kampclean:
5337b07d01fSRuslan Ermilov	rm -rf ${CRUNCH_TARGETS:S/$/_crunch/} release.[0-8] ${EXTRAS}
534bd668f6fSPoul-Henning Kamp
5353ea0ca53SDavid E. O'Brienfetch-distfiles:
536485b9268SKen Smith	@for i in ${MAKEINDEXPORTS}; do \
537485b9268SKen Smith		cd ${CHROOTDIR}/usr/ports/$$i && \
538485b9268SKen Smith			make PORTSDIR=${CHROOTDIR}/usr/ports BATCH=yes \
539485b9268SKen Smith			checksum-recursive ; \
540485b9268SKen Smith	done
5413ea0ca53SDavid E. O'Brien	@for i in ${DOCPORTS}; do \
5423ea0ca53SDavid E. O'Brien		cd ${CHROOTDIR}/usr/ports/$$i && \
5433ea0ca53SDavid E. O'Brien			make PORTSDIR=${CHROOTDIR}/usr/ports BATCH=yes \
5443ea0ca53SDavid E. O'Brien			WITHOUT_X11=yes JADETEX=no WITHOUT_PYTHON=yes \
5453ea0ca53SDavid E. O'Brien			checksum-recursive ; \
5463ea0ca53SDavid E. O'Brien	done
5473ea0ca53SDavid E. O'Brien
548335d64e6SJordan K. Hubbard# Clean out ${_R} and make the directory structure.
549bd668f6fSPoul-Henning Kamprelease.1:
550335d64e6SJordan K. Hubbard	mkdir -p ${_R}
551cd8d8dacSJordan K. Hubbard	-rm -rf ${_R}/* 2> /dev/null
552335d64e6SJordan K. Hubbard	-chflags -R noschg ${_R}/.
553335d64e6SJordan K. Hubbard	rm -rf ${_R}/*
554bd668f6fSPoul-Henning Kamp	mkdir ${RD}
55594223a53SDavid E. O'Brien.if defined(MAKE_FLOPPIES)
556bd668f6fSPoul-Henning Kamp	mkdir ${RD}/floppies
5571dae6ea9SRuslan Ermilov.endif
558e12c4355SPoul-Henning Kamp	mkdir ${RD}/trees
559bb91094aSPoul-Henning Kamp	mkdir ${RD}/kernels
560d943f83bSJohn Baldwin	for i in ${DISTRIBUTIONS}; do \
561288fe4dbSPoul-Henning Kamp		mkdir ${RD}/trees/$$i && \
56211017a68SMarcel Moolenaar		mtree -deU -f ${MTREEFILES}/BSD.root.dist \
563288fe4dbSPoul-Henning Kamp		    -p ${RD}/trees/$$i > /dev/null && \
56411017a68SMarcel Moolenaar		mtree -deU -f ${MTREEFILES}/BSD.usr.dist \
565288fe4dbSPoul-Henning Kamp		    -p ${RD}/trees/$$i/usr > /dev/null && \
56611017a68SMarcel Moolenaar		mtree -deU -f ${MTREEFILES}/BSD.include.dist \
567288fe4dbSPoul-Henning Kamp		    -p ${RD}/trees/$$i/usr/include > /dev/null && \
56811017a68SMarcel Moolenaar		mtree -deU -f ${MTREEFILES}/BSD.var.dist \
569e12c4355SPoul-Henning Kamp		    -p ${RD}/trees/$$i/var > /dev/null ; \
57048327bc9SPoul-Henning Kamp	done
571d3c93cefSRuslan Ermilov	touch ${.TARGET}
5727f986648SPoul-Henning Kamp
573bd668f6fSPoul-Henning Kamp# Install the system into the various distributions.
574bd668f6fSPoul-Henning Kamprelease.2:
57501df2ec3SDavid E. O'Brien	cd ${.CURDIR}/../etc && make distrib-dirs DESTDIR=${RD}/trees/base
576d885836cSRuslan Ermilov	cd ${.CURDIR}/.. && ${CROSSMAKE} ${WORLD_FLAGS} distributeworld \
577d885836cSRuslan Ermilov	    DISTDIR=${RD}/trees
578d3c93cefSRuslan Ermilov	touch ${.TARGET}
579ff85b6e3SRuslan Ermilov
58097febce7SJoerg Wunsch# Make and install the generic kernel(s).
5815355286aSColin Percivalrelease.3:
58216c61233SJordan K. Hubbard.for kernel in ${KERNELS}
5836bde859fSRuslan Ermilov	cd ${.CURDIR}/..; \
58474064f9fSRuslan Ermilov	${CROSSMAKE} ${KERNEL_FLAGS} -DNO_MODULES \
5856bde859fSRuslan Ermilov	    KERNCONF=${kernel} INSTKERNNAME=${kernel} kernel \
5866bde859fSRuslan Ermilov	    DESTDIR=${RD}/trees/base
58716c61233SJordan K. Hubbard.endfor
5886bde859fSRuslan Ermilov	# Install a standard boot kernel+modules.
5896bde859fSRuslan Ermilov	cd ${.CURDIR}/..; \
59074064f9fSRuslan Ermilov	${CROSSMAKE} ${KERNEL_FLAGS} \
5916bde859fSRuslan Ermilov	    kernel \
5926bde859fSRuslan Ermilov	    DESTDIR=${RD}/trees/base; \
5936bde859fSRuslan Ermilov	cd ${.CURDIR}/..; \
5948f1f55e9SRuslan Ermilov	${CROSSMAKE} ${KERNEL_FLAGS} -DNO_MODULES \
5955179f5c3SRuslan Ermilov	    reinstallkernel -DINSTALL_DEBUG \
5966bde859fSRuslan Ermilov	    DESTDIR=${RD}/trees/base
597d3c93cefSRuslan Ermilov	touch ${.TARGET}
598bd668f6fSPoul-Henning Kamp
59901feef2cSPoul-Henning Kamp# Make and install the three crunched binaries which live on the floppies.
600bd668f6fSPoul-Henning Kamp# You are not supposed to like this :-)
6015355286aSColin Percivalrelease.4:
602518a1d34SPoul-Henning Kamp	rm -rf ${RD}/crunch
603518a1d34SPoul-Henning Kamp	mkdir -p ${RD}/crunch
60458888af3SRuslan Ermilov.for j in ${CRUNCH_TARGETS}
6053cd22041SRuslan Ermilov.if exists(${.CURDIR}/${TARGET}/${j}_crunch.conf)
60658888af3SRuslan Ermilov	rm -rf ${j}_crunch
60758888af3SRuslan Ermilov	mkdir ${j}_crunch
608b34a415eSDavid E. O'Brien	cd ${j}_crunch; ${WMAKEENV} crunchgen -o \
609b34a415eSDavid E. O'Brien	    ${.CURDIR}/${TARGET}/${j}_crunch.conf
61058888af3SRuslan Ermilov	cd ${j}_crunch; ${WMAKE} -f ${j}_crunch.mk subclean
611eedbbe40SRuslan Ermilov	cd ${.CURDIR}/..; ${BINMAKE} -f Makefile.inc1 _build-tools
6129090f0c2SMarcel Moolenaar	cd ${j}_crunch; CFLAGS="-Os -pipe" ${WMAKE} -f ${j}_crunch.mk \
6139090f0c2SMarcel Moolenaar	    -DNO_CPU_CFLAGS all
61455ee3f14SRuslan Ermilov	${WMAKEENV} strip -R .comment ${j}_crunch/${j}_crunch
61558888af3SRuslan Ermilov	mv ${j}_crunch/${j}_crunch ${RD}/crunch/${j}
6163cd22041SRuslan Ermilov.endif
61758888af3SRuslan Ermilov.endfor
618d3c93cefSRuslan Ermilov	touch ${.TARGET}
619bd668f6fSPoul-Henning Kamp
62030e8b491SPoul-Henning Kamp#
62130e8b491SPoul-Henning Kamp# --==## Fix up the distributions. ##==--
62230e8b491SPoul-Henning Kamp#
6235355286aSColin Percivalrelease.5:
6247284556fSJordan K. Hubbard	# Create any "synthetic dists" now.
6257284556fSJordan K. Hubbard	@for i in ${DISTRIBUTIONS}; do \
6267284556fSJordan K. Hubbard		if [ -f ${.CURDIR}/scripts/$${i}-make.sh ]; then \
6277284556fSJordan K. Hubbard			echo -n "Running $$i dist creation script... "; \
62866422f5bSPeter Wemm			env RD=${RD} sh ${.CURDIR}/scripts/$${i}-make.sh || echo "$$i distribution script returned bad status."; \
62958183fc7SJordan K. Hubbard			echo "Done."; \
6307284556fSJordan K. Hubbard		fi \
6317284556fSJordan K. Hubbard	done \
6327284556fSJordan K. Hubbard
63330e8b491SPoul-Henning Kamp	# Remove all the directories we don't need.
63427d44115SPoul-Henning Kamp	-cd ${RD}/trees && \
635c6d8b958SDavid E. O'Brien		find ${OTHER_DISTS} -depth -type d -print | xargs rmdir
636d3c93cefSRuslan Ermilov	touch ${.TARGET}
637f14786ddSJordan K. Hubbard
63830e8b491SPoul-Henning Kamp#
6397284556fSJordan K. Hubbard# --==## Package up the tarballs from assembled trees ##==--
64030e8b491SPoul-Henning Kamp#
6415355286aSColin Percivalrelease.6:
64295e34bfcSJordan K. Hubbard	rm -rf ${RD}/dists
64395e34bfcSJordan K. Hubbard	mkdir -p ${RD}/dists
64495e34bfcSJordan K. Hubbard	@for i in ${DISTRIBUTIONS} ; \
64595e34bfcSJordan K. Hubbard	do \
64695e34bfcSJordan K. Hubbard		if [ -d ${RD}/trees/$${i} ] ; then \
64730e8b491SPoul-Henning Kamp			cd ${.CURDIR} && $(MAKE) doTARBALL \
64830e8b491SPoul-Henning Kamp				SD=${RD}/trees/$${i} \
649288fe4dbSPoul-Henning Kamp				TN=$$i TD=$$i ARG="." && \
65095e34bfcSJordan K. Hubbard			echo "$${i} distribution is finished."; \
65195e34bfcSJordan K. Hubbard		fi ; \
65295e34bfcSJordan K. Hubbard	done
6536daa108fSRuslan Ermilov.if !defined(NOPORTS)
6546daa108fSRuslan Ermilov	# XXX: Inline stripped version of doTARBALL
6556daa108fSRuslan Ermilov	@rm -rf ${RD}/dists/ports/ports*
6566daa108fSRuslan Ermilov	@mkdir -p ${RD}/dists/ports
6576daa108fSRuslan Ermilov	@echo rolling ports/ports tarball
658485b9268SKen Smith	@tar --exclude CVS --exclude 'ports/distfiles/*' \
65992f6e2c8SJohn Baldwin	  -czf ${RD}/dists/ports/ports.tgz -C /usr ports
6606daa108fSRuslan Ermilov	@cp ${.CURDIR}/scripts/ports-install.sh ${RD}/dists/ports/install.sh
6616daa108fSRuslan Ermilov	@(cd ${RD}/dists/ports; \
6626daa108fSRuslan Ermilov	  rm -f CHECKSUM.MD5; \
6636daa108fSRuslan Ermilov	  md5 * > CHECKSUM.MD5)
6646daa108fSRuslan Ermilov	@echo "ports distribution is finished."
6656daa108fSRuslan Ermilov.endif
666d3c93cefSRuslan Ermilov	touch ${.TARGET}
66795e34bfcSJordan K. Hubbard
66895e34bfcSJordan K. Hubbard
66930e8b491SPoul-Henning Kamp#
67030e8b491SPoul-Henning Kamp# --==## Make source dists ##==--
67130e8b491SPoul-Henning Kamp#
6725355286aSColin Percivalrelease.7:
6734731faa3SJordan K. Hubbard.if !defined(NOSRC)
674288fe4dbSPoul-Henning Kamp	@cd ${.CURDIR} && $(MAKE) doTARBALL SD=/usr/src \
67595e34bfcSJordan K. Hubbard		TD=src TN=sbase ARG="[A-Z]*"
676fb29e2cfSJordan K. Hubbard	@for i in `cd /usr/src && echo [a-z]*` ; do \
67730e8b491SPoul-Henning Kamp		if [ -d /usr/src/$$i ] ; then \
67830e8b491SPoul-Henning Kamp			cd ${.CURDIR} && $(MAKE) doTARBALL \
679470f825fSJordan K. Hubbard				TN=`echo s$$i | tr -d '.' | \
680470f825fSJordan K. Hubbard				    sed -e 's/usr/u/' \
681470f825fSJordan K. Hubbard					-e 's/kerberos5/krb5/'` \
68230e8b491SPoul-Henning Kamp				SD=/usr/src TD=src ARG="$$i" ; \
68395e34bfcSJordan K. Hubbard		fi ; \
68495e34bfcSJordan K. Hubbard	done
68540b0c0d9SPeter Wemm.if defined(EXTRA_SRC)
686288fe4dbSPoul-Henning Kamp	@set ${EXTRA_SRC} && \
68740b0c0d9SPeter Wemm	while [ $$# -ge 2 ] ; do \
68830e8b491SPoul-Henning Kamp		if [ -d /usr/src/$$1 ] ; then \
68930e8b491SPoul-Henning Kamp			cd ${.CURDIR} && $(MAKE) doTARBALL \
69030e8b491SPoul-Henning Kamp				SD=/usr/src TN="s$$2" TD=src ARG="$$1" ; \
69130e8b491SPoul-Henning Kamp		fi && shift && shift ; \
69240b0c0d9SPeter Wemm	done
69340b0c0d9SPeter Wemm.endif
694f9c18558SJordan K. Hubbard	(cd ${RD}/dists/src; rm -f CHECKSUM.MD5; md5 * > CHECKSUM.MD5)
69595e34bfcSJordan K. Hubbard	@echo "src distribution is finished."
6964731faa3SJordan K. Hubbard.endif
697d3c93cefSRuslan Ermilov	touch ${.TARGET}
69895e34bfcSJordan K. Hubbard
699c0731f81SJohn Baldwin# Build the memory root filesystem.
7005355286aSColin Percivalrelease.8:
70155852204SRuslan Ermilov	cp ${RD}/trees/base/etc/disktab /etc
702409f9329SJordan K. Hubbard	rm -rf ${RD}/mfsfd
703409f9329SJordan K. Hubbard	mkdir ${RD}/mfsfd
704409f9329SJordan K. Hubbard	cd ${RD}/mfsfd && \
705d3b19355SRuslan Ermilov		mkdir -p etc/defaults dev mnt stand/etc/defaults stand/help
7063df0e2afSPoul-Henning Kamp	@cd ${.CURDIR} && $(MAKE) installCRUNCH CRUNCH=boot \
707a91fd119SPoul-Henning Kamp		DIR=${RD}/mfsfd/stand ZIP=false
708dc2475c5SJohn Baldwin	( cd ${RD}/mfsfd && \
709dc2475c5SJohn Baldwin	  for dir in bin sbin ; do \
710dc2475c5SJohn Baldwin		ln -sf /stand $$dir; \
711dc2475c5SJohn Baldwin	  done )
7123cb04a4dSRuslan Ermilov	cp ${RD}/trees/base/sbin/dhclient-script ${RD}/mfsfd/stand
713af09f57dSMakoto Matsushita.if ${TARGET} == "pc98"
714b34a415eSDavid E. O'Brien	cp ${.CURDIR}/../etc/defaults/pccard.conf \
715b34a415eSDavid E. O'Brien	    ${RD}/mfsfd/etc/defaults/pccard.conf
71637c973e3SMurray Stokely.endif
717fead5c44SJohn Baldwin	cp ${.CURDIR}/../etc/usbd.conf ${RD}/mfsfd/etc/usbd.conf
718d3b19355SRuslan Ermilov	( for F in defaults/rc.conf netconfig protocols ; do \
71964dc0a3eSDavid E. O'Brien		sed -e '/^#.*$$/d' -e 's/[:space:]*#.*$$//g' \
72001df2ec3SDavid E. O'Brien		${RD}/trees/base/etc/$$F > ${RD}/mfsfd/stand/etc/$$F ; \
72164dc0a3eSDavid E. O'Brien	  done )
722a191fd1bSAlfred Perlstein	grep -E '^(ftp|nameserver|domain|sunrpc|cmd|nfsd)[^-\w]' \
7236bde859fSRuslan Ermilov	    ${RD}/trees/base/etc/services | \
72464dc0a3eSDavid E. O'Brien	    sed -e '/^#.*$$/d' -e 's/[:space:]*#.*$$//g' \
72564dc0a3eSDavid E. O'Brien	    > ${RD}/mfsfd/stand/etc/services
726bc5ffda6SJun Kuriyama	grep 'operator' ${RD}/trees/base/etc/group \
727bc5ffda6SJun Kuriyama	    > ${RD}/mfsfd/stand/etc/group
728a191fd1bSAlfred Perlstein	ln ${RD}/mfsfd/stand/etc/services ${RD}/mfsfd/etc/services
729bc5ffda6SJun Kuriyama	ln ${RD}/mfsfd/stand/etc/group ${RD}/mfsfd/etc/group
730a191fd1bSAlfred Perlstein	ln ${RD}/mfsfd/stand/etc/netconfig ${RD}/mfsfd/etc/netconfig
731407ac59aSJohn Hay	cp ${RD}/trees/base/COPYRIGHT ${RD}/mfsfd/stand/help/COPYRIGHT.hlp
73221203b38SBruce A. Mah.if !defined(NODOC)
7338ed3802bSBruce A. Mah	@for i in ${DIST_DOCS_ARCH_INDEP}; do \
734b34a415eSDavid E. O'Brien	  cp ${RND}/${RELNOTES_LANG}/$$i/article.txt \
735b34a415eSDavid E. O'Brien	      ${RD}/mfsfd/stand/help/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
7368ed3802bSBruce A. Mah	done
7378ed3802bSBruce A. Mah	@for i in ${DIST_DOCS_ARCH_DEP}; do \
738b34a415eSDavid E. O'Brien	  cp ${RND}/${RELNOTES_LANG}/$$i/${TARGET}/article.txt \
739b34a415eSDavid E. O'Brien	      ${RD}/mfsfd/stand/help/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
7408ed3802bSBruce A. Mah	done
741b34a415eSDavid E. O'Brien	@mv ${RD}/mfsfd/stand/help/INSTALLATION.TXT \
742b34a415eSDavid E. O'Brien	    ${RD}/mfsfd/stand/help/INSTALL.TXT
7438ed3802bSBruce A. Mah.endif
744b34a415eSDavid E. O'Brien	-test -f ${.CURDIR}/install.cfg \
745b34a415eSDavid E. O'Brien	    && cp ${.CURDIR}/install.cfg ${RD}/mfsfd
74671696ba3SJordan K. Hubbard	@mkdir -p ${RD}/mfsfd/boot
747fa7bd283SPeter Grehan.if ${TARGET_ARCH} != "ia64" && ${TARGET_ARCH} != "powerpc"
7486bde859fSRuslan Ermilov	@cp ${RD}/trees/base/boot/boot* ${RD}/mfsfd/boot
749710d4ca3SMarcel Moolenaar.endif
750c07665ebSPeter Wemm.if ${TARGET} == "i386" || ${TARGET_ARCH} == "amd64"
7516bde859fSRuslan Ermilov	@cp ${RD}/trees/base/boot/mbr ${RD}/mfsfd/boot
752c06157d4SRuslan Ermilov.endif
7536bde859fSRuslan Ermilov	@tar --exclude CVS -cf - -C ${.CURDIR}/../usr.sbin/sysinstall help | \
75492e86f99SJordan K. Hubbard		tar xf - -C ${RD}/mfsfd/stand
7556daa108fSRuslan Ermilov	@mkdir -p ${RD}/mfsroot
7568bf7ab35SRuslan Ermilov	sh -e ${DOFS_SH} ${RD}/mfsroot/mfsroot ${RD} ${MNT} \
7573d610ec8SRuslan Ermilov	    ${MFSSIZE} ${RD}/mfsfd ${MFSINODE} ${MFSLABEL}
758d943f83bSJohn Baldwin	@gzip -9fnv ${RD}/mfsroot/mfsroot
7593d610ec8SRuslan Ermilov	touch ${.TARGET}
7603d610ec8SRuslan Ermilov
761c0731f81SJohn BaldwinKERNFLOPPYSET=		${RD}/floppyset/kern/kernel.gz
762c0731f81SJohn Baldwin.if defined(SMALLFLOPPYSIZE)
763c0731f81SJohn BaldwinSMALLKERNFLOPPYSET=	${RD}/floppyset/kern-small/kernel.gz
764319f35a3SRuslan Ermilov.endif
765c0731f81SJohn Baldwin.if defined(SPLIT_MFSROOT)
766c0731f81SJohn BaldwinMFSROOTFLOPPYSET=	${RD}/floppyset/mfsroot/mfsroot.gz
767c0731f81SJohn Baldwin.if defined(SMALLFLOPPYSIZE)
768c0731f81SJohn BaldwinSMALLMFSROOTFLOPPYSET=	${RD}/floppyset/mfsroot-small/mfsroot.gz
769c26d9e5aSJake Burkholder.endif
7704a2d414fSRuslan Ermilov.endif
771c0731f81SJohn Baldwin
772c0731f81SJohn Baldwin# Build boot and install floppies.
773c0731f81SJohn Baldwinfloppies.1:
774c0731f81SJohn Baldwin	@gzip -9nc ${RD}/trees/base/boot/kernel/kernel > ${RD}/kernels/kernel.gz
775c0731f81SJohn Baldwin	@echo "Making the kernel boot floppies..."
776c0731f81SJohn Baldwin	@cd ${.CURDIR} && ${MAKE} makeFloppySet FLOPPYBASE=kern \
777c0731f81SJohn Baldwin	    FLOPPYDESC="Kernel" SPLITFILE=${RD}/kernels/kernel.gz
778c0731f81SJohn Baldwin.if defined(SMALLFLOPPYSIZE)
779c0731f81SJohn Baldwin	@echo "Making the small kernel boot floppies..."
780c0731f81SJohn Baldwin	@cd ${.CURDIR} && ${MAKE} makeFloppySet FLOPPYBASE=kern-small \
781c0731f81SJohn Baldwin	    FLOPPYDESC="Kernel" SPLITFILE=${RD}/kernels/kernel.gz \
782c0731f81SJohn Baldwin	    FDSIZE="SMALL"
783a40915d7SYoshihiro Takahashi.endif
784c0731f81SJohn Baldwin.if defined(SPLIT_MFSROOT)
785c0731f81SJohn Baldwin	@echo "Making the mfsroot boot floppies..."
786c0731f81SJohn Baldwin	@cd ${.CURDIR} && ${MAKE} makeFloppySet FLOPPYBASE=mfsroot \
787c0731f81SJohn Baldwin	    FLOPPYDESC="Memory Filesystem" SPLITFILE=${RD}/mfsroot/mfsroot.gz
788c0731f81SJohn Baldwin.if defined(SMALLFLOPPYSIZE)
789c0731f81SJohn Baldwin	@echo "Making the small mfsroot boot floppies..."
790c0731f81SJohn Baldwin	@cd ${.CURDIR} && ${MAKE} makeFloppySet FLOPPYBASE=mfsroot-small \
791c0731f81SJohn Baldwin	    FLOPPYDESC="Memory Filesystem" SPLITFILE=${RD}/mfsroot/mfsroot.gz \
792c0731f81SJohn Baldwin	    FDSIZE="SMALL"
793c0731f81SJohn Baldwin.endif
794c0731f81SJohn Baldwin	@cd ${.CURDIR} && ${MAKE} buildBootFloppy FSIMAGE="boot" \
795c0731f81SJohn Baldwin	    KERNFILE="${KERNFLOPPYSET}.split ${KERNFLOPPYSET}.boot" \
796c0731f81SJohn Baldwin	    MFSROOTFILE="${MFSROOTFLOPPYSET}.split ${MFSROOTFLOPPYSET}.boot"
797c0731f81SJohn Baldwin.if defined(SMALLFLOPPYSIZE)
7986ab88893SYoshihiro Takahashi	@cd ${.CURDIR} && ${MAKE} buildBootFloppy FSIMAGE="boot-small" \
799c0731f81SJohn Baldwin	    KERNFILE="${SMALLKERNFLOPPYSET}.split ${SMALLKERNFLOPPYSET}.boot" \
800c0731f81SJohn Baldwin	    MFSROOTFILE="${SMALLMFSROOTFLOPPYSET}.split ${SMALLMFSROOTFLOPPYSET}.boot" \
801c0731f81SJohn Baldwin	    FDSIZE="SMALL"
802c0731f81SJohn Baldwin.endif
803c0731f81SJohn Baldwin.else	# !SPLIT_MFSROOT
804c0731f81SJohn Baldwin	@cd ${.CURDIR} && ${MAKE} buildBootFloppy FSIMAGE="boot" \
805c0731f81SJohn Baldwin	    KERNFILE="${KERNFLOPPYSET}.split ${KERNFLOPPYSET}.boot" \
806c0731f81SJohn Baldwin	    MFSROOTFILE=${RD}/mfsroot/mfsroot.gz
807c0731f81SJohn Baldwin.if defined(SMALLFLOPPYSIZE)
8086ab88893SYoshihiro Takahashi	@cd ${.CURDIR} && ${MAKE} buildBootFloppy FSIMAGE="boot-small" \
809c0731f81SJohn Baldwin	    KERNFILE="${SMALLKERNFLOPPYSET}.split ${SMALLKERNFLOPPYSET}.boot" \
810c0731f81SJohn Baldwin	    MFSROOTFILE=${RD}/mfsroot/mfsroot.gz \
811c0731f81SJohn Baldwin	    FDSIZE="SMALL"
812c0731f81SJohn Baldwin.endif
813c0731f81SJohn Baldwin.endif	# SPLIT_MFSROOT
814c0731f81SJohn Baldwin	touch ${.TARGET}
815c0731f81SJohn Baldwin
816c0731f81SJohn Baldwin# Build fixit floppy.
817c0731f81SJohn Baldwinfloppies.2:
81892e86f99SJordan K. Hubbard	@echo "Making fixit floppy."
81992e86f99SJordan K. Hubbard	@rm -rf ${RD}/fixitfd
82092e86f99SJordan K. Hubbard	@mkdir ${RD}/fixitfd
82192e86f99SJordan K. Hubbard	@cd ${RD}/fixitfd && \
822fbc6f9e0SJoerg Wunsch	    mkdir -p dev stand bin sbin etc mnt mnt1 mnt2 mnt3 mnt4 tmp \
823d26a815bSJordan K. Hubbard	    usr/share/misc
82401df2ec3SDavid E. O'Brien	@cp ${RD}/trees/base/etc/spwd.db ${RD}/trees/base/etc/group \
825ef812d2fSJun Kuriyama	    ${RD}/fixitfd/etc
826ef812d2fSJun Kuriyama	@sed -e 's/#.*//' ${RD}/trees/base/etc/protocols \
827ef812d2fSJun Kuriyama	    > ${RD}/fixitfd/etc/protocols
828ef812d2fSJun Kuriyama	@sed -e 's/#.*//' ${RD}/trees/base/usr/share/misc/scsi_modes \
829ef812d2fSJun Kuriyama	    > ${RD}/fixitfd/usr/share/misc/scsi_modes
83092e86f99SJordan K. Hubbard	@cp ${.CURDIR}/fixit.profile ${RD}/fixitfd/.profile
83192e86f99SJordan K. Hubbard	@cp ${.CURDIR}/fixit.services ${RD}/fixitfd/etc/services
83292e86f99SJordan K. Hubbard	@cp ${.CURDIR}/scripts/tar.sh ${RD}/fixitfd/stand/tar
83392e86f99SJordan K. Hubbard	@chmod 555 ${RD}/fixitfd/stand/tar
834c0731f81SJohn Baldwin.if defined(SMALLFLOPPYSIZE)
835c2bed627SYoshihiro Takahashi	@cd ${.CURDIR} && ${MAKE} installCRUNCH CRUNCH=fixit-small \
836c2bed627SYoshihiro Takahashi	    DIR=${RD}/fixitfd/stand ZIP=false
837b34a415eSDavid E. O'Brien	@sh -e ${DOFS_SH} ${RD}/floppies/fixit-small.flp ${RD} ${MNT} \
838c0731f81SJohn Baldwin	    ${SMALLFLOPPYSIZE} ${RD}/fixitfd ${FLOPPYINODE} ${SMALLFLOPPYLABEL}
839c2bed627SYoshihiro Takahashi	@rm -rf ${RD}/fixitfd/stand
840c2bed627SYoshihiro Takahashi	@mkdir ${RD}/fixitfd/stand
841c2bed627SYoshihiro Takahashi.endif
842c2bed627SYoshihiro Takahashi	@cd ${.CURDIR} && ${MAKE} installCRUNCH CRUNCH=fixit \
843c2bed627SYoshihiro Takahashi	    DIR=${RD}/fixitfd/stand ZIP=false
844b34a415eSDavid E. O'Brien	@sh -e ${DOFS_SH} ${RD}/floppies/fixit.flp ${RD} ${MNT} \
845c0731f81SJohn Baldwin	    ${FLOPPYSIZE} ${RD}/fixitfd ${FLOPPYINODE} ${FLOPPYLABEL}
846c0731f81SJohn Baldwin	touch ${.TARGET}
847c0731f81SJohn Baldwin
848c0731f81SJohn Baldwin# Do our last minute floppies directory setup
849c0731f81SJohn Baldwinfloppies.3:
85021203b38SBruce A. Mah.if !defined(NODOC)
8514ffc41abSYoshihiro Takahashi	@cp ${RND}/${RELNOTES_LANG}/installation/${TARGET}/article.txt \
85213fc8773SBruce A. Mah	    ${RD}/floppies/README.TXT
8534b861c74STatsumi Hosokawa	@(cd ${RD}/floppies; md5 README.TXT *.flp > CHECKSUM.MD5)
85413fc8773SBruce A. Mah.else
85513fc8773SBruce A. Mah	@(cd ${RD}/floppies; md5 *.flp > CHECKSUM.MD5)
85613fc8773SBruce A. Mah.endif
857d3c93cefSRuslan Ermilov	touch ${.TARGET}
8583bc93c76SPoul-Henning Kamp
85930e8b491SPoul-Henning Kamp#
86030e8b491SPoul-Henning Kamp# --==## Setup a suitable ftp-area ##==--
86130e8b491SPoul-Henning Kamp#
862e12c4355SPoul-Henning Kampftp.1:
86392e86f99SJordan K. Hubbard	@echo "Setting up FTP distribution area"
86492e86f99SJordan K. Hubbard	@mkdir -p ${FD}
86534594ab9SJordan K. Hubbard	-@ln -s . ${FD}/${BUILDNAME}
86694223a53SDavid E. O'Brien.if defined(MAKE_FLOPPIES)
86792e86f99SJordan K. Hubbard	@cd ${RD} && find floppies -print | cpio -dumpl ${FD}
8681dae6ea9SRuslan Ermilov.endif
86992e86f99SJordan K. Hubbard	@cd ${RD}/dists && find . -print | cpio -dumpl ${FD}
87021203b38SBruce A. Mah.if !defined(NODOC)
8718ed3802bSBruce A. Mah	@for i in ${DIST_DOCS_ARCH_INDEP}; do \
872b34a415eSDavid E. O'Brien		cp ${RND}/${RELNOTES_LANG}/$$i/article.txt \
873b34a415eSDavid E. O'Brien		    ${FD}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
874b34a415eSDavid E. O'Brien		cp ${RND}/${RELNOTES_LANG}/$$i/article.html \
875b34a415eSDavid E. O'Brien		    ${FD}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \
8768ed3802bSBruce A. Mah	done
8778ed3802bSBruce A. Mah	@for i in ${DIST_DOCS_ARCH_DEP}; do \
878b34a415eSDavid E. O'Brien		cp ${RND}/${RELNOTES_LANG}/$$i/${TARGET}/article.txt \
879b34a415eSDavid E. O'Brien		    ${FD}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
880b34a415eSDavid E. O'Brien		cp ${RND}/${RELNOTES_LANG}/$$i/${TARGET}/article.html \
881b34a415eSDavid E. O'Brien		    ${FD}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \
8828ed3802bSBruce A. Mah	done
883febbbc67SBruce A. Mah	@cp ${RND}/${RELNOTES_LANG}/readme/docbook.css ${FD}
8848ed3802bSBruce A. Mah	@mv ${FD}/INSTALLATION.TXT ${FD}/INSTALL.TXT
8858ed3802bSBruce A. Mah	@mv ${FD}/INSTALLATION.HTM ${FD}/INSTALL.HTM
8868ed3802bSBruce A. Mah.endif
88792e86f99SJordan K. Hubbard	@echo "CD_VERSION = ${BUILDNAME}" > ${FD}/cdrom.inf
888d3c93cefSRuslan Ermilov	touch ${.TARGET}
8893bc93c76SPoul-Henning Kamp
89092f6e2c8SJohn Baldwin# Build a live filesystem cdrom image
891c5b0a909SPoul-Henning Kampcdrom.1:
89292f6e2c8SJohn Baldwin	@echo "Building CDROM live filesystem image"
89392f6e2c8SJohn Baldwin	@mkdir -p ${CD_LIVEFS}
89492e86f99SJordan K. Hubbard	@for i in ${DISTRIBUTIONS} ; \
895c5b0a909SPoul-Henning Kamp	do \
896c5b0a909SPoul-Henning Kamp		if [ -d ${RD}/trees/$${i} ] ; then \
897ad5ebf3fSDag-Erling Smørgrav			chflags -R noschg ${RD}/trees/$${i} || true ; \
89801feef2cSPoul-Henning Kamp			( cd ${RD}/trees/$${i} && \
89992f6e2c8SJohn Baldwin			    find . -depth -print | cpio -dumpl ${CD_LIVEFS} ) ; \
900c5b0a909SPoul-Henning Kamp		fi \
901c5b0a909SPoul-Henning Kamp	done
90292f6e2c8SJohn Baldwin	@rm -f ${CD_LIVEFS}/.profile
90392f6e2c8SJohn Baldwin	@cp ${.CURDIR}/fixit.profile ${CD_LIVEFS}/.profile
90492f6e2c8SJohn Baldwin.if ${TARGET} != "pc98"
90592f6e2c8SJohn Baldwin	@echo "Setting up CDROM boot area"
90692f6e2c8SJohn Baldwin	@rm -f ${CD_LIVEFS}/boot/loader.conf
90792f6e2c8SJohn Baldwin	@cp ${RD}/mfsroot/mfsroot.gz ${CD_LIVEFS}/boot/mfsroot.gz
90892f6e2c8SJohn Baldwin	@echo 'mfsroot_load="YES"' > ${CD_LIVEFS}/boot/loader.conf
90992f6e2c8SJohn Baldwin	@echo 'mfsroot_type="mfs_root"' >> ${CD_LIVEFS}/boot/loader.conf
91092f6e2c8SJohn Baldwin	@echo 'mfsroot_name="/boot/mfsroot"' >> ${CD_LIVEFS}/boot/loader.conf
91192f6e2c8SJohn Baldwin.if exists(${RD}/trees/base/boot/device.hints)
91292f6e2c8SJohn Baldwin	# Break the link to device.hints so we can modify it
91392f6e2c8SJohn Baldwin	@rm -f ${CD_LIVEFS}/boot/device.hints
91492f6e2c8SJohn Baldwin	@cp ${RD}/trees/base/boot/device.hints ${CD_LIVEFS}/boot/device.hints
91592f6e2c8SJohn Baldwin.if ${TARGET} == "i386" || ${TARGET_ARCH} == "amd64"
91692f6e2c8SJohn Baldwin	@echo 'hint.atkbd.0.flags="0x1"' >> ${CD_LIVEFS}/boot/device.hints
917485b9268SKen Smith.endif
91892f6e2c8SJohn Baldwin.endif
91992f6e2c8SJohn Baldwin.endif
92092f6e2c8SJohn Baldwin	@echo "CD_VERSION = ${BUILDNAME}" > ${CD_LIVEFS}/cdrom.inf
92192f6e2c8SJohn Baldwin	touch ${.TARGET}
92292f6e2c8SJohn Baldwin
92392f6e2c8SJohn Baldwin# Build disc1 cdrom image
92492f6e2c8SJohn Baldwincdrom.2:
92592f6e2c8SJohn Baldwin	@echo "Building CDROM disc1 filesystem image"
92692f6e2c8SJohn Baldwin	@mkdir -p ${CD_DISC1}/${BUILDNAME}
92792f6e2c8SJohn Baldwin.if defined(MAKE_FLOPPIES)
92892f6e2c8SJohn Baldwin	@cd ${RD} && find floppies -print | cpio -dumpl ${CD_DISC1}
92992f6e2c8SJohn Baldwin.endif
93092f6e2c8SJohn Baldwin	@cd ${RD}/dists && find . -print | cpio -dumpl ${CD_DISC1}/${BUILDNAME}
93121203b38SBruce A. Mah.if !defined(NODOC)
9328ed3802bSBruce A. Mah	@for i in ${DIST_DOCS_ARCH_INDEP}; do \
933b34a415eSDavid E. O'Brien	  cp ${RND}/${RELNOTES_LANG}/$$i/article.txt \
934b34a415eSDavid E. O'Brien	      ${CD_DISC1}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
935b34a415eSDavid E. O'Brien	  cp ${RND}/${RELNOTES_LANG}/$$i/article.html \
936b34a415eSDavid E. O'Brien	      ${CD_DISC1}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \
9378ed3802bSBruce A. Mah	done
9388ed3802bSBruce A. Mah	@for i in ${DIST_DOCS_ARCH_DEP}; do \
939b34a415eSDavid E. O'Brien	  cp ${RND}/${RELNOTES_LANG}/$$i/${TARGET}/article.txt \
940b34a415eSDavid E. O'Brien	      ${CD_DISC1}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
941b34a415eSDavid E. O'Brien	  cp ${RND}/${RELNOTES_LANG}/$$i/${TARGET}/article.html \
942b34a415eSDavid E. O'Brien	      ${CD_DISC1}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \
9438ed3802bSBruce A. Mah	done
944febbbc67SBruce A. Mah	@cp ${RND}/${RELNOTES_LANG}/readme/docbook.css ${CD_DISC1}
9458ed3802bSBruce A. Mah	@mv ${CD_DISC1}/INSTALLATION.TXT ${CD_DISC1}/INSTALL.TXT
9468ed3802bSBruce A. Mah	@mv ${CD_DISC1}/INSTALLATION.HTM ${CD_DISC1}/INSTALL.HTM
9478ed3802bSBruce A. Mah.endif
94892f6e2c8SJohn Baldwin.if defined(SEPARATE_LIVEFS)
94992f6e2c8SJohn Baldwin	@cp -Rp ${CD_LIVEFS}/boot ${CD_DISC1}
95092f6e2c8SJohn Baldwin	@echo "CD_VERSION = ${BUILDNAME}" > ${CD_DISC1}/cdrom.inf
951f09470adSBrooks Davis.endif
95292f6e2c8SJohn Baldwin	touch ${.TARGET}
95392f6e2c8SJohn Baldwin
95492f6e2c8SJohn Baldwin#
95592f6e2c8SJohn Baldwin# --==## Setup a suitable cdrom-area ##==--
95692f6e2c8SJohn Baldwin#
95792f6e2c8SJohn Baldwincdrom.3:
9586daa108fSRuslan Ermilov.if defined(CD_BOOT)
95992f6e2c8SJohn Baldwin	@echo "Building bootonly CDROM filesystem image"
96092f6e2c8SJohn Baldwin	@mkdir -p ${CD_BOOT}
96192f6e2c8SJohn Baldwin	@cp -Rp ${CD_LIVEFS}/boot ${CD_BOOT}
962a4f9e93cSRuslan Ermilov.if defined(MINIROOT)
96392f6e2c8SJohn Baldwin	@echo "Building bootonly UFS filesystem image"
964a4f9e93cSRuslan Ermilov	@mkdir -p ${FD}/miniroot
965a4f9e93cSRuslan Ermilov	@sh -e ${DOFS_SH} ${FD}/miniroot/miniroot.ufs \
966a4f9e93cSRuslan Ermilov	    ${RD} ${MNT} 0 ${CD_BOOT} 8192 auto
967a4f9e93cSRuslan Ermilov	@gzip -9v ${FD}/miniroot/miniroot.ufs
968a4f9e93cSRuslan Ermilov.endif
969dfbc75ffSYoshihiro Takahashi.endif
970d3c93cefSRuslan Ermilov	touch ${.TARGET}
971c5b0a909SPoul-Henning Kamp
9722ef74d22SJordan K. Hubbardiso.1:
973c1fc2282SRuslan Ermilov.if exists(${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh)
97430fa4984SDavid E. O'Brien	@echo "Creating ISO images..."
9756daa108fSRuslan Ermilov.if defined(CD_BOOT)
9766daa108fSRuslan Ermilov	@sh ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh ${BOOTABLE} \
9776daa108fSRuslan Ermilov	    fbsd_bootonly \
9786daa108fSRuslan Ermilov	    ${CD}/${BUILDNAME}-${TARGET}-bootonly.iso ${CD_BOOT}
9796daa108fSRuslan Ermilov.endif
98030fa4984SDavid E. O'Brien	@sh ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh ${BOOTABLE} \
9814f27387dSKen Smith	    ${DISC1_LABEL} \
98292f6e2c8SJohn Baldwin	    ${CD}/${BUILDNAME}-${TARGET}-${DISC1_NAME}.iso ${CD_DISC1} \
98392f6e2c8SJohn Baldwin	    ${CD_EXTRA_BITS}
98492f6e2c8SJohn Baldwin.if defined(SEPARATE_LIVEFS)
98530fa4984SDavid E. O'Brien	@sh ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh ${BOOTABLE} \
9864f27387dSKen Smith	    ${DISC2_LABEL} \
9874f27387dSKen Smith	    ${CD}/${BUILDNAME}-${TARGET}-${DISC2_NAME}.iso ${CD_DISC2}
98830fa4984SDavid E. O'Brien.endif
989eb9bb3eeSDavid E. O'Brien	@(cd ${CD} && md5 *.iso > ${BUILDNAME}-${TARGET}-iso.CHECKSUM.MD5)
990d3c93cefSRuslan Ermilov	touch ${.TARGET}
99130fa4984SDavid E. O'Brien.else
992c1fc2282SRuslan Ermilov	@echo "Do not know how to create an ISO for ${TARGET_ARCH}."
99330fa4984SDavid E. O'Brien.endif
9942ef74d22SJordan K. Hubbard
9958ed3802bSBruce A. Mah#
9968ed3802bSBruce A. Mah# --==## Documentation Project files such as the Handbook and FAQ ##==--
9978ed3802bSBruce A. Mah#
998793e8c6fSJordan K. Hubbarddoc.1:
99992e86f99SJordan K. Hubbard	@echo "Making docs..."
100092e86f99SJordan K. Hubbard	@for i in ${DOCPORTS}; do \
1001da037ed3SRuslan Ermilov	    cd /usr/ports/$$i && \
1002cd9568c7SMarcel Moolenaar	    env -i FTP_PASSIVE_MODE=$${FTP_PASSIVE_MODE:-no} PATH=$${PATH} \
1003cd9568c7SMarcel Moolenaar		make all install clean BATCH=yes WITHOUT_X11=yes JADETEX=no \
1004cd9568c7SMarcel Moolenaar		WITHOUT_PYTHON=yes FORCE_PKG_REGISTER=yes; \
1005b59d8897SJordan K. Hubbard	done
1006b34a415eSDavid E. O'Brien	@cd /usr/doc && make all install 'FORMATS=html html-split txt' \
10079f2d40abSHiroki Sato	    INSTALL_COMPRESSED='' DOCDIR=${RD}/trees/base/usr/share/doc \
10089f2d40abSHiroki Sato	    URLS_ABSOLUTE=YES
1009d3c93cefSRuslan Ermilov	touch ${.TARGET}
1010793e8c6fSJordan K. Hubbard
10118ed3802bSBruce A. Mah#
10128ed3802bSBruce A. Mah# --==## RELNOTESng:  Next-generation replacements for *.TXT files ##==--
10138ed3802bSBruce A. Mah#
10148ed3802bSBruce A. Mahdoc.2:
10158ed3802bSBruce A. Mah	@echo "Making release documentation..."
1016ba547cb4SYoshihiro Takahashi	@cd ${.CURDIR}/doc && make all install clean 'FORMATS=html txt' \
101752957bbfSBruce A. Mah	    INSTALL_COMPRESSED='' URLS_ABSOLUTE=YES DOCDIR=${RND}
1018d3c93cefSRuslan Ermilov	touch ${.TARGET}
10198ed3802bSBruce A. Mah
10207eb11201SPoul-Henning Kamp# Various "subroutine" and other supporting targets.
10217eb11201SPoul-Henning Kamp
1022470f825fSJordan K. Hubbard# RD=
1023470f825fSJordan K. Hubbard# SD=
1024470f825fSJordan K. Hubbard# TD=
1025470f825fSJordan K. Hubbard# ARG=
1026bd668f6fSPoul-Henning KampdoTARBALL:
1027bd668f6fSPoul-Henning Kamp.if !defined(SD)
1028288fe4dbSPoul-Henning Kamp	@echo "SD undefined in doTARBALL" && exit 1
1029bd668f6fSPoul-Henning Kamp.endif
1030bd668f6fSPoul-Henning Kamp.if !defined(TD)
103119cc96f6SDavid E. O'Brien	@echo "TD undefined in doTARBALL" && exit 1
1032bd668f6fSPoul-Henning Kamp.endif
1033bd668f6fSPoul-Henning Kamp.if !defined(ARG)
1034288fe4dbSPoul-Henning Kamp	@echo "ARG undefined in doTARBALL" && exit 1
1035bd668f6fSPoul-Henning Kamp.endif
103692e86f99SJordan K. Hubbard	@rm -rf ${RD}/dists/${TD}/${TN}*
103792e86f99SJordan K. Hubbard	@mkdir -p ${RD}/dists/${TD}
103892e86f99SJordan K. Hubbard	@( cd ${SD} && \
1039087b057dSAndrey A. Chernov		tn=`echo ${TN} | tr 'A-Z' 'a-z' | cut -c1-8` && \
1040d2b98961SPoul-Henning Kamp		echo rolling ${TD}/$$tn tarball &&\
10410ef3fb22SJoerg Wunsch		tar --exclude CVS --exclude obj --exclude BOOTMFS -cf - ${ARG} | \
104295e34bfcSJordan K. Hubbard		${ZIPNSPLIT} ${RD}/dists/${TD}/$$tn. && \
1043b34a415eSDavid E. O'Brien		sh ${.CURDIR}/scripts/info.sh ${RD}/dists/${TD}/$$tn \
1044b34a415eSDavid E. O'Brien		    > ${RD}/dists/${TD}/$$tn.inf && \
10451e104a1eSJordan K. Hubbard		if [ -f ${.CURDIR}/scripts/$${TD}-install.sh ]; then \
1046b34a415eSDavid E. O'Brien			cp -p ${.CURDIR}/scripts/$${TD}-install.sh \
1047b34a415eSDavid E. O'Brien			    ${RD}/dists/${TD}/install.sh; \
10481e104a1eSJordan K. Hubbard		fi && \
104916c61233SJordan K. Hubbard		if [ "${SD}" != "/usr/src" ]; then \
105011017a68SMarcel Moolenaar			mtree -c -i -p ${SD}/${ARG} \
105116c61233SJordan K. Hubbard			  -k gname,md5digest,mode,nlink,uname,size,link,type \
105291f2535eSJordan K. Hubbard			  > ${RD}/dists/${TD}/$$tn.mtree ; \
105391f2535eSJordan K. Hubbard		else \
105491f2535eSJordan K. Hubbard			true; \
105591f2535eSJordan K. Hubbard		fi; \
105691f2535eSJordan K. Hubbard		( cd ${RD}/dists/${TD}; \
105791f2535eSJordan K. Hubbard		rm -f CHECKSUM.MD5; \
105891f2535eSJordan K. Hubbard		md5 * > CHECKSUM.MD5 ) \
105991f2535eSJordan K. Hubbard	)
10607eb11201SPoul-Henning Kamp
10615355286aSColin PercivaldoRELEASE: release.1 release.2 ${DOCREL} release.3 release.4 \
10625355286aSColin Percival    release.5 release.6 release.7 release.8 ${EXTRAS}
10637eb11201SPoul-Henning Kamp	@echo "Release done"
10647eb11201SPoul-Henning Kamp
10650ead1f1dSJordan K. Hubbardfloppies:
10665355286aSColin Percival	@rm -f release.4 release.8 floppies.[123]
10675355286aSColin Percival	@cd ${.CURDIR} && ${MAKE} release.4 release.8 floppies.1 floppies.2 \
1068c0731f81SJohn Baldwin	    floppies.3
106992e86f99SJordan K. Hubbard	@cd ${RD} && find floppies -print | cpio -dumpl ${FD}
10700ead1f1dSJordan K. Hubbard
1071518a1d34SPoul-Henning KampinstallCRUNCH:
1072518a1d34SPoul-Henning Kamp.if !defined(CRUNCH)
1073288fe4dbSPoul-Henning Kamp	@echo "CRUNCH undefined in installCRUNCH" && exit 1
1074518a1d34SPoul-Henning Kamp.endif
1075518a1d34SPoul-Henning Kamp.if !defined(DIR)
1076288fe4dbSPoul-Henning Kamp	@echo "DIR undefined in installCRUNCH" && exit 1
1077518a1d34SPoul-Henning Kamp.endif
1078518a1d34SPoul-Henning Kamp.if !defined(ZIP)
1079288fe4dbSPoul-Henning Kamp	@echo "ZIP undefined in installCRUNCH" && exit 1
1080518a1d34SPoul-Henning Kamp.endif
108192e86f99SJordan K. Hubbard	@if ${ZIP} ; then \
1082518a1d34SPoul-Henning Kamp		gzip -9 < ${RD}/crunch/${CRUNCH} > ${DIR}/${CRUNCH}_crunch ; \
1083518a1d34SPoul-Henning Kamp	else \
1084518a1d34SPoul-Henning Kamp		ln -f ${RD}/crunch/${CRUNCH} ${DIR}/${CRUNCH}_crunch ; \
1085518a1d34SPoul-Henning Kamp	fi
108692e86f99SJordan K. Hubbard	@chmod 555 ${DIR}/${CRUNCH}_crunch
10878f1f55e9SRuslan Ermilov	@if [ -f ${.CURDIR}/${TARGET}/${CRUNCH}_crunch.conf ] ; then \
10888f1f55e9SRuslan Ermilov		for i in `crunchgen -l ${.CURDIR}/${TARGET}/${CRUNCH}_crunch.conf` ; do \
1089518a1d34SPoul-Henning Kamp			ln -f ${DIR}/${CRUNCH}_crunch ${DIR}/$$i ; \
10907ec62217SYoshihiro Takahashi		done \
10917ec62217SYoshihiro Takahashi	else \
10927ec62217SYoshihiro Takahashi		for i in `crunchgen -l ${.CURDIR}/${CRUNCH}_crunch.conf` ; do \
10937ec62217SYoshihiro Takahashi			ln -f ${DIR}/${CRUNCH}_crunch ${DIR}/$$i ; \
10947ec62217SYoshihiro Takahashi		done \
10957ec62217SYoshihiro Takahashi	fi
1096288fe4dbSPoul-Henning Kamp
1097288fe4dbSPoul-Henning Kamp#
1098c0731f81SJohn Baldwin# --==## Build a floppy set for a splitfs file ##==--
1099288fe4dbSPoul-Henning Kamp#
1100c0731f81SJohn Baldwin# FLOPPYBASE - basename of floppy image files
1101c0731f81SJohn Baldwin# FLOPPYDESC - description of floppy set
1102c0731f81SJohn Baldwin# SPLITFILE - filename of the file to split
1103c0731f81SJohn Baldwin# FDSIZE - if specified and "small", small floppy is created
1104c0731f81SJohn Baldwin
1105c0731f81SJohn Baldwin.if make(makeFloppySet)
1106c0731f81SJohn BaldwinSPLITDIR=	${RD}/floppyset/${FLOPPYBASE}
1107c0731f81SJohn Baldwin.if defined(FDSIZE) && ${FDSIZE} == "SMALL"
1108c0731f81SJohn BaldwinFLPSPLITSIZE=	${SMALLFLOPPYSPLITSIZE}
1109c0731f81SJohn BaldwinFLPSIZE=	${SMALLFLOPPYSIZE}
1110c0731f81SJohn BaldwinFLPLABEL=	${SMALLFLOPPYLABEL}
1111c0731f81SJohn Baldwin.else
1112c0731f81SJohn BaldwinFLPSPLITSIZE=	${FLOPPYSPLITSIZE}
1113c0731f81SJohn BaldwinFLPSIZE=	${FLOPPYSIZE}
1114c0731f81SJohn BaldwinFLPLABEL=	${FLOPPYLABEL}
1115319f35a3SRuslan Ermilov.endif
1116c0731f81SJohn Baldwin.endif
1117c0731f81SJohn Baldwin
1118c0731f81SJohn BaldwinmakeFloppySet:
1119c0731f81SJohn Baldwin.if !defined(FLOPPYBASE)
1120c0731f81SJohn Baldwin	@echo "FLOPPYBASE undefined in ${.TARGET}" && exit 1
1121c0731f81SJohn Baldwin.endif
1122c0731f81SJohn Baldwin.if !defined(FLOPPYDESC)
1123c0731f81SJohn Baldwin	@echo "FLOPPYDESC undefined in ${.TARGET}" && exit 1
1124c0731f81SJohn Baldwin.endif
1125c0731f81SJohn Baldwin.if !defined(SPLITFILE)
1126c0731f81SJohn Baldwin	@echo "SPLITFILE undefined in ${.TARGET}" && exit 1
1127c0731f81SJohn Baldwin.endif
1128e45b43aaSRuslan Ermilov	sh ${.CURDIR}/scripts/split-file.sh ${SPLITFILE} \
1129c0731f81SJohn Baldwin	    ${RD}/floppyset/${FLOPPYBASE} ${FLPSPLITSIZE} "${FLOPPYDESC}"
1130c0731f81SJohn Baldwin	( splitfile=${SPLITDIR}/`basename ${SPLITFILE}`.split ; \
1131c0731f81SJohn Baldwin	lines=`cat $${splitfile} | wc -l`; \
113285231d66SRuslan Ermilov	lines=$$(($$lines - 1)) ; \
1133c0731f81SJohn Baldwin	for line in `jot $$lines`; do \
1134c0731f81SJohn Baldwin		file=`head -n $$(($${line} + 1)) $${splitfile} | tail -1 | cut -f 1 -d ' '` ; \
1135c0731f81SJohn Baldwin		sh -e ${DOFS_SH} ${RD}/floppies/${FLOPPYBASE}$${line}.flp \
1136c0731f81SJohn Baldwin		${RD} ${MNT} ${FLPSIZE} ${SPLITDIR}/$${file} \
1137c0731f81SJohn Baldwin		${BOOTINODE} ${FLPLABEL}; \
1138c0731f81SJohn Baldwin	done )
1139c0731f81SJohn Baldwin
1140c0731f81SJohn Baldwin#
1141c0731f81SJohn Baldwin# --==## Build a boot floppy ##==--
1142c0731f81SJohn Baldwin#
1143c0731f81SJohn Baldwin# FSIMAGE - base floppy image name
1144c0731f81SJohn Baldwin# FDSIZE - if specified and "small", small floppy is created
1145c0731f81SJohn Baldwin# KERNFILE - path to kernel split file
1146c0731f81SJohn Baldwin# MFSROOTFILE - path to mfsroot split file
1147c0731f81SJohn Baldwin
1148c0731f81SJohn Baldwin.if make(buildBootFloppy)
1149c0731f81SJohn BaldwinIMAGEDIR=	${RD}/image.${FSIMAGE}
115013ff581dSJohn BaldwinBOOTDIR=	${RD}/trees/base/boot
115113ff581dSJohn BaldwinHINTSFILE=	${BOOTDIR}/device.hints
115213ff581dSJohn BaldwinACPI_KO=	${BOOTDIR}/kernel/acpi.ko
1153c0731f81SJohn BaldwinIMAGEFILE=	${RD}/floppies/${FSIMAGE}.flp
1154c0731f81SJohn Baldwin.if defined(FDSIZE) && ${FDSIZE} == "SMALL"
1155c0731f81SJohn BaldwinFLPSIZE=	${SMALLFLOPPYSIZE}
1156c0731f81SJohn BaldwinFLPLABEL=	${SMALLFLOPPYLABEL}
1157c0731f81SJohn Baldwin.else
1158c0731f81SJohn BaldwinFLPSIZE=	${FLOPPYSIZE}
1159c0731f81SJohn BaldwinFLPLABEL=	${FLOPPYLABEL}
1160c0731f81SJohn Baldwin.endif
1161c0731f81SJohn Baldwin.endif
1162c0731f81SJohn Baldwin
1163c0731f81SJohn BaldwinbuildBootFloppy:
1164c0731f81SJohn Baldwin.if !defined(FSIMAGE)
1165c0731f81SJohn Baldwin	@echo "FSIMAGE undefined in ${.TARGET}" && exit 1
1166c0731f81SJohn Baldwin.endif
1167c0731f81SJohn Baldwin.if !defined(KERNFILE)
1168c0731f81SJohn Baldwin	@echo "KERNFILE undefined in ${.TARGET}" && exit 1
1169c0731f81SJohn Baldwin.endif
1170c0731f81SJohn Baldwin.if !defined(MFSROOTFILE)
1171c0731f81SJohn Baldwin	@echo "MFSROOTFILE undefined in ${.TARGET}" && exit 1
1172c0731f81SJohn Baldwin.endif
1173c0731f81SJohn Baldwin	@echo "Running ${.TARGET} for ${FSIMAGE}"
1174c0731f81SJohn Baldwin	@rm -rf ${IMAGEDIR}
1175c0731f81SJohn Baldwin	@mkdir ${IMAGEDIR}
117692e86f99SJordan K. Hubbard	@echo "Setting up /boot directory for ${FSIMAGE} floppy"
1177c0731f81SJohn Baldwin	@mkdir -p ${IMAGEDIR}/boot
11788f1f55e9SRuslan Ermilov.if ${TARGET} == "i386"
1179b34a415eSDavid E. O'Brien	@${WMAKEENV} kgzip -v -l ${RD}/trees/base/usr/lib/kgzldr.o -o \
118013ff581dSJohn Baldwin	    ${IMAGEDIR}/boot/loader ${BOOTDIR}/loader
11814b60693cSMakoto Matsushita.else
118213ff581dSJohn Baldwin	@cp ${BOOTDIR}/loader ${IMAGEDIR}/boot
11834b60693cSMakoto Matsushita.endif
118413ff581dSJohn Baldwin	@cp -Rp ${BOOTDIR}/*.4th ${BOOTDIR}/defaults ${BOOTDIR}/loader.help \
118513ff581dSJohn Baldwin	    ${BOOTDIR}/loader.rc ${IMAGEDIR}/boot
118613ff581dSJohn Baldwin.if exists(${HINTSFILE})
1187f09470adSBrooks Davis	@cp ${HINTSFILE} ${IMAGEDIR}/boot/device.hints
1188f09470adSBrooks Davis.if ${TARGET} == "i386" || ${TARGET_ARCH} == "amd64"
1189f09470adSBrooks Davis	@echo 'hint.atkbd.0.flags="0x1"' >> ${IMAGEDIR}/boot/device.hints
1190f09470adSBrooks Davis.endif
1191f09470adSBrooks Davis	@gzip -9n ${IMAGEDIR}/boot/device.hints
119213ff581dSJohn Baldwin.endif
119313ff581dSJohn Baldwin	@gzip -9n ${IMAGEDIR}/boot/*.4th ${IMAGEDIR}/boot/loader.help \
119413ff581dSJohn Baldwin	    ${IMAGEDIR}/boot/defaults/loader.conf
119513ff581dSJohn Baldwin	@echo 'bootfile="/kernel"' > ${IMAGEDIR}/boot/loader.conf
1196d943f83bSJohn Baldwin.if exists(${ACPI_KO})
1197d943f83bSJohn Baldwin	@gzip -9nc ${ACPI_KO} > ${IMAGEDIR}/acpi.ko.gz
119813ff581dSJohn Baldwin	@echo 'acpi_load="YES"' >> ${IMAGEDIR}/boot/loader.conf
119913ff581dSJohn Baldwin	@echo 'acpi_name="/acpi.ko"' >> ${IMAGEDIR}/boot/loader.conf
120013ff581dSJohn Baldwin	@echo 'acpi_before="read -p \"Insert boot floppy and press Enter\""' >> ${IMAGEDIR}/boot/loader.conf
1201d943f83bSJohn Baldwin.endif
120213ff581dSJohn Baldwin	@echo 'mfsroot_load="YES"' >> ${IMAGEDIR}/boot/loader.conf
120313ff581dSJohn Baldwin	@echo 'mfsroot_type="mfs_root"' >> ${IMAGEDIR}/boot/loader.conf
120413ff581dSJohn Baldwin	@echo 'mfsroot_name="/mfsroot"' >> ${IMAGEDIR}/boot/loader.conf
120513ff581dSJohn Baldwin.if !exists(${ACPI_KO})
120613ff581dSJohn Baldwin	@echo 'mfsroot_before="read -p \"Insert boot floppy and press Enter\""' >> ${IMAGEDIR}/boot/loader.conf
120713ff581dSJohn Baldwin.endif
12088f1f55e9SRuslan Ermilov.if ${TARGET_ARCH} == "i386" && ${AUTO_KEYBOARD_DETECT}
1209c0731f81SJohn Baldwin	@echo "-P" >> ${IMAGEDIR}/boot.config
12108198d9b0SJordan K. Hubbard.endif
1211c0731f81SJohn Baldwin	@rm -f ${IMAGEFILE}
1212c0731f81SJohn Baldwin	@cp ${KERNFILE} ${MFSROOTFILE} ${IMAGEDIR}
1213c0731f81SJohn Baldwin	sh -e ${DOFS_SH} ${IMAGEFILE} ${RD} ${MNT} ${FLPSIZE} ${IMAGEDIR} \
1214c0731f81SJohn Baldwin	    ${BOOTINODE} ${FLPLABEL}
121592e86f99SJordan K. Hubbard	@echo "Created ${RD}/floppies/${FSIMAGE}.flp"
1216270ee878SJohn W. De Boskey
1217e738d1eaSJohn Baldwin.if make(package-split)
1218e738d1eaSJohn Baldwin# Targets related to making a package split
1219e738d1eaSJohn Baldwin#
1220e738d1eaSJohn Baldwin# PKG_COPY instructs the script to copy the actual package files rather than
1221e738d1eaSJohn Baldwin#     make hard links
1222e738d1eaSJohn Baldwin# PKG_TREE is the path to the package tree to be split
1223e738d1eaSJohn Baldwin# PKG_DEST is the path to the destination tree to create the split in
1224e738d1eaSJohn Baldwin# PKG_VERBOSE asks for verbose output of the layout process
1225e738d1eaSJohn Baldwin
1226e738d1eaSJohn Baldwin.if defined(PKG_COPY)
1227e738d1eaSJohn BaldwinPKG_DO_COPY=	cp
1228e738d1eaSJohn Baldwin.else
1229e738d1eaSJohn BaldwinPKG_DO_COPY=	ln
1230e738d1eaSJohn Baldwin.endif
1231e738d1eaSJohn BaldwinPKG_INDEX=	${PKG_DEST}/INDEX.master
1232e738d1eaSJohn BaldwinPKG_ENV?=
1233e738d1eaSJohn Baldwin.if defined(TARGET_ARCH)
1234e738d1eaSJohn BaldwinPKG_ENV+=	PKG_ARCH=${TARGET_ARCH}
1235e738d1eaSJohn Baldwin.endif
1236e738d1eaSJohn Baldwin.if defined(PKG_VERBOSE)
1237e738d1eaSJohn BaldwinPKG_ENV+=	PKG_VERBOSE=1
1238e738d1eaSJohn Baldwin.endif
1239e738d1eaSJohn Baldwin
1240e738d1eaSJohn Baldwinpackage-split:
1241e738d1eaSJohn Baldwin.if !defined(PKG_TREE)
1242e738d1eaSJohn Baldwin	@echo "PKG_TREE must be defined" && exit 1
1243e738d1eaSJohn Baldwin.endif
1244e738d1eaSJohn Baldwin.if !defined(PKG_DEST)
1245e738d1eaSJohn Baldwin	@echo "PKG_DEST must be defined" && exit 1
1246e738d1eaSJohn Baldwin.endif
1247e738d1eaSJohn Baldwin	@env ${PKG_ENV} python ${.CURDIR}/scripts/package-split.py \
1248e738d1eaSJohn Baldwin	    ${PKG_TREE}/INDEX ${PKG_INDEX}
1249e738d1eaSJohn Baldwin	@env ${PKG_ENV} sh ${.CURDIR}/scripts/package-trees.sh ${PKG_DO_COPY} \
1250e738d1eaSJohn Baldwin	    ${PKG_INDEX} ${PKG_TREE} ${PKG_DEST}
1251e738d1eaSJohn Baldwin.endif
1252e738d1eaSJohn Baldwin
12538eb4e096SRuslan Ermilov.include <bsd.obj.mk>
1254