2014-10-29 14:57:30 +00:00
|
|
|
#
|
|
|
|
# $FreeBSD$
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# Makefile for building virtual machine and cloud provider disk images.
|
|
|
|
#
|
|
|
|
|
2014-11-05 13:22:19 +00:00
|
|
|
VMTARGETS= vm-image
|
2014-10-29 14:57:30 +00:00
|
|
|
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
|
|
|
|
|
2014-11-05 13:22:19 +00:00
|
|
|
vm-base: vm-image
|
2014-10-29 14:57:30 +00:00
|
|
|
|
2014-11-05 13:22:19 +00:00
|
|
|
vm-image:
|
2014-10-29 14:57:30 +00:00
|
|
|
.if defined(WITH_VMIMAGES) && !empty(WITH_VMIMAGES)
|
2014-11-08 16:44:45 +00:00
|
|
|
. for FORMAT in ${VMFORMATS}
|
2014-11-08 12:45:35 +00:00
|
|
|
mkdir -p ${.OBJDIR}/${.TARGET}
|
2014-10-29 14:57:30 +00:00
|
|
|
env TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
|
2014-11-08 16:44:45 +00:00
|
|
|
${.CURDIR}/scripts/mk-vmimage.sh \
|
2014-11-08 12:45:35 +00:00
|
|
|
-C ${.CURDIR}/tools/vmimage.subr -d ${.OBJDIR}/${.TARGET} \
|
2014-11-08 16:44:45 +00:00
|
|
|
-i ${.OBJDIR}/${VMBASE}.img -s ${VMSIZE} -f ${FORMAT} \
|
|
|
|
-S ${WORLDDIR} -o ${.OBJDIR}/${VMBASE}.${FORMAT}
|
|
|
|
. endfor
|
2014-10-29 14:57:30 +00:00
|
|
|
.endif
|
|
|
|
touch ${.TARGET}
|
|
|
|
|
2014-11-03 23:59:53 +00:00
|
|
|
vm-cloudware: ${CLOUDTARGETS}
|
|
|
|
|
2014-10-29 14:57:30 +00:00
|
|
|
vm-azure:
|
2014-11-08 12:45:35 +00:00
|
|
|
mkdir -p ${.OBJDIR}/${.TARGET}
|
2014-11-05 13:22:19 +00:00
|
|
|
env TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
|
2014-11-08 16:44:45 +00:00
|
|
|
${.CURDIR}/scripts/mk-vmimage.sh \
|
2014-11-08 12:45:35 +00:00
|
|
|
-C ${.CURDIR}/tools/vmimage.subr -d ${.OBJDIR}/${.TARGET} \
|
2014-11-08 16:44:45 +00:00
|
|
|
-i ${.OBJDIR}/azure.img -s ${VMSIZE} -f ${AZURE_FORMAT} \
|
|
|
|
-S ${WORLDDIR} -o ${.OBJDIR}/${AZUREIMAGE} -c ${AZURECONF}
|
2014-10-29 14:57:30 +00:00
|
|
|
touch ${.TARGET}
|
2014-10-29 17:04:09 +00:00
|
|
|
|
|
|
|
vm-openstack:
|
2014-11-08 12:45:35 +00:00
|
|
|
mkdir -p ${.OBJDIR}/${.TARGET}
|
2014-10-29 17:04:09 +00:00
|
|
|
env TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
|
2014-11-08 16:44:45 +00:00
|
|
|
${.CURDIR}/scripts/mk-vmimage.sh \
|
2014-11-08 12:45:35 +00:00
|
|
|
-C ${.CURDIR}/tools/vmimage.subr -d ${.OBJDIR}/${.TARGET} \
|
2014-11-08 16:44:45 +00:00
|
|
|
-i ${.OBJDIR}/openstack.img -s ${VMSIZE} -f ${OPENSTACK_FORMAT} \
|
|
|
|
-S ${WORLDDIR} -o ${.OBJDIR}/${OPENSTACKIMAGE} -c ${OPENSTACKCONF}
|
2014-10-29 17:04:09 +00:00
|
|
|
touch ${.TARGET}
|