Makefile.tarfloppy revision 1.4
1#	$NetBSD: Makefile.tarfloppy,v 1.4 2002/05/02 18:02:31 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#	NETBSDSRCDIR	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#	FLOPPYINSTBOOT		Installboot program to use.
23#				USTAR image file is in @IMAGE@.
24#	FLOPPYMAX		Maximum number of floppies to build.
25#				If 1, the final image is installed as
26#				${FLOPPYBASE}.fs instead of ${FLOPPYBASE}1.fs
27#	FLOPPYMETAFILE		USTAR metafile(s) (optional)
28#	FLOPPYPAD		If defined, pad the last floppy to ${FLOPPYSIZE}
29#	FLOPPY_RELEASEDIR	Where to install release floppies.
30#
31
32
33.if defined(FLOPPY_BOOT)				# {
34CLEANFILES+=	boot
35boot: ${FLOPPY_BOOT}
36	@echo "Copying ${.ALLSRC} to boot"
37	@rm -f boot
38	@cp ${.ALLSRC} boot
39.if defined(FLOPPY_BOOT_STRIP)
40	@${STRIP} boot
41.endif
42.endif	# FLOPPY_BOOT					# }
43
44
45.if defined(FLOPPY_NETBSD)				# {
46CLEANFILES+=	netbsd
47netbsd: ${FLOPPY_NETBSD}
48	@echo "Copying ${.ALLSRC} to netbsd"
49	@rm -f netbsd
50	@cp ${.ALLSRC} netbsd
51.endif	# FLOPPY_NETBSD					# }
52
53
54.if defined(FLOPPYMETAFILE)				# {
55CLEANFILES+=	${FLOPPYMETAFILE}
56${FLOPPYMETAFILE}:
57	@echo "Creating ${FLOPPYMETAFILE}"
58	@rm -f ${FLOPPYMETAFILE}
59	@touch ${FLOPPYMETAFILE}
60.endif	# FLOPPYMETAFILE				# }
61
62
63${FLOPPYBASE}1.fs: ${FLOPPYFILES} ${DISTRIBDIR}/common/buildfloppies.sh
64	@echo "Creating ${FLOPPYBASE}1.fs from: ${FLOPPYFILES}"
65	PAX=${PAX:Q} sh ${DISTRIBDIR}/common/buildfloppies.sh \
66	    ${FLOPPYMAX:D-m ${FLOPPYMAX}} \
67	    ${FLOPPYINSTBOOT:D-i ${FLOPPYINSTBOOT}} ${FLOPPYPAD:D-p} \
68	    ${FLOPPYBASE} ${FLOPPYSIZE} ${FLOPPYFILES}
69
70CLEANFILES+=	${FLOPPYBASE}?.fs
71
72
73realall: ${FLOPPYBASE}1.fs
74
75.if defined(FLOPPY_RELEASEDIR)
76release: check_RELEASEDIR .WAIT ${FLOPPYBASE}1.fs
77	if [ -e ${FLOPPYBASE}2.fs ]; then \
78		${RELEASE_INSTALL} ${FLOPPYBASE}?.fs \
79		    ${RELEASEDIR}/${FLOPPY_RELEASEDIR}; \
80	else \
81		${RELEASE_INSTALL} ${FLOPPYBASE}1.fs \
82		    ${RELEASEDIR}/${FLOPPY_RELEASEDIR}/${FLOPPYBASE}.fs; \
83	fi
84.endif
85