-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
72 lines (59 loc) · 2.06 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
# Makefile to aid with local development and testing
# This is not required for automated builds
ifeq ($(OS),Windows_NT)
PLATFORM := win
else
UNAME := $(shell uname)
ifeq ($(UNAME),Linux)
PLATFORM := linux
endif
ifeq ($(UNAME),Darwin)
PLATFORM := mac
endif
endif
check-format:
cargo fmt -- --check
clippy:
cargo clippy --all-features --all-targets -- -D warnings
test-local:
cargo test --all-features
# Full local validation, build and test all features including wasm
# Run this before pushing a PR to pre-validate
test: check-format clippy test-local
fmt:
cargo +nightly fmt
# Creates a folder wtih c2patool bin, samples and readme
c2patool-package:
rm -rf target/c2patool*
mkdir -p target/c2patool
mkdir -p target/c2patool/sample
cp target/release/c2patool target/c2patool/c2patool
cp README.md target/c2patool/README.md
cp sample/* target/c2patool/sample
cp CHANGELOG.md target/c2patool/CHANGELOG.md
# These are for building the c2patool release bin on various platforms
build-release-win:
cargo build --release
build-release-mac-arm:
rustup target add aarch64-apple-darwin
MACOSX_DEPLOYMENT_TARGET=11.1 cargo build --target=aarch64-apple-darwin --release
build-release-mac-x86:
rustup target add x86_64-apple-darwin
MACOSX_DEPLOYMENT_TARGET=10.15 cargo build --target=x86_64-apple-darwin --release
build-release-mac-universal: build-release-mac-arm build-release-mac-x86
lipo -create -output target/release/c2patool target/aarch64-apple-darwin/release/c2patool target/x86_64-apple-darwin/release/c2patool
build-release-linux:
cargo build --release
# Builds and packages a zip for c2patool for each platform
ifeq ($(PLATFORM), mac)
release: build-release-mac-universal c2patool-package
cd target && zip -r c2patool_mac_universal.zip c2patool && cd ..
endif
ifeq ($(PLATFORM), win)
release: build-release-win c2patool-package
cd target && 7z a -r c2patool_win_intel.zip c2patool && cd ..
endif
ifeq ($(PLATFORM), linux)
release: build-release-linux c2patool-package
cd target && tar -czvf c2patool_linux_intel.tar.gz c2patool && cd ..
endif