-
Notifications
You must be signed in to change notification settings - Fork 3
/
makefile
46 lines (35 loc) · 1.35 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
# Get version from git hash
git_hash := $(shell git rev-parse --short HEAD || echo 'development')
# project version
# version = $(shell git describe --tags --abbrev=0 || echo 'development')
version = $(shell git tag | sort -V | tail -1 || echo 'development')
# Get current date
current_time = $(shell date +"%Y-%m-%d:T%H:%M:%S")
name:="ngonxctl"
# Add linker flags
linker_flags = '-s -X github.com/kenriortega/ngonx/cmd/cli.buildTime=${current_time} -X github.com/kenriortega/ngonx/cmd/cli.versionHash=${git_hash} -X github.com/kenriortega/ngonx/cmd/cli.version=${version}'
# Build binaries for current OS and Linux
.PHONY:
compile:
@echo "Building binaries..."
GOOS=linux GOARCH=amd64 go build -ldflags=${linker_flags} -o ./build/${name}-${version}-linux-amd64 cmd/main.go
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags=${linker_flags} -o ./build/${name}-${version}-windows-amd64.exe cmd/main.go
# Only for proxy and http server
gocert:
go run ./tools/generate_cert.go
# for grpc server
gossl:
cd scripts && ./generate.sh
#Only use if you have installed UPX compress
compress:
./upx -9 -q ./build/${name}-${version}-linux-amd64
grpcsvr:
go run examples/calculator/calc_server/server.go
grpccli:
go run examples/calculator/calc_client/client.go
releaser:
goreleaser release --snapshot --rm-dist
run-ui:
cd web && yarn dev
build-ui:
cd web && yarn build