Makefile.tarfloppy revision 1.2
1#	$NetBSD: Makefile.tarfloppy,v 1.2 2002/04/24 23:04:08 bjh21 Exp $
2#
3# Makefile snippet to create a set of ustar floppies.
4# Each floppy has an 8KB header, followed by part or all of the ustar archive.
5#
6
7#
8# Required variables:
9#	_SRC_TOP_	Top level of src tree (set by <bsd.own.mk>)
10#	FLOPPYBASE	Basename of floppies. Floppy number ${n} will
11#			be generated as ${FLOPPYBASE}${n}.fs
12#	FLOPPYSIZE	Size of floppy in 512 byte blocks.
13#	FLOPPYFILES	Files to write to floppy.
14#			Usually set to "boot ${FLOPPYMETAFILE} netbsd"
15#
16
17#
18# Optional variables:
19#	FLOPPY_BOOT		Bootstrap to use as "boot".
20#	FLOPPY_BOOT_STRIP	If yes, strip "boot" before use.
21#	FLOPPY_NETBSD		Kernel to to use as "netbsd".
22#
23#	FLOPPYMAX	Maximum number of floppies to build.
24#			If 1, final image is installed as ${FLOPPYBASE}.fs
25#	FLOPPYMETAFILE	Ustar metafile (optional)
26#	FLOPPYINSTBOOT	Installboot program to use.  ustar file is in @IMAGE@.
27#	FLOPPYPAD	If defined, pad the last floppy to ${FLOPPYSIZE}
28#	FLOPPYINSTDIR	Where to install release images.
29#
30
31
32.if defined(FLOPPY_BOOT)				# {
33CLEANFILES+=	boot
34boot: ${FLOPPY_BOOT}
35	@echo "Copying ${.ALLSRC} to boot"
36	@rm -f boot
37	@cp ${.ALLSRC} boot
38.if defined(FLOPPY_BOOT_STRIP)
39	@${STRIP} boot
40.endif
41.endif	# FLOPPY_BOOT					# }
42
43
44.if defined(FLOPPY_NETBSD)				# {
45CLEANFILES+=	netbsd
46netbsd: ${FLOPPY_NETBSD}
47	@echo "Copying ${.ALLSRC} to netbsd"
48	@rm -f netbsd
49	@cp ${.ALLSRC} netbsd
50.endif	# FLOPPY_NETBSD					# }
51
52
53.if defined(FLOPPYMETAFILE)				# {
54CLEANFILES+=	${FLOPPYMETAFILE}
55${FLOPPYMETAFILE}:
56	@echo "Creating ${FLOPPYMETAFILE}"
57	@rm -f ${FLOPPYMETAFILE}
58	@touch ${FLOPPYMETAFILE}
59.endif	# FLOPPYMETAFILE				# }
60
61
62${FLOPPYBASE}1.fs: ${FLOPPYFILES} ${DISTRIBDIR}/common/buildfloppies.sh
63	@echo "Creating ${FLOPPYBASE}1.fs from: ${FLOPPYFILES}"
64	PAX=${PAX:Q} sh ${DISTRIBDIR}/common/buildfloppies.sh \
65	    ${FLOPPYMAX:D-m ${FLOPPYMAX}} \
66	    ${FLOPPYINSTBOOT:D-i ${FLOPPYINSTBOOT}} ${FLOPPYPAD:D-p} \
67	    ${FLOPPYBASE} ${FLOPPYSIZE} ${FLOPPYFILES}
68
69CLEANFILES+=	${FLOPPYBASE}?.fs
70
71
72realall: ${FLOPPYBASE}1.fs
73
74.if defined(FLOPPYINSTDIR)
75release: check_RELEASEDIR .WAIT ${FLOPPYBASE}1.fs
76	-mkdir -p ${RELEASEDIR}/${FLOPPYINSTDIR}
77	if [ -e ${FLOPPYBASE}2.fs ]; then \
78		${RELINSTALL} ${FLOPPYBASE}?.fs \
79		    ${RELEASEDIR}/${FLOPPYINSTDIR}; \
80	else \
81		${RELINSTALL} ${FLOPPYBASE}1.fs \
82		    ${RELEASEDIR}/${FLOPPYINSTDIR}/${FLOPPYBASE}.fs; \
83	fi
84.endif
85