Makefile revision 36687
1#	$Id: Makefile,v 1.353 1998/05/30 12:15:02 jkh Exp $
2#
3# make release CHROOTDIR=/some/dir BUILDNAME=somename [ RELEASETAG=tag ]
4#
5# Where "/some/dir" is the pathname of a directory on a some
6# filesystem with at least 600MB of free space, "somename" is what
7# you want the release to call itself and, optionally, which CVS "tag"
8# name should be used when checking out the sources to build the release
9# (default is HEAD).
10#
11# Please note: the vn driver must also be compiled into your kernel,
12# otherwise the target 'release.8' and possibly others will fail.
13#
14# Set these, release builder!
15#
16# Fixed version:
17#BUILDNAME=2.2-RELEASE
18#
19# Automatic SNAP versioning:
20DATE != date +%y%m%d
21BASE = 3.0
22BUILDNAME?=${BASE}-${DATE}-SNAP
23#
24#CHROOTDIR=/junk/release
25# If this is a RELEASE, then set
26#RELEASETAG=RELENG_2_2
27
28# If you are using a local CVS repository with components stored in 
29# non-standard modules, override these on the make commandline or
30# in the environment.
31RELEASESRCMODULE?=	src
32RELEASEDOCMODULE?=	doc
33RELEASEPORTSMODULE?=	ports
34
35# Uncomment this to disable the doc.1 target.  It is also an ERROR
36# to set NOPORTS and not set NODOC since docs depend on ports.
37#NODOC=  YES
38# Comment the following if you want the release documentation to be
39# in English only.
40ALLLANG= yes
41DOCPORTS= archivers/unzip lang/perl5 textproc/jade textproc/iso8879 \
42          textproc/linuxdoc textproc/docbook textproc/sgmlformat
43
44# Things which without too much trouble can be considered variables
45# BIN_DISTS are special in that they get full /etc installation sets.
46#
47COMPAT_DISTS?=	compat1x compat20 compat21
48OTHER_DISTS?=	manpages catpages games proflibs dict info doc
49CRYPTO_DISTS?=	krb des
50BIN_DISTS?=	bin
51DISTRIBUTIONS?=	${BIN_DISTS} ${OTHER_DISTS} ${COMPAT_DISTS} ${CRYPTO_DISTS}
52KERNELS?=	GENERIC
53
54# Extra source tarballs; each argument is a pair of source dir and
55# distribution name.  The dist name should not exceed 7 characters
56# (another "s" for "source" will be prepended).
57EXTRA_SRC+=	usr.sbin/sendmail/cf smailcf
58
59BOOT1=	etc/protocols etc/rc.conf
60
61# mountpoint for filesystems.
62MNT=			/mnt
63
64# other floppy parameters.
65FDSIZE=			1440
66FDLABEL=		fd1440
67
68ZIPNSPLIT=		gzip --no-name -9 -c | split -b 240640 -
69
70# Upper size for the mfs in the boot.flp kernel.
71# These are adjusted down to the minimum needed by doFS.sh.
72BOOTMFSSIZE=		1440
73MFSINODE=		7000
74FIXITINODE=		2000
75BOOTINODE=		100000
76
77VNDEVICE?=		vn0
78
79# Things which may get you into trouble if you change them
80MTREEFILES=		${.CURDIR}/../etc/mtree
81RD=			/R/stage
82FD=			/R/ftp
83CD=			/R/cdrom
84CD_DISC1=		${CD}/disc1
85CD_DISC2=		${CD}/disc2
86
87# Where the bootstrap ports (see DOCPORTS) get installed.
88LOCALDIR=		/usr/local/bin
89
90# ${BOOTSTRAPDIR} is for those utilities that refer to the hosting
91# environment, rather than the target environment.  This is specifically
92# intended for kernel-dependent utilities that are used during the build.
93#
94# ${BOOTSTRAPDIR} is actually being used by prepending it to the normal
95# ${PATH}.  Thus, it's also available to outside utilities like doFS.sh.
96BOOTSTRAPDIR=	/bootstrap
97#
98# The mount subsystem has been changed between 2.2 and 3.0 by the
99# Lite2 import.
100BOOTSTRAPUTILS=	/sbin/mount /sbin/umount
101#
102# 3.0 cpio tries to reference lchown(2) which is not available in 2.2
103BOOTSTRAPUTILS+= /usr/bin/cpio
104
105.if !defined(CRUNCH_TARGETS)
106CRUNCH_TARGETS=	boot fixit
107.endif
108
109EXTRAS= cdrom.1 ftp.1
110
111.if !defined(NODOC)
112DOCREL= doc.1
113.endif
114
115REDO?=		sysinstall
116REDOSED=	sed -e 's/dirs/release.1/' -e 's/trees/release.2/' \
117		    -e 's/kerns/release.3/' -e 's/sysinstall/release.4/' \
118		    -e 's/fixup/release.5/' -e 's/tarbin/release.6/' \
119		    -e 's/tarsrc/release.7/' -e 's/boot\.flp/release.8/' \
120		    -e 's/fixit\.flp/release.9/' -e 's/ftp/ftp.1/' \
121		    -e 's/cdrom/cdrom.1/'
122
123REDOREDO!=	echo ${REDO} | ${REDOSED}
124
125rerelease release:
126.if !defined(CHROOTDIR) || !defined(BUILDNAME) || !defined(CVSROOT)
127	@echo "To make a release you must set CHROOTDIR, BUILDNAME and CVSROOT" && false
128.endif
129.if make(release)
130.if exists(${CHROOTDIR})
131	chflags -R noschg ${CHROOTDIR}/.
132	-rm -rf ${CHROOTDIR}
133.endif
134	-mkdir -p ${CHROOTDIR}
135	cd ${.CURDIR}/../etc && ${MAKE} distrib-dirs DESTDIR=${CHROOTDIR}
136	cd ${.CURDIR}/../etc && ${MAKE} distribution DESTDIR=${CHROOTDIR}
137	cd ${.CURDIR}/.. && ${MAKE} install DESTDIR=${CHROOTDIR} NOMAN=1
138	mkdir ${CHROOTDIR}/${BOOTSTRAPDIR}
139	for i in ${BOOTSTRAPUTILS} ; do \
140		cp -p ${CHROOTDIR}$$i ${CHROOTDIR}/${BOOTSTRAPDIR} ; \
141	done
142.if !defined(RELEASETAG)
143	cd ${CHROOTDIR}/usr && rm -rf src && \
144		cvs -d ${CVSROOT} co -P ${RELEASESRCMODULE}
145.else
146	cd ${CHROOTDIR}/usr && rm -rf src && \
147		cvs -d ${CVSROOT} co -P -r ${RELEASETAG} ${RELEASESRCMODULE}
148.endif
149.if defined(LOCAL_PATCHES) && exists(${LOCAL_PATCHES})
150	cd ${CHROOTDIR}/usr/src && patch --silent < ${LOCAL_PATCHES}
151.endif
152.if !defined(NOPORTS)
153	cd ${CHROOTDIR}/usr && rm -rf ports && cvs -d ${CVSROOT} co -P ${RELEASEPORTSMODULE} && cd ports && make readmes PORTSDIR=${CHROOTDIR}/usr/ports
154.endif
155.if !defined(NODOC)
156	cd ${CHROOTDIR}/usr && rm -rf doc && cvs -d ${CVSROOT} co -P ${RELEASEDOCMODULE}
157	cd ${CHROOTDIR}/usr/ports && for i in ${DOCPORTS}; do \
158	  (cd $$i; make fetch MASTER_SITE_OVERRIDE=file:/usr/ports/distfiles/ \
159	    DISTDIR=${CHROOTDIR}/usr/ports/distfiles ); \
160        done
161.endif
162.endif
163.if make(rerelease)
164.if !defined(RELEASENOUPDATE)
165.if !defined(RELEASETAG)
166	cd ${CHROOTDIR}/usr/src && cvs -q update -P -d
167.else
168	cd ${CHROOTDIR}/usr/src && cvs -q update -P -d -r ${RELEASETAG}
169.endif
170.if !defined(NOPORTS)
171	cd ${CHROOTDIR}/usr/ports && cvs -q update -P -d
172.endif
173.if !defined(NODOC)
174	cd ${CHROOTDIR}/usr/doc && cvs -q update -P -d
175.endif
176.endif
177.endif
178	# Add version information to those things that need it.
179	( cd ${CHROOTDIR}/usr/src/sys/conf && \
180	  mv newvers.sh foo && \
181	  sed "s/^RELEASE=.*/RELEASE=${BUILDNAME}/" foo > newvers.sh&& rm foo )
182	( cd ${CHROOTDIR}/usr/src/release/sysinstall && \
183	  sed "s/__RELEASE/${BUILDNAME}/" version.h > version.h.new && \
184	  mv version.h.new version.h && \
185	  echo XXXX )
186	-test -f install.cfg && cp install.cfg ${CHROOTDIR}/usr/src/release
187	echo "#!/bin/sh"			> ${CHROOTDIR}/mk
188	echo "set -ex"				>> ${CHROOTDIR}/mk
189	echo "export CFLAGS='-O2 -pipe'"	>> ${CHROOTDIR}/mk
190	echo "export DISTRIBUTIONS=\"${DISTRIBUTIONS}\"" >> ${CHROOTDIR}/mk
191	echo "export BUILDNAME=${BUILDNAME}"	>> ${CHROOTDIR}/mk
192	echo "export VNDEVICE=${VNDEVICE}"	>> ${CHROOTDIR}/mk
193.if defined(RELEASETAG)
194	echo "export RELEASETAG=${RELEASETAG}"	>> ${CHROOTDIR}/mk
195.endif
196.if defined(NOPORTS)
197	echo "export NOPORTS=${NOPORTS}"	>> ${CHROOTDIR}/mk
198.endif
199.if defined(NODOC)
200	echo "export NODOC=${NODOC}"		>> ${CHROOTDIR}/mk
201.endif
202.if defined(ALLLANG)
203	echo "export ALLLANG=${ALLLANG}"	>> ${CHROOTDIR}/mk
204.endif
205.if defined(NOSRC)
206	echo "export NOSRC=${NOSRC}"		>> ${CHROOTDIR}/mk
207.endif
208.if defined(NOSHARED)
209	echo "export NOSHARED=${NOSHARED}"	>> ${CHROOTDIR}/mk
210.endif
211.if defined(BOOT_CONFIG)
212	echo "export BOOT_CONFIG=\"${BOOT_CONFIG}\"">> ${CHROOTDIR}/mk
213.endif
214	# Don't remove this, or the build will fall over!
215	echo "export RELEASEDIR=/R"		>> ${CHROOTDIR}/mk
216	echo "export PATH=${BOOTSTRAPDIR}:$${PATH}:${LOCALDIR}" >> ${CHROOTDIR}/mk
217	echo "cd /usr/src"			>> ${CHROOTDIR}/mk
218.if make(release)
219	# This eases bootstrapping from a more recent hosting environment:
220.if exists(/usr/lib/aout/)
221	echo "mkdir -p /usr/lib/compat/aout"	>> ${CHROOTDIR}/mk
222	echo "chflags noschg /usr/lib/aout/lib*.so.*" >> ${CHROOTDIR}/mk
223	echo "mv /usr/lib/aout/lib*.so.* /usr/lib/compat/aout" >> ${CHROOTDIR}/mk
224	echo "ldconfig /usr/lib/compat/aout" 	>> ${CHROOTDIR}/mk
225.else
226	echo "mkdir -p /usr/lib/compat"		>> ${CHROOTDIR}/mk
227	echo "chflags noschg /usr/lib/lib*.so.*" >> ${CHROOTDIR}/mk
228	echo "mv /usr/lib/lib*.so.* /usr/lib/compat" >> ${CHROOTDIR}/mk
229	echo "ldconfig /usr/lib /usr/lib/compat" >> ${CHROOTDIR}/mk
230.endif
231	echo "(cd include; make all install)"   >> ${CHROOTDIR}/mk
232	echo "(cd etc; make distrib-dirs distribution)" >> ${CHROOTDIR}/mk
233	echo "make world"			>> ${CHROOTDIR}/mk
234	echo "(cd etc; make distribution)"	>> ${CHROOTDIR}/mk
235	# Now we've got our own shared libs, remove the bootstrapping
236	# libs again.
237.if !exists(/usr/lib/aout/)
238	echo "rm -f /usr/lib/compat/*"		>> ${CHROOTDIR}/mk
239	echo "ldconfig /usr/lib"		>> ${CHROOTDIR}/mk
240.endif
241.endif
242.if make(rerelease)
243	echo "make all install"			>> ${CHROOTDIR}/mk
244.endif
245	echo "cd /usr/src/release/sysinstall"	>> ${CHROOTDIR}/mk
246	echo "make obj"				>> ${CHROOTDIR}/mk
247	echo "cd /usr/src/release"		>> ${CHROOTDIR}/mk
248	echo "make objlink"			>> ${CHROOTDIR}/mk
249	echo "(cd obj; rm -f ${REDOREDO})"	>> ${CHROOTDIR}/mk
250	echo "make doRELEASE"			>> ${CHROOTDIR}/mk
251	echo "echo make ${.TARGET} Finished"	>> ${CHROOTDIR}/mk
252	chmod 755 ${CHROOTDIR}/mk
253	chroot ${CHROOTDIR} /mk
254
255clean:
256	rm -rf boot_crunch release.[0-9]
257
258# Clean out /R and make the directory structure.
259release.1:
260	-mkdir /R
261	chflags -R noschg /R/.
262	rm -rf /R/*
263	mkdir ${RD}
264	mkdir ${RD}/floppies
265	mkdir ${RD}/trees
266	mkdir ${RD}/dists
267	mkdir ${RD}/kernels
268	for i in ${DISTRIBUTIONS} ; do \
269		mkdir ${RD}/trees/$$i && \
270		mkdir ${RD}/dists/$$i && \
271		mtree -deU -f ${MTREEFILES}/BSD.root.dist \
272		    -p ${RD}/trees/$$i > /dev/null && \
273		mtree -deU -f ${MTREEFILES}/BSD.usr.dist \
274		    -p ${RD}/trees/$$i/usr > /dev/null && \
275		mtree -deU -f ${MTREEFILES}/BSD.include.dist \
276		    -p ${RD}/trees/$$i/usr/include > /dev/null && \
277		mtree -deU -f ${MTREEFILES}/BSD.var.dist \
278		    -p ${RD}/trees/$$i/var > /dev/null ; \
279	done
280	touch release.1
281
282# Install the system into the various distributions.
283release.2:
284	cd ${.CURDIR}/../etc && make distrib-dirs DESTDIR=${RD}/trees/bin
285	cd ${.CURDIR}/.. && make distribute DISTDIR=${RD}/trees
286.if exists(${.CURDIR}/../kerberosIV) && !defined(NOKERBEROS)
287	cd ${.CURDIR}/../kerberosIV && ( \
288		make bootstrap &&\
289		make obj all help-distribute DISTDIR=${RD}/trees &&\
290		make kprog \
291	)
292.endif
293	chflags -R noschg ${RD}/trees
294	touch release.2
295
296# Make and install the generic kernel(s).
297release.3:
298.for kernel in ${KERNELS}
299	rm -f ${RD}/kernels/${kernel}
300	rm -rf ${.CURDIR}/../sys/compile/${kernel}
301	cd ${.CURDIR} && ${MAKE} doKERNEL KERNEL=${kernel}
302	rm -rf ${.CURDIR}/../sys/compile/${kernel}
303	ln -f ${RD}/kernels/${kernel} ${RD}/trees/bin/kernel.${kernel}
304.endfor
305	touch release.3
306
307# Make and install the three crunched binaries which live on the floppies.
308# You are not supposed to like this :-)
309#
310# NB: the "RELEASE_BUILD_FIXIT" magic prevents vi from including the
311# Tcl and Perl APIs.  See also /usr/src/usr.bin/vi/Makefile.
312release.4:
313	@mkdir -p /stand
314	cd ${.CURDIR}/sysinstall && make obj depend all install
315	rm -rf ${RD}/crunch
316	mkdir -p ${RD}/crunch
317	export RELEASE_BUILD_FIXIT=noway ; \
318	for j in ${CRUNCH_TARGETS} ; do \
319		rm -rf $${j}_crunch && \
320		mkdir $${j}_crunch && \
321		( cd $${j}_crunch && \
322		crunchgen ${.CURDIR}/$${j}_crunch.conf && \
323		${MAKE} -DRELEASE_CRUNCH -f $${j}_crunch.mk subclean all \
324		    NOCRYPT=yes "CFLAGS=${CFLAGS} -DCRUNCHED_BINARY") && \
325		mv $${j}_crunch/$${j}_crunch ${RD}/crunch/$${j} && \
326		true || { rm -rf $${j}_crunch ; false ; } ; \
327	done
328	touch release.4
329
330#
331# --==## Fix up the distributions. ##==--
332#
333release.5:
334	# Handle some grief caused by the munition braindeadness.
335	for i in sbin/init bin/ed ; do \
336		( cd ${.CURDIR}/../$$i; \
337		  make -DNOCRYPT clean all distribute DISTDIR=${RD}/trees ) ; \
338	done
339
340	# Create any "synthetic dists" now.
341	@for i in ${DISTRIBUTIONS}; do \
342		if [ -f ${.CURDIR}/scripts/$${i}-make.sh ]; then \
343			echo -n "Running $$i dist creation script... "; \
344			env RD=${RD} sh ${.CURDIR}/scripts/$${i}-make.sh || echo "$$i distribution script returned bad status."; \
345			echo "Done."; \
346		fi \
347	done \
348
349	# Create symlinks for the MD5-based crypt lib, too.  The
350	# automatically created links still point to the DES stuff,
351	# which went into its own distribution.
352	for i in ${RD}/trees/bin/usr/lib/libscrypt* ; do \
353		c=`echo $$i | sed -e 's/libscrypt/libcrypt/'` ; \
354		rm -f $$c ; \
355		ln -s `basename $$i` $$c ; \
356	done
357
358	# Remove all the directories we don't need.
359	-cd ${RD}/trees && \
360		find ${OTHER_DISTS} ${COMPAT_DISTS} ${CRYPTO_DISTS} -depth -type d -print | xargs rmdir
361	touch release.5
362
363#
364# --==## Package up the tarballs from assembled trees ##==--
365#
366release.6:
367	rm -rf ${RD}/dists
368	mkdir -p ${RD}/dists
369	@for i in ${DISTRIBUTIONS} ; \
370	do \
371		if [ -d ${RD}/trees/$${i} ] ; then \
372			cd ${.CURDIR} && $(MAKE) doTARBALL \
373				SD=${RD}/trees/$${i} \
374				TN=$$i TD=$$i ARG="." && \
375			echo "$${i} distribution is finished."; \
376		fi ; \
377	done
378	# More munition braindeadness.
379	( cd ${RD}/dists && \
380		if [ -f krb/krb.aa ] ; then mv krb/* des && rmdir krb ; fi )
381	touch release.6
382
383
384#
385# --==## Make source dists ##==--
386#
387release.7:
388.if !defined(NOSRC)
389	@cd ${.CURDIR} && $(MAKE) doTARBALL SD=/usr/src \
390		TD=src TN=sbase ARG="[A-Z]*"
391	@for i in `cd /usr/src && echo [a-z]*` ; do \
392		if [ -d /usr/src/$$i ] ; then \
393			cd ${.CURDIR} && $(MAKE) doTARBALL \
394				TN=`echo s$$i | tr -d '.' | sed 's/usr/u/'` \
395				SD=/usr/src TD=src ARG="$$i" ; \
396		fi ; \
397	done
398.if defined(EXTRA_SRC)
399	@set ${EXTRA_SRC} && \
400	while [ $$# -ge 2 ] ; do \
401		if [ -d /usr/src/$$1 ] ; then \
402			cd ${.CURDIR} && $(MAKE) doTARBALL \
403				SD=/usr/src TN="s$$2" TD=src ARG="$$1" ; \
404		fi && shift && shift ; \
405	done
406.endif
407	( cd ${RD}/dists/src && \
408		if [ -f ssecure.aa ] ; then mv ssecure.* ../des ; fi && \
409		if [ -f scrypto.aa ] ; then mv scrypto.* ../des ; fi && \
410		if [ -f skerbero.aa ] ; then mv skerbero.* ../des ; fi ; )
411	@echo "src distribution is finished."
412.endif
413	touch release.7
414
415# Complete the bootfd
416#
417# Now, just to get this picture down once and for all:
418#
419# +------------------------------------------------------------------------+
420# |boot.flp                                                                |
421# +-----+-----+------------------------------------------------------------+
422# |boot1|boot2|floppy filesystem "bootfd"                                  |
423# +-----+-----+-+--------------------------------------------------------+-+
424#               |kernel                                                  |
425#               +------------+-----------------------------------------+-+
426#                            |mfs filesystem "mfsfd"                   |
427#                            +-----------------------------------------+
428#
429
430release.8: write_mfs_in_kernel dumpnlist
431	rm -rf ${RD}/mfsfd
432	mkdir ${RD}/mfsfd
433	cd ${RD}/mfsfd && \
434		mkdir -p etc dev mnt stand/help
435	@cp ${.CURDIR}/../sys/i386/boot/biosboot/boot.help ${RD}/mfsfd/stand
436	@cd ${.CURDIR} && $(MAKE) installCRUNCH CRUNCH=boot \
437		DIR=${RD}/mfsfd/stand ZIP=false
438	( cd ${RD}/trees/bin/dev && \
439		ls console tty ttyv0 ttyv1 ttyv2 ttyv3 null zero | \
440	cpio -dump ${RD}/mfsfd/dev )
441	( cd ${RD}/mfsfd/dev && rm -f *[swo]d*[bdefgh] )
442	cd ${RD}/trees/bin && ls ${BOOT1} | cpio -dump ${RD}/mfsfd/stand
443	echo "nameserver      42/tcp name"	> ${RD}/mfsfd/stand/etc/services
444	echo "ftp             21/tcp"		>> ${RD}/mfsfd/stand/etc/services
445	echo "domain          53/tcp          nameserver" >> ${RD}/mfsfd/stand/etc/services
446	echo "domain          53/udp          nameserver" >> ${RD}/mfsfd/stand/etc/services
447	echo "cmd             514/tcp    shell" >> ${RD}/mfsfd/stand/etc/services
448	gzip -c ${.CURDIR}/../COPYRIGHT > ${RD}/mfsfd/stand/help/COPYRIGHT.hlp.gz
449	-test -f ${.CURDIR}/install.cfg && cp ${.CURDIR}/install.cfg ${RD}/mfsfd
450	@echo "Making the regular boot floppy."
451	tar --exclude CVS -cf - -C ${.CURDIR}/sysinstall help | \
452		tar xvf - -C ${RD}/mfsfd/stand
453	@echo "Compressing doc files..."
454	@gzip -9 ${RD}/mfsfd/stand/help/*.hlp
455	sh -e ${.CURDIR}/doFS.sh ${RD} ${MNT} ${BOOTMFSSIZE} ${RD}/mfsfd \
456		${MFSINODE} minimum
457	mv fs-image fs-image.std
458	mv fs-image.size fs-image.std.size
459	cd ${.CURDIR} && ${MAKE} doMFSKERN FSIMAGE=std
460	mv ${RD}/floppies/bootstd.flp ${RD}/floppies/boot.flp
461	@echo "Regular boot floppy made."
462	touch release.8
463
464#
465# --==## Create a fixit floppy ##==--
466#
467release.9:
468	rm -rf ${RD}/fixitfd
469	mkdir ${RD}/fixitfd
470	cd ${RD}/fixitfd && \
471		mkdir -p dev stand bin sbin etc mnt mnt1 mnt2 mnt3 mnt4 tmp \
472		usr/share/misc usr/mdec
473	@cd ${.CURDIR} && $(MAKE) installCRUNCH CRUNCH=fixit \
474		DIR=${RD}/fixitfd/stand ZIP=false
475	( cd ${RD}/fixitfd/dev && \
476		sed -e '/^PATH/s/^/#/' ${RD}/trees/bin/dev/MAKEDEV > MAKEDEV && \
477		chmod 755 MAKEDEV && \
478		sh MAKEDEV all )
479	cp ${RD}/trees/bin/etc/spwd.db ${RD}/trees/bin/etc/group \
480		${RD}/trees/bin/etc/protocols ${RD}/fixitfd/etc
481	cp ${RD}/trees/bin/usr/share/misc/scsi_modes \
482		${RD}/fixitfd/usr/share/misc
483	cp ${RD}/trees/bin/usr/mdec/boot[12] ${RD}/fixitfd/usr/mdec
484	for type in fd od sd wd ; do \
485		( cd ${RD}/fixitfd/usr/mdec && ln -s boot1 $${type}boot && \
486			ln -s boot2 boot$${type} ) ; \
487	done
488	cp ${.CURDIR}/fixit.profile ${RD}/fixitfd/.profile
489	cp ${.CURDIR}/fixit.services ${RD}/fixitfd/etc/services
490	cp ${.CURDIR}/tar.sh ${RD}/fixitfd/stand/tar
491	chmod 555 ${RD}/fixitfd/stand/tar
492	sh -e ${.CURDIR}/doFS.sh ${RD} ${MNT} ${FDSIZE} ${RD}/fixitfd \
493		${FIXITINODE} ${FDLABEL}
494	mv fs-image ${RD}/floppies/fixit.flp
495# Do our last minute floppies directory setup in a convenient place.
496	cp ${.CURDIR}/README.TXT ${RD}/floppies/README.TXT
497	@(cd ${RD}/floppies; md5 * > CHECKSUM.MD5)
498	touch release.9
499
500#
501# --==## Setup a suitable ftp-area ##==--
502#
503ftp.1:
504	mkdir -p ${FD}
505	cd ${RD} && find floppies -print | cpio -dumpl ${FD}
506	cd ${RD}/dists && find . -print | cpio -dumpl ${FD}
507	cp ${.CURDIR}/ABOUT.TXT ${FD}/ABOUT.TXT
508	cp ${.CURDIR}/sysinstall/help/readme.hlp ${FD}/README.TXT
509	cp ${.CURDIR}/sysinstall/help/hardware.hlp ${FD}/HARDWARE.TXT
510	cp ${.CURDIR}/sysinstall/help/install.hlp ${FD}/INSTALL.TXT
511	cp ${.CURDIR}/sysinstall/help/relnotes.hlp ${FD}/RELNOTES.TXT
512	echo "CD_VERSION = ${BUILDNAME}" > ${FD}/cdrom.inf
513.if !defined(NOPORTS)
514	tar -cBf - -C ${CD_DISC1} ports | tar -xBf - -C ${FD}
515.endif
516
517#
518# --==## Setup a suitable cdrom-area ##==--
519#
520cdrom.1:
521	mkdir -p ${CD_DISC1} ${CD_DISC2}
522	cd ${RD} && find floppies -print | cpio -dumpl ${CD_DISC1}
523	cd ${RD}/dists && find . -print | cpio -dumpl ${CD_DISC1}
524	ln -f ${RD}/kernels/MFSKERNEL.std ${CD_DISC1}/kernel
525	ln -f ${RD}/trees/bin/usr/mdec/fbsdboot.exe ${CD_DISC1}
526	for i in ${DISTRIBUTIONS} ; \
527	do \
528		if [ -d ${RD}/trees/$${i} ] ; then \
529			chflags -R noschg ${RD}/trees/$${i} ; \
530			( cd ${RD}/trees/$${i} && \
531			find . -depth -print | cpio -dumpl ${CD_DISC2} ) ; \
532		fi \
533	done
534	rm -f ${CD_DISC2}/.profile
535	cp ${.CURDIR}/fixit.profile ${CD_DISC2}/.profile
536	echo "CD_VERSION = ${BUILDNAME}" > ${CD_DISC1}/cdrom.inf
537	echo "CD_VERSION = ${BUILDNAME}" > ${CD_DISC2}/cdrom.inf
538	cp ${.CURDIR}/ABOUT.TXT ${CD_DISC1}/ABOUT.TXT
539	cp ${.CURDIR}/sysinstall/help/readme.hlp ${CD_DISC1}/README.TXT
540	cp ${.CURDIR}/sysinstall/help/hardware.hlp ${CD_DISC1}/HARDWARE.TXT
541	cp ${.CURDIR}/sysinstall/help/install.hlp ${CD_DISC1}/INSTALL.TXT
542	cp ${.CURDIR}/sysinstall/help/relnotes.hlp ${CD_DISC1}/RELNOTES.TXT
543.if !defined(NOPORTS)
544	-rm -rf /usr/ports/distfiles/*
545	tar -cBf - -C /usr ports | tar xBpf - -C ${CD_DISC2} && \
546	  mkdir -p ${CD_DISC1}/ports && \
547	  tar -czf ${CD_DISC1}/ports/ports.tgz -C /usr ports && \
548	  cp ${.CURDIR}/scripts/ports-install.sh ${CD_DISC1}/ports/install.sh && \
549		(cd ${CD_DISC1}/ports; md5 * > CHECKSUM.MD5)
550	ln -s ../ports ${CD_DISC2}/usr/ports
551.endif
552
553doc.1:
554	for i in ${DOCPORTS}; do \
555	  cd /usr/ports/$$i && make all install clean FORCE_PKG_REGISTER=yes; \
556	done
557	cd /usr/doc && make all distribute DISTDIR=${RD}/trees
558
559# Various "subroutine" and other supporting targets.
560
561doTARBALL:
562.if !defined(SD)
563	@echo "SD undefined in doTARBALL" && exit 1
564.endif
565.if !defined(TD)
566	@echo "TB undefined in doTARBALL" && exit 1
567.endif
568.if !defined(ARG)
569	@echo "ARG undefined in doTARBALL" && exit 1
570.endif
571	rm -rf ${RD}/dists/${TD}/${TN}*
572	mkdir -p ${RD}/dists/${TD}
573	( cd ${SD} && \
574		tn=`echo ${TN} | tr '[A-Z]' '[a-z]' | cut -c1-8` && \
575		echo rolling ${TD}/$$tn tarball &&\
576		tar --exclude CVS --exclude obj --exclude BOOTMFS -cf - ${ARG} | \
577		${ZIPNSPLIT} ${RD}/dists/${TD}/$$tn. && \
578		sh ${.CURDIR}/info.sh ${RD}/dists/${TD}/$$tn > \
579		   ${RD}/dists/${TD}/$$tn.inf && \
580		if [ -f ${.CURDIR}/scripts/$${TD}-install.sh ]; then \
581		  cp -p ${.CURDIR}/scripts/$${TD}-install.sh ${RD}/dists/${TD}/install.sh; \
582		fi && \
583		if [ "${SD}" != "/usr/src" ]; then \
584			mtree -c -i -p ${SD}/${ARG} \
585			  -k gname,md5digest,mode,nlink,uname,size,link,type \
586			  > ${RD}/dists/${TD}/$$tn.mtree ; \
587		else \
588			true; \
589		fi; \
590		(cd ${RD}/dists/${TD}; \
591		   rm -f CHECKSUM.MD5; \
592		   md5 * > CHECKSUM.MD5) \
593	)
594
595doRELEASE:  release.1 release.2 ${DOCREL} release.3 release.4 release.5 \
596		release.6 release.7 release.8 release.9
597	cd ${.CURDIR} && ${MAKE} ${EXTRAS}
598	@echo "Release done"
599
600floppies:
601	cd ${.CURDIR} && ${MAKE} boot.flp
602	cd ${.CURDIR} && ${MAKE} fixit.flp
603	cd ${RD} && find floppies -print | cpio -dumpl ${FD}
604
605boot.flp:
606	rm -f release.4 release.8
607	cd ${.CURDIR} && ${MAKE} release.4 release.8 CRUNCH_TARGETS=boot
608
609fixit.flp:
610	rm -f release.4 release.9
611	cd ${.CURDIR} && ${MAKE} release.4 release.9 CRUNCH_TARGETS=fixit
612
613write_mfs_in_kernel:	${.CURDIR}/write_mfs_in_kernel.c
614	${CC} ${CFLAGS} -o write_mfs_in_kernel ${.CURDIR}/write_mfs_in_kernel.c
615
616dumpnlist:	${.CURDIR}/dumpnlist.c
617	${CC} ${CFLAGS} -o dumpnlist ${.CURDIR}/dumpnlist.c
618
619installCRUNCH:
620.if !defined(CRUNCH)
621	@echo "CRUNCH undefined in installCRUNCH" && exit 1
622.endif
623.if !defined(DIR)
624	@echo "DIR undefined in installCRUNCH" && exit 1
625.endif
626.if !defined(ZIP)
627	@echo "ZIP undefined in installCRUNCH" && exit 1
628.endif
629	if ${ZIP} ; then \
630		gzip -9 < ${RD}/crunch/${CRUNCH} > ${DIR}/${CRUNCH}_crunch ; \
631	else \
632		ln -f ${RD}/crunch/${CRUNCH} ${DIR}/${CRUNCH}_crunch ; \
633	fi
634	chmod 555 ${DIR}/${CRUNCH}_crunch
635	for i in `crunchgen -l ${.CURDIR}/${CRUNCH}_crunch.conf` ; do \
636		ln -f ${DIR}/${CRUNCH}_crunch ${DIR}/$$i ; \
637	done
638
639#
640# --==## Compile a kernel by name ${KERNEL} ##==--
641#
642# We don't erase the sys/compile/${KERNEL} directory, since somebody
643# may want to reuse it (release.8 presently)
644#
645doKERNEL:
646	rm -f ${RD}/kernels/${KERNEL}
647	cd ${.CURDIR}/../sys/i386/conf && config ${KERNEL}
648	cd ${.CURDIR}/../sys/compile/${KERNEL} && \
649			make  depend && \
650			make  kernel && \
651			cp kernel ${RD}/kernels/${KERNEL}
652
653#
654# --==## Put a filesystem into a BOOTMFS kernel ##==--
655#
656doMFSKERN:
657	@rm -f ${RD}/kernels/BOOTMFS.${FSIMAGE}
658	@rm -f /sys/compile/BOOTMFS/mfs_vfsops.o
659	@cd ${.CURDIR}/../sys/i386/conf && \
660	  sed	-e '/pty/d' \
661		-e '/PROCFS/d' \
662		-e '/KTRACE/d' \
663		-e 's/GENERIC/BOOTMFS/g' \
664		-e '/maxusers/s/10/4/' < GENERIC > BOOTMFS && \
665	  echo "options  MFS" >> BOOTMFS && \
666	  echo "options  NFS_NOSERVER" >> BOOTMFS && \
667	  echo 'options  "MAXCONS=4"' >> BOOTMFS && \
668	  echo "options  USERCONFIG_BOOT" >> BOOTMFS
669	@echo "options \"MFS_ROOT=`cat fs-image.${FSIMAGE}.size`\"" >> \
670	  ${.CURDIR}/../sys/i386/conf/BOOTMFS
671	cd ${.CURDIR} && ${MAKE} doKERNEL KERNEL=BOOTMFS
672	@rm -rf ${RD}/boot.${FSIMAGE}
673	@mkdir  ${RD}/boot.${FSIMAGE}
674	@mv ${RD}/kernels/BOOTMFS ${RD}/kernels/BOOTMFS.${FSIMAGE}
675	@cp ${RD}/kernels/BOOTMFS.${FSIMAGE} ${RD}/boot.${FSIMAGE}/kernel
676.if defined(BOOT_CONFIG)
677	@echo "${BOOT_CONFIG}" >${RD}/boot.${FSIMAGE}/boot.config
678.endif
679	@vnconfig /dev/${VNDEVICE} fs-image.${FSIMAGE}
680	@mkdir -p /tmp/mnt_xx
681	@mount /dev/${VNDEVICE} /tmp/mnt_xx
682	./dumpnlist ${RD}/boot.${FSIMAGE}/kernel > /tmp/mnt_xx/stand/symbols
683	@umount /tmp/mnt_xx
684	@vnconfig -u /dev/${VNDEVICE}
685	@rmdir /tmp/mnt_xx
686	./write_mfs_in_kernel ${RD}/boot.${FSIMAGE}/kernel \
687		fs-image.${FSIMAGE}
688	kzip -v ${RD}/boot.${FSIMAGE}/kernel
689	@mv ${RD}/boot.${FSIMAGE}/kernel ${RD}/kernels/MFSKERNEL.${FSIMAGE}
690	@mv ${RD}/boot.${FSIMAGE}/kernel.kz ${RD}/boot.${FSIMAGE}/kernel
691	@cp ${.CURDIR}/../sys/i386/boot/biosboot/boot.help ${RD}/boot.${FSIMAGE}
692	@touch ${RD}/boot.${FSIMAGE}/boot.config
693	@touch ${RD}/boot.${FSIMAGE}/kernel.config
694	@rm -f ${RD}/floppies/boot${FSIMAGE}.flp
695	sh -e ${.CURDIR}/doFS.sh ${RD} ${MNT} ${FDSIZE} ${RD}/boot.${FSIMAGE} \
696		${BOOTINODE} ${FDLABEL}
697	mv fs-image ${RD}/floppies/boot${FSIMAGE}.flp
698
699.include <bsd.prog.mk>
700