-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
91 lines (69 loc) · 2.51 KB
/
Makefile
File metadata and controls
91 lines (69 loc) · 2.51 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
PACKAGE_NAME := $(shell sed -En 's/name[[:space:]]*=[[:space:]]*"([^"]+)"/\1/p' Cargo.toml | head -1)
PACKAGE_VERSION := $(shell sed -En 's/version[[:space:]]*=[[:space:]]*"([^"]+)"/\1/p' Cargo.toml | head -1)
DOCKERHUB_ORG := epappas
CARGO := cargo
RUSTC := rustc
DEBUG_FLAGS := --features debug
RELEASE_FLAGS := --release
.DEFAULT_GOAL := help
help:
@echo "Available targets:"
@echo " build - Build the project in debug mode"
@echo " build-release - Build the project in release mode"
@echo " run - Run the project in debug mode"
@echo " run-release - Run the project in release mode"
@echo " test - Run all tests"
@echo " run-test TEST=name - Run a specific test"
@echo " debug TEST=name - Debug a specific test"
@echo " bench - Run benchmarks"
@echo " lint - Run the linter (clippy)"
@echo " format - Format the code with rustfmt"
@echo " check - Check the code without building"
@echo " doc - Generate documentation"
@echo " graph - Generate dependency graph"
@echo " clean - Clean up build artifacts"
@echo " update - Update dependencies"
@echo " docker-build - Build Docker image"
@echo " docker-push - Push Docker image to registry"
build:
$(CARGO) build
build-release:
$(CARGO) build $(RELEASE_FLAGS)
run:
$(CARGO) run
run-release:
$(CARGO) run $(RELEASE_FLAGS)
test:
$(CARGO) test --workspace
run-test:
$(CARGO) test --test $(TEST)
debug:
$(CARGO) test --test $(TEST) $(DEBUG_FLAGS)
bench:
$(CARGO) bench
lint:
$(CARGO) clippy -- -D warnings
format:
$(CARGO) fmt
check:
$(CARGO) check
doc:
$(CARGO) doc --no-deps
graph:
rm -f cargo-graph.dot
rm -f cargo-graph.png
$(CARGO) graph --optional-line-style dashed --optional-line-color red --optional-shape box --build-shape diamond --build-color green --build-line-color orange > cargo-graph.dot
dot -Tpng > cargo-graph.png cargo-graph.dot
clean:
$(CARGO) clean
find . -type f -name "*.orig" -exec rm {} \;
find . -type f -name "*.bk" -exec rm {} \;
find . -type f -name ".*~" -exec rm {} \;
update:
$(CARGO) update
docker-build:
docker build -t $(PACKAGE_NAME):$(PACKAGE_VERSION) -f ./Dockerfile .
docker-push:
docker tag $(PACKAGE_NAME):$(PACKAGE_VERSION) $(DOCKERHUB_ORG)/$(PACKAGE_NAME):$(PACKAGE_VERSION)
docker push $(DOCKERHUB_ORG)/$(PACKAGE_NAME):$(PACKAGE_VERSION)
.PHONY: run-test debug run-tests bench lint graph clean docker-build docker-push