2014-10-29 15:57:30 +01:00
|
|
|
#
|
|
|
|
# $FreeBSD$
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# Makefile for building virtual machine and cloud provider disk images.
|
|
|
|
#
|
|
|
|
|
2014-11-05 14:22:19 +01:00
|
|
|
VMTARGETS= vm-image
|
2014-10-29 15:57:30 +01:00
|
|
|
VMFORMATS?= vhd vmdk qcow2 raw
|
|
|
|
VMSIZE?= 20G
|
|
|
|
VMBASE?= vm
|
2014-10-29 16:52:17 +01:00
|
|
|
|
2014-10-29 18:04:09 +01:00
|
|
|
CLOUDWARE?= AZURE \
|
|
|
|
OPENSTACK
|
2014-10-29 17:18:29 +01:00
|
|
|
AZURE_FORMAT= vhdf
|
2014-10-29 18:04:09 +01:00
|
|
|
OPENSTACK_FORMAT=qcow2
|
2014-10-29 16:52:17 +01: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 \
|
2014-11-08 13:40:59 +01:00
|
|
|
vm-${_CW:tl} \
|
2014-10-29 16:52:17 +01:00
|
|
|
${_CW:tl}.${${_CW:tu}_FORMAT} \
|
|
|
|
${_CW:tl}.${${_CW:tu}_FORMAT}.raw
|
2014-10-29 17:18:29 +01:00
|
|
|
${_CW:tu}IMAGE= ${_CW:tl}.${${_CW:tu}_FORMAT}
|
2014-10-29 16:52:17 +01: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 15:57:30 +01:00
|
|
|
|
|
|
|
.if defined(WITH_VMIMAGES) && !empty(WITH_VMIMAGES)
|
|
|
|
CLEANDIRS+= ${VMTARGETS}
|
|
|
|
CLEANFILES+= ${VMBASE}.img
|
|
|
|
. for FORMAT in ${VMFORMATS}
|
|
|
|
CLEANFILES+= ${VMBASE}.${FORMAT}
|
|
|
|
. endfor
|
|
|
|
.endif
|
|
|
|
|
2014-11-05 14:22:19 +01:00
|
|
|
vm-base: vm-image
|
2014-10-29 15:57:30 +01:00
|
|
|
|
2014-11-05 14:22:19 +01:00
|
|
|
vm-image:
|
2014-10-29 15:57:30 +01:00
|
|
|
.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} \
|
2014-11-05 14:22:19 +01:00
|
|
|
${.CURDIR}/${TARGET}/mk-vmimage.sh \
|
|
|
|
-C ${.CURDIR}/tools/vmimage.subr -d ${.TARGET} \
|
|
|
|
-i ${VMBASE}.img -s ${VMSIZE} -f ${FORMAT} \
|
|
|
|
-S ${WORLDDIR} -o ${VMBASE}.${FORMAT}
|
2014-10-29 15:57:30 +01:00
|
|
|
. endfor
|
|
|
|
. endif
|
|
|
|
.endif
|
|
|
|
touch ${.TARGET}
|
|
|
|
|
2014-11-04 00:59:53 +01:00
|
|
|
vm-cloudware: ${CLOUDTARGETS}
|
|
|
|
|
2014-10-29 15:57:30 +01:00
|
|
|
vm-azure:
|
2014-11-05 14:22:19 +01:00
|
|
|
.if exists(${.CURDIR}/${TARGET}/mk-vmimage.sh)
|
|
|
|
env TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
|
|
|
|
${.CURDIR}/${TARGET}/mk-vmimage.sh \
|
|
|
|
-C ${.CURDIR}/tools/vmimage.subr -d ${.TARGET} \
|
|
|
|
-i azure.img -s ${VMSIZE} -f ${AZURE_FORMAT} \
|
|
|
|
-S ${WORLDDIR} -o ${AZUREIMAGE} -c ${AZURECONF}
|
2014-10-29 15:57:30 +01:00
|
|
|
.endif
|
|
|
|
touch ${.TARGET}
|
2014-10-29 18:04:09 +01:00
|
|
|
|
|
|
|
vm-openstack:
|
2014-11-05 14:22:19 +01:00
|
|
|
.if exists(${.CURDIR}/${TARGET}/mk-vmimage.sh)
|
2014-10-29 18:04:09 +01:00
|
|
|
env TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
|
2014-11-05 14:22:19 +01:00
|
|
|
${.CURDIR}/${TARGET}/mk-vmimage.sh \
|
|
|
|
-C ${.CURDIR}/tools/vmimage.subr -d ${.TARGET} \
|
|
|
|
-i openstack.img -s ${VMSIZE} -f ${OPENSTACK_FORMAT} \
|
|
|
|
-S ${WORLDDIR} -o ${OPENSTACKIMAGE} -c ${OPENSTACKCONF}
|
2014-10-29 18:04:09 +01:00
|
|
|
.endif
|
|
|
|
touch ${.TARGET}
|