aboutsummaryrefslogtreecommitdiff
path: root/release/Makefile.vm
blob: db3ac541654d3575aecdbe951cc98622b9749307 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#
# $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-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}