-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
73 lines (59 loc) · 2.94 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
all: debug
debug:
cargo build
release:
cargo build --release
raspberry_armhf_debug:
cargo build --target=armv7-unknown-linux-gnueabihf
raspberry_armhf:
cargo build --release --target=armv7-unknown-linux-gnueabihf
raspberry_aarch64_debug:
cargo build --target=aarch64-unknown-linux-gnu
raspberry_aarch64:
cargo build --release --target=aarch64-unknown-linux-gnu
test:
cargo test
coverage:
ifeq ("", $(shell which cargo-tarpaulin))
$(error "No cargo tarpaulin found in $(PATH), please install with cargo install cargo-tarpaulin if you want to run coverage")
endif
cargo tarpaulin
tag: debug
$(eval VERSION=$(shell target/debug/fireguard --version | sed 's#fireguard ##g'))
$(eval CHANGELOG=$(shell git log $(shell git describe --tags --abbrev=0)..HEAD --oneline))
@echo The changelog from the previous tag to $(VERSION) is:"$(CHANGELOG)"
@echo "######################### Start $(VERSION) changelog ###################" >> CHANGELOG.md
@echo "$(CHANGELOG)" >> CHANGELOG.md
@echo "######################### End $(VERSION) changelog ###################" >> CHANGELOG.md
vim CHANGELOG.md
cargo fmt
git add *
git commit -a
git tag v$(VERSION)
docker_prepare:
cross build --target x86_64-unknown-linux-gnu --release
cross build --target aarch64-unknown-linux-gnu --release
cross build --target armv7-unknown-linux-gnueabihf --release
mkdir -p docker/linux/amd64
mkdir -p docker/linux/arm64
mkdir -p docker/linux/arm/v7
cp target/x86_64-unknown-linux-gnu/release/fireguard docker/linux/amd64/fireguard
cp target/aarch64-unknown-linux-gnu/release/fireguard docker/linux/arm64/fireguard
cp target/armv7-unknown-linux-gnueabihf/release/fireguard docker/linux/arm/v7
docker_buildx_setup:
docker buildx use multiarch || (docker run --rm --privileged multiarch/qemu-user-static --reset -p yes && \
docker buildx create --name multiarch --driver docker-container --use)
docker_build: docker_prepare docker_buildx_setup
$(eval VERSION=$(shell target/x86_64-unknown-linux-gnu/release/fireguard --version | sed 's#fireguard ##g'))
docker buildx use multiarch && \
docker buildx inspect --bootstrap && \
docker buildx build --platform linux/arm64,linux/arm/v7 -t blackmesalab/fireguard:latest docker && \
docker buildx build --platform linux/arm64,linux/arm/v7 -t blackmesalab/fireguard:$(VERSION) docker && \
docker buildx build --load --platform linux/amd64 -t blackmesalab/fireguard:latest docker && \
docker buildx build --load --platform linux/amd64 -t blackmesalab/fireguard:$(VERSION) docker
docker_push: docker_prepare docker_buildx_setup
$(eval VERSION=$(shell target/x86_64-unknown-linux-gnu/release/fireguard --version | sed 's#fireguard ##g'))
docker buildx use multiarch && \
docker buildx inspect --bootstrap && \
docker buildx build --push --platform linux/amd64,linux/arm64,linux/arm/v7 -t blackmesalab/fireguard:latest docker && \
docker buildx build --push --platform linux/amd64,linux/arm64,linux/arm/v7 -t blackmesalab/fireguard:$(VERSION) docker