-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
38 lines (29 loc) · 805 Bytes
/
Makefile
File metadata and controls
38 lines (29 loc) · 805 Bytes
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
.DEFAULT_GOAL := help
GO ?= go
CMD_DIR := ./cmd/server
BIN_DIR := ./bin
BIN_NAME := server
BIN := $(BIN_DIR)/$(BIN_NAME)
.PHONY: help
help: ## Show available targets
@awk 'BEGIN {FS=":.*## "; printf "Usage:\n make <target>\n\nTargets:\n"} /^[a-zA-Z0-9_.-]+:.*## / {printf " %-14s %s\n", $$1, $$2}' $(MAKEFILE_LIST)
.PHONY: run
run: ## Run the server (go run)
@$(GO) run $(CMD_DIR)
.PHONY: build
build: ## Build the server binary into ./bin/
@mkdir -p "$(BIN_DIR)"
@$(GO) build -trimpath -o "$(BIN)" $(CMD_DIR)
.PHONY: test
test: ## Run all tests
@$(GO) test ./...
.PHONY: fmt
fmt: ## Format code (gofmt + gofmt on module packages)
@$(GO) fmt ./...
@gofmt -w .
.PHONY: tidy
tidy: ## Sync go.mod/go.sum
@$(GO) mod tidy
.PHONY: clean
clean: ## Remove build artifacts
@rm -rf "$(BIN_DIR)"