forked from Bareflank/hypervisor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.bf
171 lines (137 loc) · 4.88 KB
/
Makefile.bf
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
#
# Bareflank Hypervisor
#
# Copyright (C) 2015 Assured Information Security, Inc.
# Author: Rian Quinn <[email protected]>
# Author: Brendan Kerrigan <[email protected]>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
SHELL=/bin/bash
################################################################################
# Color
################################################################################
CS='\033[1;95m'
CE='\033[0m'
################################################################################
# Load Modules
################################################################################
ifeq ($(MODULES),)
MODULE_FILE=%BUILD_ABS%/module_file
else
ifneq ($(shell if [[ "$(MODULES)" == "/"* ]]; then echo abs; fi; ),abs)
MODULE_FILE=$(PWD)/$(MODULES)
endif
endif
FILTERED_MODULE_FILE=/tmp/module_file
################################################################################
# VCPUID
################################################################################
ifeq ($(VCPUID),)
VCPUID=0
endif
################################################################################
# Subdirs
################################################################################
PARENT_SUBDIRS += bfcrt
PARENT_SUBDIRS += bfunwind
PARENT_SUBDIRS += bfc
PARENT_SUBDIRS += bfcxx
PARENT_SUBDIRS += bfdrivers
PARENT_SUBDIRS += bfelf_loader
PARENT_SUBDIRS += bfm
PARENT_SUBDIRS += bfvmm
PARENT_SUBDIRS += $(wildcard %HYPER_ABS%/src_*/)
PARENT_SUBDIRS += $(wildcard %HYPER_ABS%/hypervisor_*/)
PARENT_SUBDIRS += $(wildcard %BUILD_ABS%/makefiles/src_*/)
PARENT_SUBDIRS += $(wildcard %BUILD_ABS%/makefiles/hypervisor_*/)
################################################################################
# Common
################################################################################
include %HYPER_ABS%/common/common_subdir.mk
################################################################################
# Custom Targets
################################################################################
.PHONY: linux_load
.PHONY: linux_unload
.PHONY: windows_load
.PHONY: windows_unload
.PHONY: driver_load
.PHONY: driver_unload
.PHONY: load
.PHONY: unload
.PHONY: start
.PHONY: stop
.PHONY: dump
.PHONY: status
.PHONY: quick
.PHONY: loop
.PHONY: unittest
.PHONY: astyle
.PHONY: astyle_clean
.PHONY: doxygen
.PHONY: doxygen_clean
ifeq ($(shell uname -s), Linux)
SUDO:=sudo
else
SUDO:=
endif
windows_load: force
@%BUILD_ABS%/build_scripts/build_driver.sh
windows_unload: force
@%BUILD_ABS%/build_scripts/clean_driver.sh
linux_load: force
@%BUILD_ABS%/build_scripts/build_driver.sh
linux_unload: force
@%BUILD_ABS%/build_scripts/clean_driver.sh
driver_load:
@%BUILD_ABS%/build_scripts/build_driver.sh
driver_unload: force
@%BUILD_ABS%/build_scripts/clean_driver.sh
load: force
@%BUILD_ABS%/build_scripts/filter_module_file.sh $(MODULE_FILE) $(FILTERED_MODULE_FILE)
@$(SUDO) LD_LIBRARY_PATH=%BUILD_ABS%/makefiles/bfm/bin/native/ %BUILD_ABS%/makefiles/bfm/bin/native/bfm load $(FILTERED_MODULE_FILE)
unload: force
@$(SUDO) LD_LIBRARY_PATH=%BUILD_ABS%/makefiles/bfm/bin/native/ %BUILD_ABS%/makefiles/bfm/bin/native/bfm unload
start: force
@sync
@$(SUDO) LD_LIBRARY_PATH=%BUILD_ABS%/makefiles/bfm/bin/native/ %BUILD_ABS%/makefiles/bfm/bin/native/bfm start
stop: force
@$(SUDO) LD_LIBRARY_PATH=%BUILD_ABS%/makefiles/bfm/bin/native/ %BUILD_ABS%/makefiles/bfm/bin/native/bfm stop
dump: force
@$(SUDO) LD_LIBRARY_PATH=%BUILD_ABS%/makefiles/bfm/bin/native/ %BUILD_ABS%/makefiles/bfm/bin/native/bfm dump --vcpuid $(VCPUID)
status: force
@$(SUDO) LD_LIBRARY_PATH=%BUILD_ABS%/makefiles/bfm/bin/native/ %BUILD_ABS%/makefiles/bfm/bin/native/bfm status
quick: load start
loop: force
@for n in $(shell seq 1 $(NUM)); do \
echo -e $(CS)"cycle: $$n"$(CE); \
$(MAKE) --no-print-directory load; \
$(MAKE) --no-print-directory start; \
$(MAKE) --no-print-directory stop; \
$(MAKE) --no-print-directory unload; \
done \
unittest: run_tests
astyle:
@cd %HYPER_ABS%; \
%HYPER_ABS%/tools/astyle/linux/run.sh
astyle_clean:
@cd %HYPER_ABS%; \
%HYPER_ABS%/tools/astyle/linux/run.sh clean
doxygen:
@cd %HYPER_ABS%; \
%HYPER_ABS%/tools/doxygen/linux/run.sh
doxygen_clean:
@cd %HYPER_ABS%; \
%HYPER_ABS%/tools/doxygen/linux/run.sh clean