Makefile.tarfloppy revision 1.1
1#	$NetBSD: Makefile.tarfloppy,v 1.1 2002/04/16 09:00:20 lukem 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	sh ${DISTRIBDIR}/common/buildfloppies.sh ${FLOPPYMAX:D-m ${FLOPPYMAX}} \
65	    ${FLOPPYINSTBOOT:D-i ${FLOPPYINSTBOOT}} ${FLOPPYPAD:D-p} \
66	    ${FLOPPYBASE} ${FLOPPYSIZE} ${FLOPPYFILES}
67
68CLEANFILES+=	${FLOPPYBASE}?.fs
69
70
71realall: ${FLOPPYBASE}1.fs
72
73.if defined(FLOPPYINSTDIR)
74release: check_RELEASEDIR .WAIT ${FLOPPYBASE}1.fs
75	-mkdir -p ${RELEASEDIR}/${FLOPPYINSTDIR}
76	if [ -e ${FLOPPYBASE}2.fs ]; then \
77		${RELINSTALL} ${FLOPPYBASE}?.fs \
78		    ${RELEASEDIR}/${FLOPPYINSTDIR}; \
79	else \
80		${RELINSTALL} ${FLOPPYBASE}1.fs \
81		    ${RELEASEDIR}/${FLOPPYINSTDIR}/${FLOPPYBASE}.fs; \
82	fi
83.endif
84