-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
118 lines (98 loc) · 2.56 KB
/
Makefile
File metadata and controls
118 lines (98 loc) · 2.56 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# Makefile for rlcheck
# Variables
CARGO := cargo
BINARY_NAME := rlcheck
CONFIG_FILE := config.yaml
LOG_FILE := monitor.log
PROD_CONFIG_FILE := config.prod.yaml
PROD_LOG_FILE := prod.log
# Default target
.PHONY: all
all: build
# Build the project in release mode
.PHONY: build
build:
$(CARGO) build --release
# Build the project in debug mode
.PHONY: build-debug
build-debug:
$(CARGO) build
# Run tests
.PHONY: test
test:
$(CARGO) test
# Run tests with output
.PHONY: test-verbose
test-verbose:
$(CARGO) test -- --nocapture
# Run the utility (debug mode)
.PHONY: run
run:
$(CARGO) run
# Run the utility (release mode)
.PHONY: run-release
run-release:
$(CARGO) run --release
# Run with a specific config file
.PHONY: run-config
run-config:
$(CARGO) run -- --config $(CONFIG_FILE)
# Run with logging enabled
.PHONY: run-log
run-log:
$(CARGO) run -- --log-file $(LOG_FILE)
# Check the code without building
.PHONY: check
check:
$(CARGO) check
# Format the code
.PHONY: fmt
fmt:
$(CARGO) fmt
# Check formatting
.PHONY: fmt-check
fmt-check:
$(CARGO) fmt -- --check
# Run clippy for linting
.PHONY: clippy
clippy:
$(CARGO) clippy -- -D warnings
# Clean build artifacts
.PHONY: clean
clean:
$(CARGO) clean
# Install the binary
.PHONY: install
install:
$(CARGO) install --path .
# Run in prod
prod:
nohup $(BINARY_NAME) --config $(PROD_CONFIG_FILE) --log-file $(PROD_LOG_FILE) > /dev/null 2>&1 &
# Full CI pipeline: format, clippy, test, build
.PHONY: ci
ci: fmt-check clippy test build
# Watch and rerun on file changes (requires cargo-watch)
.PHONY: watch
watch:
$(CARGO) watch -x run
# Help target
.PHONY: help
help:
@echo "Available targets:"
@echo " make build - Build the project in release mode"
@echo " make build-debug - Build the project in debug mode"
@echo " make test - Run tests"
@echo " make test-verbose - Run tests with output"
@echo " make run - Run the utility (debug mode)"
@echo " make run-release - Run the utility (release mode)"
@echo " make run-config - Run with config file"
@echo " make run-log - Run with logging enabled"
@echo " make check - Check code without building"
@echo " make fmt - Format the code"
@echo " make fmt-check - Check code formatting"
@echo " make clippy - Run clippy linter"
@echo " make clean - Clean build artifacts"
@echo " make install - Install the binary"
@echo " make ci - Run full CI pipeline"
@echo " make watch - Watch and rerun on changes"
@echo " make help - Show this help message"