freebsd-skq/release/Makefile.vm

82 lines
2.1 KiB
Makefile
Raw Normal View History

#
# $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
CLOUDWARE?= AZURE \
OPENSTACK
AZURE_FORMAT= vhdf
OPENSTACK_FORMAT=qcow2
.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
${_CW:tu}IMAGE= ${_CW:tl}.${${_CW:tu}_FORMAT}
. if exists(${.CURDIR}/tools/${_CW:tl}.conf) && !defined(${_CW:tu}CONF)
${_CW:tu}CONF?= ${.CURDIR}/tools/${_CW:tl}.conf
. endif
. endfor
.endif
.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}
vm-cloudware: ${CLOUDTARGETS}
vm-azure:
.if exists(${.CURDIR}/${TARGET}/mk-azure.sh)
env TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} AZURECONF=${AZURECONF} \
AZURE_FORMAT=${AZURE_FORMAT} \
${.CURDIR}/${TARGET}/mk-azure.sh ${.TARGET} azure.img \
${WORLDDIR} ${.TARGET} ${VMSIZE} ${AZUREIMAGE}
.endif
touch ${.TARGET}
vm-openstack:
.if exists(${.CURDIR}/${TARGET}/mk-openstack.sh)
env TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
OPENSTACKCONF=${OPENSTACKCONF} \
OPENSTACK_FORMAT=${OPENSTACK_FORMAT} \
${.CURDIR}/${TARGET}/mk-openstack.sh ${.TARGET} openstack.img \
${WORLDDIR} ${.TARGET} ${VMSIZE} ${OPENSTACKIMAGE}
.endif
touch ${.TARGET}