-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
91 lines (77 loc) · 2.33 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
# Copyright (C) 2024 Ethan Uppal. All rights reserved.
BUILD := debug
ifeq ($(shell uname), Darwin)
OPEN := $(shell which open)
else
OPEN := $(shell which xdg-open)
endif
.PHONY: build
build:
@echo '[INFO] Building project'
@cargo build
@echo 'cargo run -- $$@' > ./main
@chmod u+x ./main
.PHONY: fmt
fmt:
@echo '[INFO] Formatting project'
@cargo +nightly fmt
.PHONY: test
test: build
@echo '[INFO] Running tests'
@cargo nextest run --features disable_color
.PHONY: lint
lint:
@echo '[INFO] Linting with clippy'
@cargo clippy -- -A clippy::new_without_default -A clippy::comparison_chain
.PHONY: coverage
coverage: build
@echo '[INFO] Checking coverage'
@cargo llvm-cov nextest --html
@open target/llvm-cov/html/index.html
.PHONY: deps
deps:
@echo '[INFO] Installing dependencies'
@cargo install cargo-nextest
@curl -LsSf https://insta.rs/install.sh | sh
@cargo install cargo-llvm-cov
@if [ "$(shell uname -s)" = "Linux" ]; then \
echo '[INFO] Installing Verilator on Ubuntu'; \
sudo apt-get install -y verilator; \
elif [ "$(shell uname -s)" = "Darwin" ]; then \
echo '[INFO] Installing Verilator on macOS'; \
brew install verilator; \
fi
@echo '[INFO] Checking verilator version'
verilator --version
.PHONY: ci_install_calyx
ci_install_calyx:
@echo '[INFO] Installing calyx'
if [ ! -d "$(HOME)/calyx" ]; then \
cd $(HOME) && git clone https://github.com/calyxir/calyx.git; \
fi
cd $(HOME)/calyx && cargo build
cd $(HOME)/calyx && ./target/debug/calyx --version
cd $(HOME)/calyx && python -m pip install flit
cd $(HOME)/calyx && cd calyx-py && flit install -s && cd -
cd $(HOME)/calyx && flit -f fud/pyproject.toml install -s --deps production
fud config --create global.root $(HOME)/calyx
.PHONY: ci_check
ci_check:
@echo "Checking that 'make' works"
make
# @echo "Checking that the verilator testing harness works"
# cd tests/calyx-verilog && make N=twice
# cd tests/calyx-verilog && make N=map
# @echo "Checking that './main' works"
# ./main 1>/dev/null 2>/dev/null || exit 0
.PHONY: clean
clean:
@echo '[INFO] Removing build files'
@cargo clean
.PHONY: docs
docs:
@echo '[INFO] Building and viewing documentation'
@cargo doc -p pulsar-frontend -p pulsar-ir -p pulsar-backend -p pulsar-utils -p pulsar-lang --no-deps --examples
.PHONY: cloc
cloc:
@cloc --include-lang=rust --by-file --exclude-dir=target .