generated from ewpratten/rust-template
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
71 lines (58 loc) · 3.56 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
# All sources used to build the protomask binary
SRC = Cargo.toml $(shell find src/ -type f -name '*.rs')
CONFIGS = $(shell find config/ -type f -name '*.json')
DEBIAN_SCRIPTS = $(shell find debian/ -type f)
# Used to auto-version things
CRATE_VERSION = $(shell sed -n -r "s/^version = \"([0-9\.]+)\"/\1/p" Cargo.toml)
.PHONY: all release clean
all: release
target/x86_64-unknown-linux-musl/release/protomask: $(SRC)
cross build --target x86_64-unknown-linux-musl --release --bin protomask
target/x86_64-unknown-linux-musl/release/protomask-clat: $(SRC)
cross build --target x86_64-unknown-linux-musl --release --bin protomask-clat
target/aarch64-unknown-linux-musl/release/protomask: $(SRC)
cross build --target aarch64-unknown-linux-musl --release
target/x86_64-unknown-linux-musl/release/protomask-clat: $(SRC)
cross build --target x86_64-unknown-linux-musl --release --bin protomask-clat
target/protomask.tar.gz: target/x86_64-unknown-linux-musl/release/protomask \
target/x86_64-unknown-linux-musl/release/protomask-clat \
target/aarch64-unknown-linux-musl/release/protomask \
target/aarch64-unknown-linux-musl/release/protomask-clat \
$(CONFIGS)
mkdir -p target/protomask_tar_temp/{bin,config}
mkdir -p target/protomask_tar_temp/bin/{x86_64,aarch64}
cp target/x86_64-unknown-linux-musl/release/protomask target/protomask_tar_temp/bin/x86_64/protomask
cp target/x86_64-unknown-linux-musl/release/protomask-clat target/protomask_tar_temp/bin/x86_64/protomask-clat
cp target/aarch64-unknown-linux-musl/release/protomask target/protomask_tar_temp/bin/aarch64/protomask
cp target/aarch64-unknown-linux-musl/release/protomask-clat target/protomask_tar_temp/bin/aarch64/protomask-clat
cp config/*.json target/protomask_tar_temp/config/
tar -czf target/protomask.tar.gz -C target/protomask_tar_temp .
rm -rf target/protomask_tar_temp
target/x86_64-unknown-linux-musl/debian/protomask_${CRATE_VERSION}_amd64.deb: target/x86_64-unknown-linux-musl/release/protomask \
target/x86_64-unknown-linux-musl/release/protomask-clat \
$(CONFIGS) \
$(DEBIAN_SCRIPTS)
cargo deb --target x86_64-unknown-linux-musl --no-build
target/aarch64-unknown-linux-musl/debian/protomask_${CRATE_VERSION}_arm64.deb: target/aarch64-unknown-linux-musl/release/protomask \
target/aarch64-unknown-linux-musl/release/protomask-clat \
$(CONFIGS) \
$(DEBIAN_SCRIPTS)
cargo deb --target aarch64-unknown-linux-musl --no-build
target/x86_64-unknown-linux-musl/generate-rpm/protomask-${CRATE_VERSION}-1.x86_64.rpm: target/x86_64-unknown-linux-musl/release/protomask \
target/x86_64-unknown-linux-musl/release/protomask-clat \
$(CONFIGS)
cargo generate-rpm --target x86_64-unknown-linux-musl
target/aarch64-unknown-linux-musl/generate-rpm/protomask-${CRATE_VERSION}-1.aarch64.rpm: target/aarch64-unknown-linux-musl/release/protomask \
target/aarch64-unknown-linux-musl/release/protomask-clat \
$(CONFIGS)
cargo generate-rpm --target aarch64-unknown-linux-musl
release: target/protomask.tar.gz \
target/x86_64-unknown-linux-musl/debian/protomask_${CRATE_VERSION}_amd64.deb \
target/aarch64-unknown-linux-musl/debian/protomask_${CRATE_VERSION}_arm64.deb \
target/x86_64-unknown-linux-musl/generate-rpm/protomask-${CRATE_VERSION}-1.x86_64.rpm \
target/aarch64-unknown-linux-musl/generate-rpm/protomask-${CRATE_VERSION}-1.aarch64.rpm
mkdir -p release
cp $^ release/
clean:
rm -rf release
cargo clean