-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
92 lines (73 loc) · 2.17 KB
/
Makefile
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
#
# Makefile
#
# Copyright (C) 2020-2023 BlueRock Security, Inc.
# All rights reserved.
#
# This software is distributed under the terms of the BlueRock Open-Source License.
# See the LICENSE-BlueRock file in the repository root for details.
#
.DEFAULT_GOAL := all
DOXYGEN ?= doxygen
export PLATFORM ?= posix
UNAME_M = $(shell uname -m)
ifeq ($(UNAME_M),arm64)
ARCH ?= aarch64
else ifeq ($(UNAME_M),x86_64)
ARCH ?= x86_64
else
$(error Unsupported architecture $(UNAME_S))
endif
export ARCH
SUBDIRS = devices/vbus devices/vpl011 devices/gic arch/arch_api devices/timer devices/simple_as
SUBDIRS += devices/virtio_base devices/virtio_console devices/virtio_net devices/msr
SUBDIRS += vcpu/vcpu_roundup vcpu/cpu_model devices/virtio_sock config/vmm_debug
SUBDIRS += platform/posix_core
ifeq ($(ARCH), aarch64)
SUBDIRS += devices/firmware
endif
ifeq ($(CMDGOAL), doc)
check_tool=$(if $(shell which $(1)),,$(error "$(1) not found - Consider installing this tool))
doc:
$(call check_tool,$(DOXYGEN))
$(DOXYGEN) doc/Doxyfile
@echo "================================================="
@echo "Documentation generated in doc/html and doc/latex"
@echo "================================================="
.PHONY: doc
else
export BLDDIR ?= build-$(PLATFORM)-$(ARCH)/
EXAMPLES = examples/vbus_posix examples/virtio_posix
define include_bu
$(eval BU := $(notdir $(1)))
$(eval CUR_DIR := $(1)/)
$(eval include $(1)/Makefile)
$(eval include $(1)/deps.mk)
$(eval include support/build/bu.mk)
endef
define include_bu_lib
$(eval LIBNAME := $(notdir $(1)))
$(call include_bu,$(1))
endef
$(foreach l,$(SUBDIRS), $(call include_bu_lib,$l))
ALL_LIB_OUTPUTS := $(foreach e, $(SUBDIRS), $($(notdir $e)_OUTPUT))
define include_bu_app
$(eval APPNAME := $(notdir $(1)))
$(call include_bu,$(1))
endef
undefine LIBNAME
$(foreach l,$(EXAMPLES), $(call include_bu_app,$l))
undefine APPNAME
undefine CUR_DIR
all: $(foreach e, $(EXAMPLES), $($(notdir $e)_OUTPUT))
clean:
rm -Rf $(BLDDIR)
RUN_TEST_PREFIX=run_test_
test: $(addprefix $(RUN_TEST_PREFIX),$(EXAMPLES))
.PHONY: test
define run_example
$(RUN_TEST_PREFIX)$(1): $(1)
$(BLDDIR)$(1)/$(notdir $(1))
endef
$(foreach e,$(EXAMPLES),$(eval $(call run_example,$e)))
endif