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
|
|
|
|
2015-01-16 17:40:30 +00:00
|
|
|
VHD_DESC= Azure, VirtualPC, Hyper-V, Xen disk image
|
|
|
|
VMDK_DESC= VMWare, VirtualBox disk image
|
|
|
|
QCOW2_DESC= Qemu, KVM disk image
|
|
|
|
RAW_DESC= Unformatted raw disk image
|
|
|
|
|
2014-10-29 17:04:09 +00:00
|
|
|
CLOUDWARE?= AZURE \
|
|
|
|
OPENSTACK
|
2014-10-29 16:18:29 +00:00
|
|
|
AZURE_FORMAT= vhdf
|
2015-01-16 17:05:35 +00:00
|
|
|
AZURE_DESC= Microsoft Azure platform image
|
2014-10-29 17:04:09 +00:00
|
|
|
OPENSTACK_FORMAT=qcow2
|
2015-01-16 17:05:35 +00:00
|
|
|
OPENSTACK_DESC= OpenStack platform image
|
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
|
2014-11-20 03:46:35 +00:00
|
|
|
|
|
|
|
vm-${_CW:tl}:
|
|
|
|
mkdir -p ${.OBJDIR}/${.TARGET}
|
|
|
|
env TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
|
|
|
|
${.CURDIR}/scripts/mk-vmimage.sh \
|
|
|
|
-C ${.CURDIR}/tools/vmimage.subr -d ${.OBJDIR}/${.TARGET} \
|
|
|
|
-i ${.OBJDIR}/${_CW:tl}.img -s ${VMSIZE} -f ${${_CW}_FORMAT} \
|
|
|
|
-S ${WORLDDIR} -o ${.OBJDIR}/${${_CW}IMAGE} -c ${${_CW}CONF}
|
|
|
|
touch ${.TARGET}
|
2014-10-29 15:52:17 +00:00
|
|
|
. 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}
|
2015-01-16 17:05:35 +00:00
|
|
|
|
2015-01-16 17:40:30 +00:00
|
|
|
list-vmtargets: list-cloudware
|
|
|
|
@${ECHO}
|
|
|
|
@${ECHO} "Supported virtual machine disk image formats:"
|
|
|
|
.for FORMAT in ${VMFORMATS:tu}
|
|
|
|
@${ECHO} " ${FORMAT:tl}: ${${FORMAT}_DESC}"
|
|
|
|
.endfor
|
|
|
|
|
2015-01-16 17:05:35 +00:00
|
|
|
list-cloudware:
|
|
|
|
.if !empty(CLOUDWARE)
|
2015-01-16 17:40:30 +00:00
|
|
|
@${ECHO}
|
|
|
|
@${ECHO} "Supported cloud hosting provider images:"
|
2015-01-16 17:05:35 +00:00
|
|
|
. for _CW in ${CLOUDWARE}
|
2015-01-16 17:40:30 +00:00
|
|
|
@${ECHO} " ${_CW:tu}: ${${_CW:tu}_DESC}"
|
2015-01-16 17:05:35 +00:00
|
|
|
. endfor
|
|
|
|
.endif
|