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