-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
45 lines (36 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
test:
cargo test -- --nocapture
PLATFORMS:=x86_64-apple-darwin x86_64-unknown-linux-gnu x86_64-unknown-linux-musl aarch64-apple-darwin
VERSION:=0.1.2
CLI:=phoner
HOST_TRIPLE := $(shell rustc -vV | grep 'host:' | awk '{print $$2}')
all: $(PLATFORMS)
x86_64-apple-darwin:
cargo build --release --locked --features download-progress
x86_64-unknown-linux-musl:
TARGET_CC=x86_64-linux-musl-cc cargo build --release --target x86_64-unknown-linux-musl --locked --features download-progress
x86_64-unknown-linux-gnu:
TARGET_CC=x86_64-linux-gnu-cc cargo build --release --target x86_64-unknown-linux-gnu --locked --features download-progress
aarch64-apple-darwin:
cargo build --release --target aarch64-apple-darwin --locked --features download-progress
artifacts:all
@mkdir -p artifacts/$(VERSION)
@for platform in $(PLATFORMS); do \
if [ "$$platform" == "$(HOST_TRIPLE)" ]; then \
chmod +x target/release/$(CLI); \
mkdir /tmp/$(CLI); \
cp target/release/$(CLI) /tmp/$(CLI); \
tar zcvf $(CLI)_$$platform.tar.gz -C /tmp $(CLI); \
rm -rf /tmp/$(CLI); \
else \
chmod +x target/$$platform/release/$(CLI); \
mkdir /tmp/$(CLI); \
cp target/$$platform/release/$(CLI) /tmp/$(CLI); \
tar zcvf $(CLI)_$$platform.tar.gz -C /tmp $(CLI); \
rm -rf /tmp/$(CLI); \
fi; \
mv $(CLI)_$$platform.tar.gz artifacts/$(VERSION); \
md5 -q artifacts/$(VERSION)/$(CLI)_$$platform.tar.gz > artifacts/$(VERSION)/$(CLI)_$$platform.tar.gz.md5; \
done
@echo "generate artifacts done !!!"
.PHONY: artifacts