Makefile.tarfloppy revision 1.12
1# $NetBSD: Makefile.tarfloppy,v 1.12 2006/09/29 08:16:41 pavel 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# Required variables: 7# NETBSDSRCDIR Top level of src tree (set by <bsd.own.mk>) 8# FLOPPYBASE Basename of floppies. Floppy number ${n} will 9# be generated as ${FLOPPYBASE}${n}${FLOPPYSUFFIX} 10# FLOPPYSIZE Size of floppy in 512 byte blocks. 11# FLOPPYFILES Files to write to floppy. 12# Usually set to "boot ${FLOPPYMETAFILE} netbsd" 13# 14# Optional variables: 15# FLOPPY_BOOT Bootstrap to use as "boot". 16# FLOPPY_BOOT_STRIP If yes, strip "boot" before use. 17# FLOPPY_NETBSD Kernel to to use as "netbsd". 18# FLOPPYINSTBOOT Installboot program to use. 19# USTAR image file is in @IMAGE@. 20# FLOPPYMAX Maximum number of floppies to build. 21# If 1, the final image is installed as 22# ${FLOPPYBASE}${FLOPPYSUFFIX} instead of 23# ${FLOPPYBASE}1${FLOPPYSUFFIX} 24# FLOPPYMETAFILE USTAR metafile(s) (optional) 25# FLOPPYPAD If defined, pad the last floppy to ${FLOPPYSIZE} 26# FLOPPYSUFFIX Suffix of created floppies. 27# FLOPPY_RELEASEDIR Where to install release floppies. 28# 29 30.if !defined(_MAKEFILE_TARFLOPPY_) 31_MAKEFILE_TARFLOPPY_=1 32 33 34.if defined(FLOPPY_BOOT) # { 35CLEANFILES+= boot 36boot: ${FLOPPY_BOOT} 37 ${_MKTARGET_CREATE} "(from: ${.ALLSRC})" 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 netbsd.tmp 48.if ${FLOPPY_NETBSD:E}=="gz" 49COPY_CMD= gunzip -c ${.ALLSRC} > ${.TARGET}.tmp 50COMPRESS_CMD= gzip -9c ${.TARGET}.tmp > ${.TARGET}; rm -f ${.TARGET}.tmp 51.else 52COPY_CMD= cp ${.ALLSRC} ${.TARGET}.tmp 53COMPRESS_CMD= mv -f ${.TARGET}.tmp ${.TARGET} 54.endif 55netbsd: ${FLOPPY_NETBSD} 56 ${_MKTARGET_CREATE} "(from: ${.ALLSRC})" 57 ${COPY_CMD} 58 ${STRIP} -R .comment -R .ident ${.TARGET}.tmp 59 ${COMPRESS_CMD} 60.endif # FLOPPY_NETBSD # } 61 62 63.if defined(FLOPPYMETAFILE) # { 64CLEANFILES+= ${FLOPPYMETAFILE} 65${FLOPPYMETAFILE}: 66 ${_MKTARGET_CREATE} 67 @rm -f ${FLOPPYMETAFILE} 68 @touch ${FLOPPYMETAFILE} 69.endif # FLOPPYMETAFILE # } 70 71 72${FLOPPYBASE}1${FLOPPYSUFFIX}: ${FLOPPYFILES} ${DISTRIBDIR}/common/buildfloppies.sh 73 ${_MKTARGET_CREATE} "(from: ${FLOPPYFILES})" 74 PAX=${TOOL_PAX:Q} ${HOST_SH} ${DISTRIBDIR}/common/buildfloppies.sh \ 75 ${FLOPPYINSTBOOT:D-i ${FLOPPYINSTBOOT}} ${FLOPPYPAD:D-p} \ 76 ${FLOPPYMAX:D-m ${FLOPPYMAX}} ${FLOPPYSUFFIX:D-s ${FLOPPYSUFFIX}} \ 77 ${FLOPPYBASE} ${FLOPPYSIZE} ${FLOPPYFILES} 78 79CLEANFILES+= ${FLOPPYBASE}?${FLOPPYSUFFIX} 80 81 82realall: ${FLOPPYBASE}1${FLOPPYSUFFIX} 83 84.if defined(FLOPPY_RELEASEDIR) 85release:: check_RELEASEDIR .WAIT ${FLOPPYBASE}1${FLOPPYSUFFIX} 86 if [ -e ${FLOPPYBASE}2${FLOPPYSUFFIX} ]; then \ 87 ${RELEASE_INSTALL} ${FLOPPYBASE}?${FLOPPYSUFFIX} \ 88 ${RELEASEDIR}/${MACHINE}/${FLOPPY_RELEASEDIR}; \ 89 else \ 90 ${RELEASE_INSTALL} ${FLOPPYBASE}1${FLOPPYSUFFIX} \ 91 ${RELEASEDIR}/${MACHINE}/${FLOPPY_RELEASEDIR}/${FLOPPYBASE}${FLOPPYSUFFIX}; \ 92 fi 93.endif 94 95 96.endif # _MAKEFILE_TARFLOPPY_ 97