-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
63 lines (52 loc) · 1.59 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
.PHONY=test
test: lint
cargo test --all
.PHONY=run
run:
cargo run
.PHONY=release
release:
cargo build --release
.PHONY=lint
lint:
cargo fmt --all -- --check
cargo clippy -- -D warnings
.PHONY=ci-release-%
ci-release-%:
cargo build --release --target $*
.PHONY=local-cross-release
local-cross-release: local-release-aarch64-apple-darwin local-release-x86_64-apple-darwin local-release-x86_64-unknown-linux-gnu local-release-armv7-unknown-linux-gnueabihf
install-cross-toolchains:
# https://github.com/messense/homebrew-macos-cross-toolchains
brew tap messense/macos-cross-toolchains
local-release-x86_64-apple-darwin: export TARG = x86_64-apple-darwin
local-release-x86_64-apple-darwin:
rustup target add $(TARG) && \
\
CC=cc \
CXX=g++ \
AR=ar \
LINKER=gcc \
cargo build --release --target $(TARG)
local-release-aarch64-apple-darwin: ## For releasing on Apple Silicon
rustup target add aarch64-apple-darwin && \
cargo build --release --target aarch64-apple-darwin
local-release-x86_64-unknown-linux-gnu: export TARG = x86_64-unknown-linux-gnu
local-release-x86_64-unknown-linux-gnu: install-cross-toolchains
rustup target add $(TARG) && \
brew install $(TARG) ; \
\
CC=$(TARG)-gcc \
CXX=$(TARG)-g++ \
AR=$(TARG)-ar \
LINKER=$(TARG)-gcc \
cross build --release --target $(TARG)
local-release-armv7-unknown-linux-gnueabihf: export TARG = armv7-unknown-linux-gnueabihf
local-release-armv7-unknown-linux-gnueabihf: install-cross-toolchains
rustup target add $(TARG) && \
\
CC=$(TARG)-gcc \
CXX=$(TARG)-g++ \
AR=$(TARG)-ar \
LINKER=$(TARG)-gcc \
cargo build --release --target $(TARG)