47 lines
1.0 KiB
Makefile
47 lines
1.0 KiB
Makefile
.PHONY: help build run dev clean deps fmt lint test docker-build
|
|
|
|
CARGO ?= cargo
|
|
BIN ?= rustapi
|
|
|
|
help:
|
|
@echo "Available targets:"
|
|
@echo " make build - Build the application (release)"
|
|
@echo " make run - Build and run the application"
|
|
@echo " make dev - Run in dev mode (RUST_LOG=debug)"
|
|
@echo " make test - Run tests"
|
|
@echo " make fmt - Format code"
|
|
@echo " make lint - Clippy with warnings as errors"
|
|
@echo " make clean - Remove build artifacts"
|
|
@echo " make deps - Pre-fetch dependencies"
|
|
@echo " make docker-build - Build local container image"
|
|
|
|
build:
|
|
@echo "Building application..."
|
|
@$(CARGO) build --release --bin $(BIN)
|
|
|
|
run: build
|
|
@echo "Starting server..."
|
|
@./target/release/$(BIN)
|
|
|
|
dev:
|
|
@echo "Running in development mode..."
|
|
@RUST_LOG=debug $(CARGO) run --bin $(BIN)
|
|
|
|
test:
|
|
@$(CARGO) test
|
|
|
|
fmt:
|
|
@$(CARGO) fmt
|
|
|
|
lint:
|
|
@$(CARGO) clippy -- -D warnings
|
|
|
|
clean:
|
|
@$(CARGO) clean
|
|
|
|
deps:
|
|
@$(CARGO) fetch
|
|
|
|
docker-build:
|
|
@docker build -t $(BIN):local .
|