TARGET=target/debug/
TARGET_HTML=html
VERSION=1.0.1
.PHONY: help license copyright test
help:
$(info Rust Makefile)
$(info =============)
$(info )
$(info Consider to use 'cargo' instead.)
$(info )
$(info Available commands:)
$(info )
@grep '^[[:alnum:]_-]*:.* | sort | awk 'BEGIN {FS=":.* ## "}; {printf "%-25s %s\n", $$1, $$2};'
compile: check-setup
@cargo build
run:
@RUST_BACKTRACE=full RUST_LOG=info cargo run
clean:
@rm -rf "$(TARGET_HTML)"
@cargo clean
check-setup:
@type rustup >/dev/null 2>&1 || (echo "Run 'curl --proto "=https" --tlsv1.2 -sSf https://sh.rustup.rs | sh' first." >&2 ; exit 1)
@type rustc >/dev/null 2>&1 || (echo "Run 'curl --proto "=https" --tlsv1.2 -sSf https://sh.rustup.rs | sh' first." >&2 ; exit 1)
coverage:
@type grcov >/dev/null 2>&1 || (echo "Run 'cargo install grcov' first." >&2 ; exit 1)
@CARGO_INCREMENTAL=0 RUSTFLAGS="-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort" cargo build
@CARGO_INCREMENTAL=0 RUSTFLAGS="-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort" cargo test
@grcov $(TARGET) -t $(TARGET_HTML) --ignore "/*"
@echo "Result saved to the '$(TARGET_HTML)' folder"
test:
@cargo test
license:
@type cargo-license >/dev/null 2>&1 || (echo "Run 'cargo install cargo-license' first." >&2 ; exit 1)
@cargo-license
lint:
@cargo fix
@cargo clippy --fix -Z unstable-options
@cargo clippy --all-targets --all-features -- -D warnings
test-fuzzy:
$(info Todo: setup cargo-fuzz)
@true
style:
@cargo fmt
doc:
@cargo doc --no-deps --open
copyright:
@find . -iname "*.rs" -exec bash -c "if ! grep -q Copyright "{}"; then cat COPYRIGHT {} > {}.new && mv {}.new {} ; fi" \;
feedback:
@open https://github.com/alexanderwillner/md2src/issues
install:
@cargo install --path .
release:
@cargo build --release
@cargo publish
@cd target/release && tar -czf md2src-$(VERSION)-mac.tar.gz md2src
@shasum -a 256 md2src-$(VERSION)-mac.tar.gz
@open .
@open ../homebrew-tap
@hub release create -a target/release/md2src-$(VERSION)-mac.tar.gz -m '$(VERSION)' v$(VERSION)
@open https://github.com/AlexanderWillner/md2src/releases/