-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
56 lines (47 loc) · 1.5 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
APP=skeleton
.PHONY: build
build:
@go build -o releases/${APP} ./cmd/app
@go build -o releases/${APP}-cli ./cmd/cli
.PHONY: windows
windows:
@GOARCH=amd64 GOOS=windows go build -ldflags="-s" -o releases/${APP}-win ./cmd/app
@GOARCH=amd64 GOOS=windows go build -ldflags="-s" -o releases/${APP}-win-cli ./cmd/cli
.PHONY: linux
linux:
@GOARCH=amd64 GOOS=linux go build -ldflags="-s" -o releases/${APP}-linux ./cmd/app
@GOARCH=amd64 GOOS=linux go build -ldflags="-s" -o releases/${APP}-linux-cli ./cmd/cli
.PHONY: darwin
darwin:
@GOARCH=amd64 GOOS=darwin go build -ldflags="-s" -o releases/${APP}-darwin ./cmd/app
@GOARCH=amd64 GOOS=darwin go build -ldflags="-s" -o releases/${APP}-darwin-cli ./cmd/cli
.PHONY: lint
lint:
@if ! command -v gofumpt &> /dev/null; then \
echo "gofumpt not found, installing..."; \
go install mvdan.cc/gofumpt@latest; \
fi
@gofumpt -l -w .
.PHONY: generate
generate:
@go generate -x
.PHONY: clean
clean:
@go clean -i .
@rm -rf releases
.PHONY: swagger
swagger:
@if ! command -v swag &> /dev/null; then \
echo "swag not found, installing..."; \
go install github.com/swaggo/swag/cmd/swag@latest; \
fi
@swag init -d cmd/app -o docs
.PHONY: help
help:
@echo "1. make build - [go build]"
@echo "2. make windows - [make window package]"
@echo "3. make linux - [make linux package]"
@echo "4. make darwin - [make darwin package]"
@echo "5. make lint - [gofumpt -l -w .]"
@echo "6. make generate - [go generate -x]"
@echo "7. make clean - [remove releases files and cached files]"