1# 2# $FreeBSD$ 3# 4# 5# Makefile for building virtual machine and cloud provider disk images. 6# 7 8VMTARGETS= vm-image 9VMFORMATS?= vhd vmdk qcow2 raw 10VMSIZE?= 20G 11VMBASE?= vm 12 13CLOUDWARE?= AZURE \ 14 OPENSTACK 15AZURE_FORMAT= vhdf 16OPENSTACK_FORMAT=qcow2 17 18.if defined(WITH_CLOUDWARE) && !empty(WITH_CLOUDWARE) && !empty(CLOUDWARE) 19. for _CW in ${CLOUDWARE} 20CLOUDTARGETS+= vm-${_CW:tl} 21CLEANDIRS+= vm-${_CW:tl} 22CLEANFILES+= ${_CW:tl}.img \ 23 ${_CW:tl}.${${_CW:tu}_FORMAT} \ 24 ${_CW:tl}.${${_CW:tu}_FORMAT}.raw 25${_CW:tu}IMAGE= ${_CW:tl}.${${_CW:tu}_FORMAT} 26. if exists(${.CURDIR}/tools/${_CW:tl}.conf) && !defined(${_CW:tu}CONF) 27${_CW:tu}CONF?= ${.CURDIR}/tools/${_CW:tl}.conf 28. endif 29. endfor 30.endif 31 32.if defined(WITH_VMIMAGES) && !empty(WITH_VMIMAGES) 33CLEANDIRS+= ${VMTARGETS} 34CLEANFILES+= ${VMBASE}.img 35. for FORMAT in ${VMFORMATS} 36CLEANFILES+= ${VMBASE}.${FORMAT} 37. endfor 38.endif 39 40vm-base: vm-image 41 42vm-image: 43.if defined(WITH_VMIMAGES) && !empty(WITH_VMIMAGES) 44. if exists(${.CURDIR}/${TARGET}/mk-vmimage.sh) 45. for FORMAT in ${VMFORMATS} 46 env TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ 47 ${.CURDIR}/${TARGET}/mk-vmimage.sh \ 48 -C ${.CURDIR}/tools/vmimage.subr -d ${.TARGET} \ 49 -i ${VMBASE}.img -s ${VMSIZE} -f ${FORMAT} \ 50 -S ${WORLDDIR} -o ${VMBASE}.${FORMAT} 51. endfor 52. endif 53.endif 54 touch ${.TARGET} 55 56vm-cloudware: ${CLOUDTARGETS} 57 58vm-azure: 59.if exists(${.CURDIR}/${TARGET}/mk-vmimage.sh) 60 env TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ 61 ${.CURDIR}/${TARGET}/mk-vmimage.sh \ 62 -C ${.CURDIR}/tools/vmimage.subr -d ${.TARGET} \ 63 -i azure.img -s ${VMSIZE} -f ${AZURE_FORMAT} \ 64 -S ${WORLDDIR} -o ${AZUREIMAGE} -c ${AZURECONF} 65.endif 66 touch ${.TARGET} 67 68vm-openstack: 69.if exists(${.CURDIR}/${TARGET}/mk-vmimage.sh) 70 env TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ 71 ${.CURDIR}/${TARGET}/mk-vmimage.sh \ 72 -C ${.CURDIR}/tools/vmimage.subr -d ${.TARGET} \ 73 -i openstack.img -s ${VMSIZE} -f ${OPENSTACK_FORMAT} \ 74 -S ${WORLDDIR} -o ${OPENSTACKIMAGE} -c ${OPENSTACKCONF} 75.endif 76 touch ${.TARGET} 77