16513e474SGlen Barber# 26513e474SGlen Barber# $FreeBSD$ 36513e474SGlen Barber# 46513e474SGlen Barber# 56513e474SGlen Barber# Makefile for building virtual machine and cloud provider disk images. 66513e474SGlen Barber# 76513e474SGlen Barber 86513e474SGlen BarberVMTARGETS= vm-base vm-image 96513e474SGlen BarberVMFORMATS?= vhd vmdk qcow2 raw 106513e474SGlen BarberVMSIZE?= 20G 116513e474SGlen BarberVMBASE?= vm 12d08ce983SGlen Barber 13*573e7ccaSGlen BarberCLOUDWARE?= AZURE \ 14*573e7ccaSGlen Barber OPENSTACK 15f27438c7SGlen BarberAZURE_FORMAT= vhdf 16*573e7ccaSGlen BarberOPENSTACK_FORMAT=qcow2 17d08ce983SGlen Barber 18d08ce983SGlen Barber.if defined(WITH_CLOUDWARE) && !empty(WITH_CLOUDWARE) && !empty(CLOUDWARE) 19d08ce983SGlen Barber. for _CW in ${CLOUDWARE} 20d08ce983SGlen BarberCLOUDTARGETS+= vm-${_CW:tl} 21d08ce983SGlen BarberCLEANDIRS+= vm-${_CW:tl} 22d08ce983SGlen BarberCLEANFILES+= ${_CW:tl}.img \ 23d08ce983SGlen Barber ${_CW:tl}.${${_CW:tu}_FORMAT} \ 24d08ce983SGlen Barber ${_CW:tl}.${${_CW:tu}_FORMAT}.raw 25f27438c7SGlen Barber${_CW:tu}IMAGE= ${_CW:tl}.${${_CW:tu}_FORMAT} 26d08ce983SGlen Barber. if exists(${.CURDIR}/tools/${_CW:tl}.conf) && !defined(${_CW:tu}CONF) 27d08ce983SGlen Barber${_CW:tu}CONF?= ${.CURDIR}/tools/${_CW:tl}.conf 28d08ce983SGlen Barber. endif 29d08ce983SGlen Barber. endfor 30d08ce983SGlen Barber.endif 316513e474SGlen Barber 326513e474SGlen Barber.if defined(WITH_VMIMAGES) && !empty(WITH_VMIMAGES) 336513e474SGlen BarberCLEANDIRS+= ${VMTARGETS} 346513e474SGlen BarberCLEANFILES+= ${VMBASE}.img 356513e474SGlen Barber. for FORMAT in ${VMFORMATS} 366513e474SGlen BarberCLEANFILES+= ${VMBASE}.${FORMAT} 376513e474SGlen Barber. endfor 386513e474SGlen Barber.endif 396513e474SGlen Barber 406513e474SGlen Barbervm-base: 416513e474SGlen Barber.if defined(WITH_VMIMAGES) && !empty(WITH_VMIMAGES) 426513e474SGlen Barber. if exists(${.CURDIR}/${TARGET}/mk-vmimage.sh) 436513e474SGlen Barber env TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ 446513e474SGlen Barber ${.CURDIR}/${TARGET}/mk-vmimage.sh ${.TARGET} \ 456513e474SGlen Barber ${VMBASE}.img ${WORLDDIR} ${.OBJDIR}/${.TARGET} ${VMSIZE} 466513e474SGlen Barber. endif 476513e474SGlen Barber.endif 486513e474SGlen Barber touch ${.TARGET} 496513e474SGlen Barber 506513e474SGlen Barbervm-image: vm-base 516513e474SGlen Barber.if defined(WITH_VMIMAGES) && !empty(WITH_VMIMAGES) 526513e474SGlen Barber. if exists(${.CURDIR}/${TARGET}/mk-vmimage.sh) 536513e474SGlen Barber. for FORMAT in ${VMFORMATS} 546513e474SGlen Barber env TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ 556513e474SGlen Barber ${.CURDIR}/${TARGET}/mk-vmimage.sh ${.TARGET} \ 566513e474SGlen Barber ${VMBASE}.img ${FORMAT} ${VMBASE}.${FORMAT} 576513e474SGlen Barber. endfor 586513e474SGlen Barber. endif 596513e474SGlen Barber.endif 606513e474SGlen Barber touch ${.TARGET} 616513e474SGlen Barber 626513e474SGlen Barbervm-azure: 636513e474SGlen Barber.if exists(${.CURDIR}/${TARGET}/mk-azure.sh) 646513e474SGlen Barber env TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} AZURECONF=${AZURECONF} \ 65f27438c7SGlen Barber AZURE_FORMAT=${AZURE_FORMAT} \ 666513e474SGlen Barber ${.CURDIR}/${TARGET}/mk-azure.sh ${.TARGET} azure.img \ 67f27438c7SGlen Barber ${WORLDDIR} ${.TARGET} ${VMSIZE} ${AZUREIMAGE} 686513e474SGlen Barber.endif 696513e474SGlen Barber touch ${.TARGET} 70*573e7ccaSGlen Barber 71*573e7ccaSGlen Barbervm-openstack: 72*573e7ccaSGlen Barber.if exists(${.CURDIR}/${TARGET}/mk-openstack.sh) 73*573e7ccaSGlen Barber env TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ 74*573e7ccaSGlen Barber OPENSTACKCONF=${OPENSTACKCONF} 75*573e7ccaSGlen Barber OPENSTACK_FORMAT=${OPENSTACK_FORMAT} \ 76*573e7ccaSGlen Barber ${.CURDIR}/${TARGET}/mk-openstack.sh ${.TARGET} openstack.img \ 77*573e7ccaSGlen Barber ${WORLDDIR} ${.TARGET} ${VMSIZE} ${OPENSTACKIMAGE} 78*573e7ccaSGlen Barber.endif 79*573e7ccaSGlen Barber touch ${.TARGET} 80