Makefile.tarfloppy revision 1.3
11.3Slukem#	$NetBSD: Makefile.tarfloppy,v 1.3 2002/04/26 15:50:28 lukem Exp $
21.1Slukem#
31.1Slukem# Makefile snippet to create a set of ustar floppies.
41.1Slukem# Each floppy has an 8KB header, followed by part or all of the ustar archive.
51.1Slukem#
61.1Slukem
71.1Slukem#
81.1Slukem# Required variables:
91.3Slukem#	NETBSDSRCDIR	Top level of src tree (set by <bsd.own.mk>)
101.1Slukem#	FLOPPYBASE	Basename of floppies. Floppy number ${n} will
111.1Slukem#			be generated as ${FLOPPYBASE}${n}.fs
121.1Slukem#	FLOPPYSIZE	Size of floppy in 512 byte blocks.
131.1Slukem#	FLOPPYFILES	Files to write to floppy.
141.1Slukem#			Usually set to "boot ${FLOPPYMETAFILE} netbsd"
151.1Slukem#
161.1Slukem
171.1Slukem#
181.1Slukem# Optional variables:
191.1Slukem#	FLOPPY_BOOT		Bootstrap to use as "boot".
201.1Slukem#	FLOPPY_BOOT_STRIP	If yes, strip "boot" before use.
211.1Slukem#	FLOPPY_NETBSD		Kernel to to use as "netbsd".
221.1Slukem#
231.1Slukem#	FLOPPYMAX	Maximum number of floppies to build.
241.1Slukem#			If 1, final image is installed as ${FLOPPYBASE}.fs
251.1Slukem#	FLOPPYMETAFILE	Ustar metafile (optional)
261.1Slukem#	FLOPPYINSTBOOT	Installboot program to use.  ustar file is in @IMAGE@.
271.1Slukem#	FLOPPYPAD	If defined, pad the last floppy to ${FLOPPYSIZE}
281.1Slukem#	FLOPPYINSTDIR	Where to install release images.
291.1Slukem#
301.1Slukem
311.1Slukem
321.1Slukem.if defined(FLOPPY_BOOT)				# {
331.1SlukemCLEANFILES+=	boot
341.1Slukemboot: ${FLOPPY_BOOT}
351.1Slukem	@echo "Copying ${.ALLSRC} to boot"
361.1Slukem	@rm -f boot
371.1Slukem	@cp ${.ALLSRC} boot
381.1Slukem.if defined(FLOPPY_BOOT_STRIP)
391.1Slukem	@${STRIP} boot
401.1Slukem.endif
411.1Slukem.endif	# FLOPPY_BOOT					# }
421.1Slukem
431.1Slukem
441.1Slukem.if defined(FLOPPY_NETBSD)				# {
451.1SlukemCLEANFILES+=	netbsd
461.1Slukemnetbsd: ${FLOPPY_NETBSD}
471.1Slukem	@echo "Copying ${.ALLSRC} to netbsd"
481.1Slukem	@rm -f netbsd
491.1Slukem	@cp ${.ALLSRC} netbsd
501.1Slukem.endif	# FLOPPY_NETBSD					# }
511.1Slukem
521.1Slukem
531.1Slukem.if defined(FLOPPYMETAFILE)				# {
541.1SlukemCLEANFILES+=	${FLOPPYMETAFILE}
551.1Slukem${FLOPPYMETAFILE}:
561.1Slukem	@echo "Creating ${FLOPPYMETAFILE}"
571.1Slukem	@rm -f ${FLOPPYMETAFILE}
581.1Slukem	@touch ${FLOPPYMETAFILE}
591.1Slukem.endif	# FLOPPYMETAFILE				# }
601.1Slukem
611.1Slukem
621.1Slukem${FLOPPYBASE}1.fs: ${FLOPPYFILES} ${DISTRIBDIR}/common/buildfloppies.sh
631.1Slukem	@echo "Creating ${FLOPPYBASE}1.fs from: ${FLOPPYFILES}"
641.2Sbjh21	PAX=${PAX:Q} sh ${DISTRIBDIR}/common/buildfloppies.sh \
651.2Sbjh21	    ${FLOPPYMAX:D-m ${FLOPPYMAX}} \
661.1Slukem	    ${FLOPPYINSTBOOT:D-i ${FLOPPYINSTBOOT}} ${FLOPPYPAD:D-p} \
671.1Slukem	    ${FLOPPYBASE} ${FLOPPYSIZE} ${FLOPPYFILES}
681.1Slukem
691.1SlukemCLEANFILES+=	${FLOPPYBASE}?.fs
701.1Slukem
711.1Slukem
721.1Slukemrealall: ${FLOPPYBASE}1.fs
731.1Slukem
741.1Slukem.if defined(FLOPPYINSTDIR)
751.1Slukemrelease: check_RELEASEDIR .WAIT ${FLOPPYBASE}1.fs
761.1Slukem	-mkdir -p ${RELEASEDIR}/${FLOPPYINSTDIR}
771.1Slukem	if [ -e ${FLOPPYBASE}2.fs ]; then \
781.1Slukem		${RELINSTALL} ${FLOPPYBASE}?.fs \
791.1Slukem		    ${RELEASEDIR}/${FLOPPYINSTDIR}; \
801.1Slukem	else \
811.1Slukem		${RELINSTALL} ${FLOPPYBASE}1.fs \
821.1Slukem		    ${RELEASEDIR}/${FLOPPYINSTDIR}/${FLOPPYBASE}.fs; \
831.1Slukem	fi
841.1Slukem.endif
85