-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
117 lines (98 loc) · 2.84 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
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
VIVADO_PATH := "/tools/Xilinx/Vivado/2022.2/bin/vivado"
IN_ENV = if [ -e .venv/bin/activate ]; then . .venv/bin/activate; fi;
CAPNPJ := $(shell which capnpc-java)
PYTHON311 := $(shell which python3.11)
PYTHON312 := $(shell which python3.12)
PUBLIC_SUBMODULES = \
third_party/fasm2bels \
third_party/RapidWright \
third_party/yosys \
third_party/WaFoVe \
third_party/icestorm
PRIVATE_SUBMODULES = \
third_party/gmt_tools
include external_tools.mk
install: submodules venv python_packages install_rapidwright env install_fasm2bels install_yosys install_wafove
venv:
ifneq "$(PYTHON312)" ""
python3.12 -m venv .venv
else ifneq "$(PYTHON311)" ""
python3.11 -m venv .venv
else
python3.10 -m venv .venv
endif
$(IN_ENV) python -m pip install -U pip
packages:
apt-get update
apt-get install -y \
bison \
build-essential \
capnproto \
clang \
default-jre-headless \
flex \
gawk \
graphviz \
gtkwave \
iverilog \
jq \
libantlr4-runtime-dev \
libboost-filesystem-dev \
libboost-python-dev \
libboost-system-dev \
libc++-dev \
libcapnp-dev \
libelf-dev:i386 \
libffi-dev \
libftdi-dev \
libncurses5 \
libreadline-dev \
libstdc++-12-dev \
ninja-build \
openjdk-18-jdk \
pkg-config \
python3-dev \
python3-pip \
python3-venv \
python3-venv \
swig \
tcl-dev \
uuid-dev \
virtualenv \
xdot \
zlib1g-dev \
python_packages:
$(IN_ENV) python -m pip install -r requirements.txt
$(IN_ENV) python -m pip install -e .
if [ -f third_party/gmt_tools/requirements.txt ]; then \
$(IN_ENV) cd third_party/gmt_tools && python -m pip install -r requirements.txt; \
fi
capnproto_java:
ifeq "$(CAPNPJ)" ""
$(eval TEMP_DIR := $(shell mktemp -d))
cd $(TEMP_DIR) && git clone https://github.com/capnproto/capnproto-java
cd $(TEMP_DIR)/capnproto-java && make
cd $(TEMP_DIR)/capnproto-java && make install
rm -rf $(TEMP_DIR)
endif
submodules:
$(foreach submodule,$(PUBLIC_SUBMODULES),git submodule init $(submodule); git submodule update $(submodule);)
$(foreach submodule,$(PRIVATE_SUBMODULES),git submodule init $(submodule); git submodule update $(submodule) || echo "Ignoring failed clone of private submodule ($(submodule))";)
env: venv python_packages
echo >> ".venv/bin/activate"
echo "export VIVADO_PATH=$(VIVADO_PATH)" >> ".venv/bin/activate"
echo "unset VIVADO_PATH" > ".venv/bin/deactivate"
echo "export PYTHONNOUSERSITE=1" >> ".venv/bin/activate"
echo "unset PYTHONNOUSERSITE" >> ".venv/bin/deactivate"
format:
find ./scripts ./bfasst -iname "*.py" -exec black -q -l 100 {} \;
pylint: format
git fetch
pylint --errors-only $$(git ls-files --directory scripts --directory bfasst | grep -e ".py$$")
pylint $$(git diff --name-only | grep -e ".py$$")
doctest:
find bfasst -iname "*.py" -exec python -m doctest {} \;
unittest:
$(IN_ENV) python -m unittest
unittest_failfast:
$(IN_ENV) python -m unittest -f