forked from black-parrot/black-parrot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.tools
41 lines (33 loc) · 1.3 KB
/
Makefile.tools
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
.PHONY: verilator bsg_sv2v dromajo
verilator_dir := $(BP_TOOLS_DIR)/verilator
dromajo_dir := $(BP_TOOLS_DIR)/dromajo
bsg_sv2v_dir := $(BP_TOOLS_DIR)/bsg_sv2v
define submodule_tool_template
$(1)_tag ?= $(addprefix $(1)., $(shell cd $(2); git rev-parse HEAD))
$(BP_TOOLS_TOUCH_DIR)/$$($(1)_tag):
rm -rf $(BP_TOOLS_TOUCH_DIR)/$(1).*
cd $(BP_TOOLS_DIR); git submodule update --init --recursive --checkout $$($(1)_dir)
+$(MAKE) $(1)_build
touch $(BP_TOOLS_TOUCH_DIR)/$$($(1)_tag)
$(1): | $(BP_TOOLS_TOUCH_DIR)/$$($(1)_tag)
$(1)_manual:
+$(MAKE) $(1)_build
endef
verilator_build:
cd $(verilator_dir); \
autoconf; \
./configure --prefix=$(BP_TOOLS_INSTALL_DIR)
$(MAKE) -C $(verilator_dir)
$(MAKE) -C $(verilator_dir) install
dromajo_build:
mkdir -p $(dromajo_dir)/build
$(CMAKE) -S $(dromajo_dir) -B $(dromajo_dir)/build -DCMAKE_BUILD_TYPE=Release
$(MAKE) -C $(dromajo_dir)/build
cp $(dromajo_dir)/build/dromajo $(BP_TOOLS_BIN_DIR)
cp $(dromajo_dir)/build/libdromajo_cosim.a $(BP_TOOLS_LIB_DIR)
cp $(dromajo_dir)/include/dromajo_cosim.h $(BP_TOOLS_INCLUDE_DIR)
bsg_sv2v_build:
$(MAKE) -j1 -C $(bsg_sv2v_dir) tools
$(eval $(call submodule_tool_template,verilator,$(verilator_dir)))
$(eval $(call submodule_tool_template,bsg_sv2v,$(bsg_sv2v_dir)))
$(eval $(call submodule_tool_template,dromajo,$(dromajo_dir)))