forked from tranHieuDev23/Cato
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
89 lines (72 loc) · 2.38 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
81
82
83
84
85
86
87
88
89
VERSION := $(shell cat VERSION)
COMMIT_HASH := $(shell git rev-parse HEAD)
PROJECT_NAME := cato
all: generate build-all
.PHONY: generate
generate:
rm -rf internal/handlers/http/rpc/rpcclient
rm -rf internal/handlers/http/rpc/rpcserver
rm -rf web/src/app/dataaccess/api
go get gitlab.com/pjrpc/pjrpc/cmd/[email protected]
go get github.com/google/wire/cmd/[email protected]
go generate ./...
openapi-generator generate -i api/swagger.json -g typescript-fetch -o web/src/app/dataaccess/api
go mod tidy
.PHONY: build-web
build-web:
cd web && npm run build && cd ..
.PHONY: build-linux-amd64
build-linux-amd64:
GOOS=linux GOARCH=amd64 go build \
-ldflags "-X main.version=$(VERSION) -X main.commitHash=$(COMMIT_HASH)" \
-o build/$(PROJECT_NAME)_linux_amd64 cmd/$(PROJECT_NAME)/*.go
.PHONY: build-linux-arm64
build-linux-arm64:
GOOS=linux GOARCH=arm64 go build \
-ldflags "-X main.version=$(VERSION) -X main.commitHash=$(COMMIT_HASH)" \
-o build/$(PROJECT_NAME)_linux_arm64 cmd/$(PROJECT_NAME)/*.go
.PHONY: build-macos-amd64
build-macos-amd64:
GOOS=darwin GOARCH=amd64 go build \
-ldflags "-X main.version=$(VERSION) -X main.commitHash=$(COMMIT_HASH)" \
-o build/$(PROJECT_NAME)_macos_amd64 cmd/$(PROJECT_NAME)/*.go
.PHONY: build-macos-arm64
build-macos-arm64:
GOOS=darwin GOARCH=arm64 go build \
-ldflags "-X main.version=$(VERSION) -X main.commitHash=$(COMMIT_HASH)" \
-o build/$(PROJECT_NAME)_macos_arm64 cmd/$(PROJECT_NAME)/*.go
.PHONY: build-windows-amd64
build-windows-amd64:
GOOS=windows GOARCH=amd64 go build \
-ldflags "-X main.version=$(VERSION) -X main.commitHash=$(COMMIT_HASH)" \
-o build/$(PROJECT_NAME)_windows_amd64.exe cmd/$(PROJECT_NAME)/*.go
.PHONY: build-windows-arm64
build-windows-arm64:
GOOS=windows GOARCH=amd64 go build \
-ldflags "-X main.version=$(VERSION) -X main.commitHash=$(COMMIT_HASH)" \
-o build/$(PROJECT_NAME)_windows_arm64.exe cmd/$(PROJECT_NAME)/*.go
.PHONY: build-all
build-all:
make build-web
make build-linux-amd64
make build-linux-arm64
make build-macos-amd64
make build-macos-arm64
make build-windows-amd64
make build-windows-arm64
.PHONY: build
build:
make build-web
go build \
-ldflags "-X main.version=$(VERSION) -X main.commitHash=$(COMMIT_HASH)" \
-o build/$(PROJECT_NAME) \
cmd/$(PROJECT_NAME)/*.go
.PHONY: clean
clean:
rm -rf build/
.PHONY: run
run:
go run cmd/$(PROJECT_NAME)/*.go
.PHONY: lint
lint:
golangci-lint run ./...