2020-02-24 18:58:07 +01:00
|
|
|
SHELL := /bin/bash
|
2020-02-25 06:32:17 +01:00
|
|
|
FIND := $(if $(wildcard /bin/find),/bin/find,/usr/bin/find)
|
2020-02-24 18:58:07 +01:00
|
|
|
|
2020-01-02 10:43:19 +01:00
|
|
|
.SHELLFLAGS := -eu -o pipefail -c
|
|
|
|
.DELETE_ON_ERROR:
|
|
|
|
MAKEFLAGS += --warn-undefined-variables
|
|
|
|
MAKEFLAGS += --no-builtin-rules
|
|
|
|
|
|
|
|
$(shell mkdir -p .build)
|
|
|
|
|
2020-02-06 01:16:50 +01:00
|
|
|
.PHONY: all check fix clean develop
|
2020-01-02 10:43:19 +01:00
|
|
|
|
|
|
|
all: check
|
|
|
|
|
2020-02-23 10:31:17 +01:00
|
|
|
check: ftl/repo .build/check
|
2020-01-02 10:43:19 +01:00
|
|
|
|
|
|
|
fix:
|
|
|
|
cargo fmt
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -rf .build target
|
|
|
|
|
2020-02-23 03:21:12 +01:00
|
|
|
develop: .build/vernum ftl/repo
|
2020-02-06 01:16:50 +01:00
|
|
|
|
2020-02-23 03:21:12 +01:00
|
|
|
ftl/repo:
|
|
|
|
(cd ftl && ./scripts/fetch-latest-translations)
|
|
|
|
|
2020-02-25 06:32:17 +01:00
|
|
|
ALL_SOURCE := $(shell ${FIND} src -type f) $(wildcard ftl/*.ftl)
|
2020-01-02 10:43:19 +01:00
|
|
|
|
|
|
|
# nightly currently required for ignoring files in rustfmt.toml
|
|
|
|
RUST_TOOLCHAIN := $(shell cat rust-toolchain)
|
|
|
|
|
|
|
|
.build/rs-tools: rust-toolchain
|
|
|
|
rustup toolchain install $(RUST_TOOLCHAIN)
|
|
|
|
rustup component add rustfmt-preview --toolchain $(RUST_TOOLCHAIN)
|
|
|
|
rustup component add clippy-preview --toolchain $(RUST_TOOLCHAIN)
|
|
|
|
@touch $@
|
|
|
|
|
2020-01-07 00:23:55 +01:00
|
|
|
.build/check: .build/rs-tools $(ALL_SOURCE)
|
2020-02-09 01:35:04 +01:00
|
|
|
cargo test --lib -- --nocapture
|
2020-01-02 10:43:19 +01:00
|
|
|
cargo fmt -- --check
|
|
|
|
cargo clippy -- -D warnings
|
|
|
|
@touch $@
|
2020-02-06 01:16:50 +01:00
|
|
|
|
|
|
|
VER := $(shell cat ../meta/version)
|
|
|
|
.build/vernum: ../meta/version
|
|
|
|
sed -i.bak 's/.*automatically updated.*/version = "$(VER)" # automatically updated/' Cargo.toml
|
|
|
|
rm Cargo.toml.bak
|
|
|
|
@touch $@
|