-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathmakefile
164 lines (116 loc) · 3.58 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
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
distr_dir = target/distribute
all:
@echo "Try `make install-scli`, `make install-sclc`, or `make install-scallopy`"
# ================================
# === Base Scallop Executables ===
install-scli:
cargo install --path etc/scli
build-scli:
cargo build --release --bin scli
install-sclc:
cargo install --path etc/sclc
build-sclc:
cargo build --release --bin sclc
install-sclrepl:
cargo install --path etc/sclrepl
build-sclrepl:
cargo build --release --bin sclrepl
# ===============================
# === Python related packages ===
## Scallopy
install-scallopy:
maturin build --release --manifest-path etc/scallopy/Cargo.toml --out target/wheels/current
find target/wheels/current -name "*.whl" -print | xargs pip install --force-reinstall
rm -rf target/wheels/current
build-scallopy:
maturin build --release --manifest-path etc/scallopy/Cargo.toml --out target/wheels
develop-scallopy:
cd etc/scallopy; maturin develop --release
## Scallop CLI
install-scallop-cli:
make -C etc/scallop-cli install
build-scallop-cli:
make -C etc/scallop-cli build
develop-scallop-cli:
make -C etc/scallop-cli develop
## Scallopy Plugins
install-scallopy-plugins:
make -C etc/scallopy-plugins install
build-scallopy-plugins:
make -C etc/scallopy-plugins build
develop-scallopy-plugins:
make -C etc/scallopy-plugins develop
# =================================================
# === Collect wheels and packages to distribute ===
distribute:
@echo "==> Create distribute folder..."
mkdir -p $(distr_dir)
@echo "==> Copy core scallop..."
cp target/release/scli $(distr_dir)
cp target/release/sclrepl $(distr_dir)
cp target/release/sclc $(distr_dir)
@echo "==> Copy wheels..."
cp target/wheels/*.whl $(distr_dir)
cp etc/scallop-cli/dist/*.whl $(distr_dir)
cp -r etc/scallopy-plugins/**/dist/*.whl $(distr_dir)
# ==========================================
# === Scallop WASM for Web Demo and Node ===
wasm-demo:
make -C etc/scallop-wasm
run-wasm-demo:
cd etc/scallop-wasm/demo; python3 -m http.server
# ==========================================
# === Scallop vitrual environment ===
init-venv:
python3 -m venv .env
.env/bin/pip install --upgrade pip
.env/bin/pip install maturin torch torchvision transformers gym scikit-learn opencv-python tqdm matplotlib
clear-venv:
rm -rf .env
# =============================
# === Scallop VSCode Plugin ===
vscode-plugin:
make -C etc/vscode-scl
# ====================================
# === Project testing and cleaning ===
clean:
cargo clean
make -C etc/scallopy clean
make -C etc/scallopy-plugins clean
make -C etc/scallop-cli clean
make -C etc/scallop-wasm clean
check:
cargo check --workspace
test:
@echo "[Info] Performing cargo test..."
@make test-cargo
@echo "[Info] Performing scallopy test..."
@make test-scallopy
test-all: test
@echo "[Info] Performing cargo test [ignored]..."
@make test-cargo-ignored
@echo "[Info] Performing scallopy test..."
@make test-scallopy
test-cargo:
cargo test --workspace
test-cargo-ignored:
cargo test --workspace -- --ignored
test-scallopy: develop-scallopy
python3 etc/scallopy/tests/test.py
# ======================
# === Documentations ===
doc:
cargo doc
serve-doc:
@echo "Starting Scallop Rust documentation server on port 8192..."
@cd target/doc; python3 -m http.server 8192 > /dev/null 2>&1 & open http://localhost:8192/scallop_core
stop-serve-doc:
@echo "Stopping documentation server on port 8192..."
@lsof -t -i:8192 | xargs kill
build-book:
mdbook build doc/
serve-book:
mdbook serve -p 8193 doc/
stop-serve-book:
@echo "Stopping book server on port 8193..."
@lsof -t -i:8193 | xargs kill