VENV := precommit_venv
HOOKS := .git/hooks/pre-commit
$(VENV): .requirements-precommit.txt
virtualenv -p python3 $(VENV)
$(VENV)/bin/pip install -r .requirements-precommit.txt
.PHONY: env
env: $(VENV)
.PHONY: clean-env
clean-env:
rm -rf $(VENV)
CARGO_BIN ?= `which cargo`
TARGET_PATH ?= `pwd`/target/release
BIN_VERSION ?= 0.1.0
BIN_NAME ?= voik
BIN_PATH ?= $(TARGET_PATH)/$(BIN_NAME)
FUNZZY_BIN ?= `which funzzy`
PWD ?= `pwd`
HOME ?= `echo $HOME`
$(HOOKS): $(VENV) .pre-commit-config.yaml
$(VENV)/bin/pre-commit install -f --install-hooks
@$(CARGO_BIN) fmt --help > /dev/null || rustup component add rustfmt
@$(CARGO_BIN) clippy --help > /dev/null || rustup component add clippy
@$(CARGO_BIN) readme --help > /dev/null || cargo install cargo-readme
.PHONY: install-hooks
install-hooks: $(HOOKS)
.PHONY: clean-hooks
clean-hooks:
rm -rf $(HOOKS)
.PHONY: build
build:
@$(CARGO_BIN) build
.PHONY: build_all
build_all:
@$(CARGO_BIN) build --all-features
.PHONY: test
test_all:
@$(CARGO_BIN) test --all-features
test:
RUST_LOG=info BITCOINS_REPO=$(shell pwd) $(CARGO_BIN) test --all-targets -- --skip coinnect_tests --skip coinbase_tests --nocapture
.PHONY: coverage
coverage:
@$(CARGO_BIN) tarpaulin -v
.PHONY: test_watcher
test_watcher:
@$(FUNZZY_BIN)
.PHONY: bench
bench:
@$(CARGO_BIN) bench
.PHONY: profile
profile:
@$(CARGO_BIN) flamegraph --dev --bin=trader --features flame_it
.PHONY: lint
lint:
@$(CARGO_BIN) clippy --all-targets --all-features -Z unstable-options -- -Dclippy::all -Dunused_imports
.PHONY: lintfix
lintfix:
@$(CARGO_BIN) clippy --fix --all-targets --all-features -Z unstable-options -- -Dclippy::all -Dunused_imports
.PHONY: clean-lint
clean-lint:
find . -type f -name *.rs.bk -delete
release:
$(rust-musl-builder-nightly) cargo build --release --target=x86_64-unknown-linux-gnu
build_test:
@$(CARGO_BIN) test --message-format=json-diagnostic-rendered-ansi --color=always --no-run --lib $(TEST_NAME) --manifest-path $(MANIFEST_PATH)