-
Notifications
You must be signed in to change notification settings - Fork 17
/
Makefile
80 lines (63 loc) · 2.09 KB
/
Makefile
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
# Output directory for binaries
BIN_DIR := ./bin
# Source directories and target binaries
SRC_SDLCLIENT := cmd/sdlclient/main.go
TARGET_SDLCLIENT := $(BIN_DIR)/midgarts
SRC_GRFEXPLORER := cmd/grfexplorer/main.go
TARGET_GRFEXPLORER := $(BIN_DIR)/grfexplorer
# ==================================================================================== #
# HELPERS
# ==================================================================================== #
## help: print this help message
.PHONY: help
help:
@echo 'Usage:'
@sed -n 's/^##//p' ${MAKEFILE_LIST} | column -t -s ':' | sed -e 's/^/ /'
# ==================================================================================== #
# BUILD
# ==================================================================================== #
## all: builds all binaries
.PHONY: all
all: build build-grfexplorer
## build: builds sdlclient
build:
@mkdir -p $(BIN_DIR)
go build -o $(TARGET_SDLCLIENT) $(SRC_SDLCLIENT)
## build-grfexplorer: builds grfexplorer
build-grfexplorer:
@mkdir -p $(BIN_DIR)
go build -o $(TARGET_GRFEXPLORER) $(SRC_GRFEXPLORER)
# ==================================================================================== #
# DEVELOPMENT
# ==================================================================================== #
## run: run the cmd/web application
.PHONY: run
run:
go run github.com/cosmtrek/[email protected] --c="./air.toml"
## grfexplorer: runs the grf explorer application
.PHONY: grfexplorer
grfexplorer: build-grfexplorer
./bin/grfexplorer
# ==================================================================================== #
# QUALITY CONTROL
# ==================================================================================== #
## tidy: format code and tidy modfile
.PHONY: tidy
tidy:
go fmt ./...
go mod tidy -v
## audit: run quality control checks
.PHONY: audit
audit:
go vet ./...
go run honnef.co/go/tools/cmd/staticcheck@latest -checks=all,-ST1000,-U1000 ./...
go test -race -vet=off ./...
go mod verify
## test: run tests
.PHONY: test
test:
go test -race -vet=off ./...
## clean: clean binaries
.PHONY: clean
clean:
@rm -rf $(BIN_DIR)