-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
65 lines (53 loc) · 1.49 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
# Following this tutorial: https://markentier.tech/posts/2022/01/speedy-rust-builds-under-wsl2/
# This makes developing on windows significantly easier for rust projects!!
SOURCE_DIR = $(PWD)
# `notdir` returns the part after the last `/`
# so if the source was "/some/nested/project", only "project" remains
BUILD_DIR = ~/tmp/$(notdir $(SOURCE_DIR))
wsl.build: wsl.sync
cd $(BUILD_DIR) && cargo build
rsync -av $(BUILD_DIR)/target/debug/ $(SOURCE_DIR)/target/debug/ \
--exclude .git \
--exclude target \
--exclude .fingerprint \
--exclude build \
--exclude incremental \
--exclude deps \
--exclude .terraform \
--exclude .terraform.lock.hcl \
--exclude .terraform.tfstate \
--exclude .terraform.tfstate.backup \
--exclude modules \
--exclude charts
wsl.run: wsl.sync
cd $(BUILD_DIR) && cargo run
wsl.test: wsl.sync
cd $(BUILD_DIR) && cargo test
wsl.sync:
mkdir -p $(BUILD_DIR)
rsync -av $(SOURCE_DIR)/ $(BUILD_DIR)/ \
--exclude .git \
--exclude target \
--exclude .fingerprint \
--exclude build \
--exclude incremental \
--exclude deps \
--exclude .terraform \
--exclude .terraform.lock.hcl \
--exclude .terraform.tfstate \
--exclude .terraform.tfstate.backup \
--exclude modules \
--exclude charts
wsl.clean:
rm -rf $(BUILD_DIR)/target
wsl.clean-all:
rm -rf $(BUILD_DIR)
wsl.clippy: wsl.sync
cd $(BUILD_DIR) && cargo clippy
docker.build:
docker compose build
docker.push:
docker compose push
lint: wsl.clippy
cargo fmt --all
npx prettier --write .