1
+
2
+ CURL_ARGS = -C - --retry 5 --retry-delay 2 --retry-connrefused -L -o
3
+
4
+ export PATH := $(PATH ) :/opt/sail/bin:/workspaces/sail-riscv/c_emulator:/opt/riscv32/riscv/bin:/opt/riscv64/riscv/bin
5
+
6
+ setup : setup-ctg setup-isac setup-riscof setup-sail-riscv setup-rv32 setup-rv64
7
+
8
+ CTG := $(shell command -v riscv_ctg 2> /dev/null)
9
+ setup-ctg :
10
+ ifndef CTG
11
+ pip install --editable ./riscv-ctg
12
+ endif
13
+ echo "riscv-ctg install"
14
+
15
+ ISAC := $(shell command -v riscv_isac 2> /dev/null)
16
+ setup-isac :
17
+ ifndef ISAC
18
+ pip install --editable ./riscv-isac
19
+ endif
20
+ echo "riscv-isac install"
21
+
22
+ RISCOF := $(shell command -v riscof 2> /dev/null)
23
+ setup-riscof :
24
+ ifndef RISCOF
25
+ pip install riscof
26
+ endif
27
+ echo "riscof install"
28
+
29
+ SAIL := $(shell command -v sail 2> /dev/null)
30
+ _setup-sail :
31
+ ifndef SAIL
32
+ curl $(CURL_ARGS) /opt/sail.tar.gz https://github.com/rems-project/sail/releases/download/0.18-linux-binary/sail.tar.gz
33
+ tar xzf /opt/sail.tar.gz -C /opt/
34
+ sail -v
35
+ echo 'export PATH="$$PATH:/opt/sail/bin"' >> ~/.zshrc
36
+ endif
37
+ echo "sail install"
38
+
39
+ SAIL_RISCV := $(shell command -v riscv_sim_RV64 2> /dev/null)
40
+ setup-sail-riscv : _setup-sail
41
+ ifndef SAIL
42
+ cd .. && git clone https://github.com/riscv/sail-riscv.git
43
+ cd sail-riscv
44
+ ARCH=RV32 make -j$(nproc)
45
+ ARCH=RV64 make -j$(nproc)
46
+ riscv_sim_RV32 --help
47
+ riscv_sim_RV64 --help
48
+ echo 'export PATH="$$PATH:/workspaces/sail-riscv/c_emulator"' >> ~/.zshrc
49
+ endif
50
+ echo "sail-riscv install"
51
+
52
+ RV32 := $(shell command -v riscv32-unknown-elf-gcc 2> /dev/null)
53
+ setup-rv32 :
54
+ ifndef RV32
55
+ curl $(CURL_ARGS) /opt/riscv32.tar.xz https://github.com/riscv-collab/riscv-gnu-toolchain/releases/download/2024.11.22/riscv32-elf-ubuntu-22.04-gcc-nightly-2024.11.22-nightly.tar.xz
56
+ mkdir -p /opt/riscv32
57
+ tar xf /opt/riscv32.tar.xz -C /opt/riscv32
58
+ riscv32-unknown-elf-gcc --version
59
+ echo 'export PATH="$$PATH:/opt/riscv32/riscv/bin"' >> ~/.zshrc
60
+ endif
61
+ echo "rv64 toolchain install"
62
+
63
+ RV64 := $(shell command -v riscv64-unknown-elf-gcc 2> /dev/null)
64
+ setup-rv64 :
65
+ ifndef RV64
66
+ curl $(CURL_ARGS) /opt/riscv64.tar.xz https://github.com/riscv-collab/riscv-gnu-toolchain/releases/download/2024.11.22/riscv64-elf-ubuntu-22.04-gcc-nightly-2024.11.22-nightly.tar.xz
67
+ mkdir -p /opt/riscv64
68
+ tar xf /opt/riscv64.tar.xz -C /opt/riscv64
69
+ riscv64-unknown-elf-gcc --version
70
+ echo 'export PATH="$$PATH:/opt/riscv64/riscv/bin"' >> ~/.zshrc
71
+ endif
72
+ echo "rv64 toolchain install"
73
+
74
+ clean_zip :
75
+ rm /opt/sail.tar.gz
76
+ rm /opt/riscv32.tar.xz
77
+ rm /opt/riscv64.tar.xz
0 commit comments