26bb2a6066
scripts/ now that it is consolidated into one file. Fix paths for the base image and output disk image files. Sponsored by: The FreeBSD Foundation
75 lines
2.0 KiB
Makefile
75 lines
2.0 KiB
Makefile
#
|
|
# $FreeBSD$
|
|
#
|
|
#
|
|
# Makefile for building virtual machine and cloud provider disk images.
|
|
#
|
|
|
|
VMTARGETS= 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 \
|
|
vm-${_CW:tl} \
|
|
${_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: vm-image
|
|
|
|
vm-image:
|
|
.if defined(WITH_VMIMAGES) && !empty(WITH_VMIMAGES)
|
|
. for FORMAT in ${VMFORMATS}
|
|
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}/${VMBASE}.img -s ${VMSIZE} -f ${FORMAT} \
|
|
-S ${WORLDDIR} -o ${.OBJDIR}/${VMBASE}.${FORMAT}
|
|
. endfor
|
|
.endif
|
|
touch ${.TARGET}
|
|
|
|
vm-cloudware: ${CLOUDTARGETS}
|
|
|
|
vm-azure:
|
|
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}/azure.img -s ${VMSIZE} -f ${AZURE_FORMAT} \
|
|
-S ${WORLDDIR} -o ${.OBJDIR}/${AZUREIMAGE} -c ${AZURECONF}
|
|
touch ${.TARGET}
|
|
|
|
vm-openstack:
|
|
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}/openstack.img -s ${VMSIZE} -f ${OPENSTACK_FORMAT} \
|
|
-S ${WORLDDIR} -o ${.OBJDIR}/${OPENSTACKIMAGE} -c ${OPENSTACKCONF}
|
|
touch ${.TARGET}
|