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 +nightly fmt -- --check
clippy:
cargo clippy --all-features --all-targets -- -D warnings
test-local:
cargo test --all-features
test: check-format clippy test-local
fmt:
cargo +nightly fmt
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
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
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