-
Notifications
You must be signed in to change notification settings - Fork 15
/
vmm.mk
93 lines (76 loc) · 2.28 KB
/
vmm.mk
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#
# Copyright 2024, UNSW (ABN 57 195 873 179)
#
# SPDX-License-Identifier: BSD-2-Clause
#
# Snippet to build libvmm.a, to be included in a full-system Makefile.
#
LIBVMM_DIR := $(abspath $(dir $(lastword ${MAKEFILE_LIST})))
GIC_V3_BOARDS := imx8mm_evk maaxboard
ifeq ($(filter ${MICROKIT_BOARD},${GIC_V3_BOARDS}),)
VGIC := GIC_V2
VGIC_FILES := src/arch/aarch64/vgic/vgic_v2.c
else
VGIC := GIC_V3
VGIC_FILES := src/arch/aarch64/vgic/vgic_v3.c
endif
AARCH64_FILES := src/arch/aarch64/fault.c \
src/arch/aarch64/linux.c \
src/arch/aarch64/linux.c \
src/arch/aarch64/psci.c \
src/arch/aarch64/smc.c \
src/arch/aarch64/tcb.c \
src/arch/aarch64/vcpu.c \
src/arch/aarch64/virq.c \
src/arch/aarch64/vgic/vgic.c \
${VGIC_FILES}
# VIRTIO MMIO depends on sddf
ifeq ($(strip $(SDDF)),)
$(error libvmm needs the location of the SDDF to build virtIO components)
endif
# we need ${SDDF} for virtIO; we need ${LIBVMM} for all
# the libvmm api interfaces
ifeq ($(findstring ${SDDF}/include, ${CFLAGS}),)
CFLAGS += -I${SDDF}/include
endif
ifeq ($(findstring ${LIBVMM_DIR}/include,${CFLAGS}),)
CFLAGS += -I${LIBVMM_DIR}/include
endif
ARCH_INDEP_FILES := src/util/printf.c \
src/util/util.c \
src/virtio/block.c \
src/virtio/console.c \
src/virtio/mmio.c \
src/virtio/net.c \
src/virtio/sound.c \
src/guest.c
CFILES := ${AARCH64_FILES} ${ARCH_INDEP_FILES}
OBJECTS := $(subst src,libvmm,${CFILES:.c=.o})
# Generate dependencies automatically
CFLAGS += -MD
# Force rebuid if CFLAGS changes.
# This will pick up (among other things} changes
# to Microkit BOARD and CONFIG.
CHECK_LIBVMM_CFLAGS:=.libvmm_cflags.$(shell echo ${CFLAGS} | shasum | sed 's/ *-$$//')
.libvmm_cflags.%:
rm -f .libvmm_cflags.*
echo ${CFLAGS} > $@
# This is ugly, but needed to distinguish directories in the BUILD area
# from directories in the source area.
libvmm/arch/aarch64/vgic:
mkdir -p libvmm/arch/aarch64/vgic/
mkdir -p libvmm/util
mkdir -p libvmm/virtio
libvmm.a: ${OBJECTS}
ar rv $@ $^
${OBJECTS}: ${SDDF}/include
${OBJECTS}: ${CHECK_LIBVMM_CFLAGS} |libvmm/arch/aarch64/vgic
libvmm/%.o: src/%.c
${CC} ${CFLAGS} -c -o $@ $<
-include ${OBJECTS:.o=.d}
clean::
rm -f ${OBJECTS} ${OBJECTS:.c=.d}
clobber:: clean
rmdir src/arch/aarch64/vgic
rmdir src/util
rmdir src/virtio