-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
54 lines (42 loc) · 1.52 KB
/
Copy pathMakefile
File metadata and controls
54 lines (42 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
.PHONY: help install build test lint fmt check docker-test docker-lint docker-build clean
CARGO ?= cargo
PACKAGE ?= ling
BIN ?= ling
INSTALL_ROOT ?= $(HOME)/.cargo
INSTALL_BIN_DIR := $(INSTALL_ROOT)/bin
help:
@echo "Targets:"
@echo " make install Install ling to $(INSTALL_BIN_DIR)"
@echo " make build Build release binary"
@echo " make test Run workspace unit tests locally"
@echo " make lint Run fmt check and clippy locally"
@echo " make fmt Format Rust code locally"
@echo " make check Run cargo check locally"
@echo " make docker-test Run tests in Docker Compose"
@echo " make docker-lint Run fmt check and clippy in Docker Compose"
@echo " make docker-build Build release binary in Docker Compose"
@echo " make clean Remove local target directory"
install:
$(CARGO) install --path crates/$(PACKAGE) --locked --force --root "$(INSTALL_ROOT)"
@echo "$(BIN) installed to $(INSTALL_BIN_DIR)/$(BIN)"
@case ":$$PATH:" in *":$(INSTALL_BIN_DIR):"*) ;; *) echo "Warning: $(INSTALL_BIN_DIR) is not in PATH";; esac
@echo "Try: $(BIN) --help"
build:
$(CARGO) build --release -p $(PACKAGE)
test:
$(CARGO) test --workspace --lib --bins --locked
lint:
$(CARGO) fmt --check
$(CARGO) clippy --workspace --all-targets -- -D warnings
fmt:
$(CARGO) fmt
check:
$(CARGO) check --workspace
docker-test:
docker compose run --rm test
docker-lint:
docker compose run --rm lint
docker-build:
docker compose run --rm dev cargo build --release -p $(PACKAGE)
clean:
$(CARGO) clean