-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
56 lines (44 loc) · 1.21 KB
/
Copy pathMakefile
File metadata and controls
56 lines (44 loc) · 1.21 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
APP_NAME := termfolio
BIN_DIR := bin
BIN := $(BIN_DIR)/$(APP_NAME)
HOST_KEY ?= .ssh/host_ed25519
CONFIG ?= config.yaml
GO ?= go
GORELEASER ?= goreleaser
.PHONY: help build run test fmt vet tidy keys release-check clean
help:
@echo "usage: make <target>"
@echo ""
@echo "targets:"
@echo " help show available make targets"
@echo " build build local binary at $(BIN)"
@echo " run run server using CONFIG=$(CONFIG)"
@echo " test run go test for all packages"
@echo " fmt format go source files"
@echo " vet run go vet checks"
@echo " tidy sync go modules"
@echo " keys generate ssh host key at HOST_KEY=$(HOST_KEY)"
@echo " release-check validate goreleaser config"
@echo " clean remove build artifacts"
build: | $(BIN_DIR)
$(GO) build -o $(BIN) .
run:
$(GO) run . -c $(CONFIG)
test:
$(GO) test ./...
fmt:
$(GO) fmt ./...
vet:
$(GO) vet ./...
tidy:
$(GO) mod tidy
keys:
mkdir -p "$(dir $(HOST_KEY))"
ssh-keygen -t ed25519 -f "$(HOST_KEY)" -N "" -q
@echo "generated host key at $(HOST_KEY)"
release-check:
$(GORELEASER) check --config .goreleaser.yaml
clean:
rm -rf $(BIN_DIR)
$(BIN_DIR):
mkdir -p $(BIN_DIR)