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
|
|
|
|
|
2020-01-03 05:32:26 +01:00
|
|
|
$(shell mkdir -p .build ../dist)
|
2020-01-02 10:43:19 +01:00
|
|
|
|
2020-01-03 05:32:26 +01:00
|
|
|
OUTDIR := ../dist
|
2020-01-02 10:43:19 +01:00
|
|
|
BUILDFLAGS := --release --strip
|
2020-02-24 12:22:02 +01:00
|
|
|
RSPY_TARGET_DIR ?= target
|
2020-01-02 10:43:19 +01:00
|
|
|
|
2020-02-24 10:02:12 +01:00
|
|
|
QT_FTLS := ../qt/ftl
|
2020-02-23 09:00:13 +01:00
|
|
|
|
2020-01-02 10:43:19 +01:00
|
|
|
.PHONY: all develop build check fix clean
|
|
|
|
|
|
|
|
all: develop
|
|
|
|
|
2020-02-23 09:00:13 +01:00
|
|
|
develop: .build/develop
|
|
|
|
|
2020-02-24 10:02:12 +01:00
|
|
|
DEPS := .build/tools .build/vernum ../meta/buildhash $(wildcard $(QT_FTLS)/*.ftl) \
|
2020-02-25 06:32:17 +01:00
|
|
|
$(shell ${FIND} ../rslib/src -name '*.rs') $(wildcard ../proto/*) \
|
|
|
|
$(shell ${FIND} ../rslib/ftl -type f)
|
2020-02-24 10:02:12 +01:00
|
|
|
|
|
|
|
.build/develop: $(DEPS)
|
2020-02-23 09:00:13 +01:00
|
|
|
touch ../proto/backend.proto
|
2020-02-24 12:22:02 +01:00
|
|
|
FTL_TEMPLATE_DIRS="$(QT_FTLS)" CARGO_TARGET_DIR="$(RSPY_TARGET_DIR)" maturin develop
|
2020-02-23 09:00:13 +01:00
|
|
|
touch $@
|
2020-01-02 10:43:19 +01:00
|
|
|
|
2020-02-24 10:02:12 +01:00
|
|
|
build: $(DEPS)
|
2020-01-02 10:43:19 +01:00
|
|
|
rm -rf $(OUTDIR)/ankirspy*
|
2020-02-23 09:00:13 +01:00
|
|
|
touch ../proto/backend.proto
|
2020-02-24 10:02:12 +01:00
|
|
|
FTL_TEMPLATE_DIRS="$(QT_FTLS)" maturin build -i $(shell which python3) -o $(OUTDIR) $(BUILDFLAGS)
|
2020-01-02 10:43:19 +01:00
|
|
|
|
|
|
|
check: .build/check
|
|
|
|
|
|
|
|
fix:
|
|
|
|
cargo fmt
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -rf .build target
|
|
|
|
|
|
|
|
# nightly currently required for ignoring files in rustfmt.toml
|
|
|
|
RUST_TOOLCHAIN := $(shell cat rust-toolchain)
|
|
|
|
|
|
|
|
.build/tools: requirements.txt rust-toolchain
|
2020-02-24 18:58:07 +01:00
|
|
|
python -m pip install -r requirements.txt
|
2020-01-02 10:43:19 +01:00
|
|
|
rustup toolchain install $(RUST_TOOLCHAIN)
|
|
|
|
rustup component add rustfmt-preview --toolchain $(RUST_TOOLCHAIN)
|
|
|
|
rustup component add clippy-preview --toolchain $(RUST_TOOLCHAIN)
|
|
|
|
@touch $@
|
|
|
|
|
|
|
|
.build/check: build
|
|
|
|
cargo fmt -- --check
|
|
|
|
cargo clippy -- -D warnings
|
|
|
|
@touch $@
|
2020-01-03 05:36:14 +01:00
|
|
|
|
|
|
|
VER := $(shell cat ../meta/version)
|
|
|
|
.build/vernum: ../meta/version
|
2020-01-03 07:02:06 +01:00
|
|
|
sed -i.bak 's/.*automatically updated.*/version = "$(VER)" # automatically updated/' Cargo.toml
|
|
|
|
rm Cargo.toml.bak
|
2020-01-03 05:36:14 +01:00
|
|
|
@touch $@
|