2014-10-29 14:57:30 +00:00
|
|
|
#
|
|
|
|
# $FreeBSD$
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# Makefile for building virtual machine and cloud provider disk images.
|
|
|
|
#
|
|
|
|
|
|
|
|
VMTARGETS= vm-base vm-image
|
|
|
|
VMFORMATS?= vhd vmdk qcow2 raw
|
|
|
|
VMSIZE?= 20G
|
|
|
|
VMBASE?= vm
|
2014-10-29 15:52:17 +00:00
|
|
|
|
2014-10-29 17:04:09 +00:00
|
|
|
CLOUDWARE?= AZURE \
|
|
|
|
OPENSTACK
|
2014-10-29 16:18:29 +00:00
|
|
|
AZURE_FORMAT= vhdf
|
2014-10-29 17:04:09 +00:00
|
|
|
OPENSTACK_FORMAT=qcow2
|
2014-10-29 15:52:17 +00:00
|
|
|
|
|
|
|
.if defined(WITH_CLOUDWARE) && !empty(WITH_CLOUDWARE) && !empty(CLOUDWARE)
|
|
|
|
. for _CW in ${CLOUDWARE}
|
|
|
|
CLOUDTARGETS+= vm-${_CW:tl}
|
|
|
|
CLEANDIRS+= vm-${_CW:tl}
|
|
|
|
CLEANFILES+= ${_CW:tl}.img \
|
|
|
|
${_CW:tl}.${${_CW:tu}_FORMAT} \
|
|
|
|
${_CW:tl}.${${_CW:tu}_FORMAT}.raw
|
2014-10-29 16:18:29 +00:00
|
|
|
${_CW:tu}IMAGE= ${_CW:tl}.${${_CW:tu}_FORMAT}
|
2014-10-29 15:52:17 +00:00
|
|
|
. if exists(${.CURDIR}/tools/${_CW:tl}.conf) && !defined(${_CW:tu}CONF)
|
|
|
|
${_CW:tu}CONF?= ${.CURDIR}/tools/${_CW:tl}.conf
|
|
|
|
. endif
|
|
|
|
. endfor
|
|
|
|
.endif
|
2014-10-29 14:57:30 +00:00
|
|
|
|
|
|
|
.if defined(WITH_VMIMAGES) && !empty(WITH_VMIMAGES)
|
|
|
|
CLEANDIRS+= ${VMTARGETS}
|
|
|
|
CLEANFILES+= ${VMBASE}.img
|
|
|
|
. for FORMAT in ${VMFORMATS}
|
|
|
|
CLEANFILES+= ${VMBASE}.${FORMAT}
|
|
|
|
. endfor
|
|
|
|
.endif
|
|
|
|
|
|
|
|
vm-base:
|
|
|
|
.if defined(WITH_VMIMAGES) && !empty(WITH_VMIMAGES)
|
|
|
|
. if exists(${.CURDIR}/${TARGET}/mk-vmimage.sh)
|
|
|
|
env TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
|
|
|
|
${.CURDIR}/${TARGET}/mk-vmimage.sh ${.TARGET} \
|
|
|
|
${VMBASE}.img ${WORLDDIR} ${.OBJDIR}/${.TARGET} ${VMSIZE}
|
|
|
|
. endif
|
|
|
|
.endif
|
|
|
|
touch ${.TARGET}
|
|
|
|
|
|
|
|
vm-image: vm-base
|
|
|
|
.if defined(WITH_VMIMAGES) && !empty(WITH_VMIMAGES)
|
|
|
|
. if exists(${.CURDIR}/${TARGET}/mk-vmimage.sh)
|
|
|
|
. for FORMAT in ${VMFORMATS}
|
|
|
|
env TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
|
|
|
|
${.CURDIR}/${TARGET}/mk-vmimage.sh ${.TARGET} \
|
|
|
|
${VMBASE}.img ${FORMAT} ${VMBASE}.${FORMAT}
|
|
|
|
. endfor
|
|
|
|
. endif
|
|
|
|
.endif
|
|
|
|
touch ${.TARGET}
|
|
|
|
|
2014-11-03 23:59:53 +00:00
|
|
|
vm-cloudware: ${CLOUDTARGETS}
|
|
|
|
|
2014-10-29 14:57:30 +00:00
|
|
|
vm-azure:
|
|
|
|
.if exists(${.CURDIR}/${TARGET}/mk-azure.sh)
|
|
|
|
env TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} AZURECONF=${AZURECONF} \
|
2014-10-29 16:18:29 +00:00
|
|
|
AZURE_FORMAT=${AZURE_FORMAT} \
|
2014-10-29 14:57:30 +00:00
|
|
|
${.CURDIR}/${TARGET}/mk-azure.sh ${.TARGET} azure.img \
|
2014-10-29 16:18:29 +00:00
|
|
|
${WORLDDIR} ${.TARGET} ${VMSIZE} ${AZUREIMAGE}
|
2014-10-29 14:57:30 +00:00
|
|
|
.endif
|
|
|
|
touch ${.TARGET}
|
2014-10-29 17:04:09 +00:00
|
|
|
|
|
|
|
vm-openstack:
|
|
|
|
.if exists(${.CURDIR}/${TARGET}/mk-openstack.sh)
|
|
|
|
env TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
|
2014-11-03 23:47:00 +00:00
|
|
|
OPENSTACKCONF=${OPENSTACKCONF} \
|
2014-10-29 17:04:09 +00:00
|
|
|
OPENSTACK_FORMAT=${OPENSTACK_FORMAT} \
|
|
|
|
${.CURDIR}/${TARGET}/mk-openstack.sh ${.TARGET} openstack.img \
|
|
|
|
${WORLDDIR} ${.TARGET} ${VMSIZE} ${OPENSTACKIMAGE}
|
|
|
|
.endif
|
|
|
|
touch ${.TARGET}
|