-
-
Notifications
You must be signed in to change notification settings - Fork 277
/
Makefile
61 lines (42 loc) · 1.84 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
export GO111MODULE=on
VERSION=$(shell date +"%Y.%m.%d")
BUILD=$(shell git rev-parse HEAD)
BASEDIR=./dist
LDFLAGS=-ldflags "-s -w -X main.build=${BUILD} -buildid=${BUILD}"
GCFLAGS=-gcflags=all=-trimpath=$(shell echo ${HOME})
ASMFLAGS=-asmflags=all=-trimpath=$(shell echo ${HOME})
GOFILES=`go list -buildvcs=false ./...`
GOFILESNOTEST=`go list -buildvcs=false ./... | grep -v test`
# Make Directory to store executables
$(shell mkdir -p ${BASEDIR})
# goreleaser build --config .goreleaser.yml --rm-dist --skip-validate
all: linux windows
@chmod +x dist/*
linux: lint
@env CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -trimpath ${LDFLAGS} ${GCFLAGS} ${ASMFLAGS} -o ${BASEDIR}/ligolo-ng-proxy-linux_amd64 cmd/proxy/main.go
@env CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -trimpath ${LDFLAGS} ${GCFLAGS} ${ASMFLAGS} -o ${BASEDIR}/ligolo-ng-agent-linux_amd64 cmd/agent/main.go
windows: lint
@env CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -trimpath ${LDFLAGS} ${GCFLAGS} ${ASMFLAGS} -o ${BASEDIR}/ligolo-ng-proxy-windows_amd64.exe cmd/proxy/main.go
@env CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -trimpath ${LDFLAGS} ${GCFLAGS} ${ASMFLAGS} -o ${BASEDIR}/ligolo-ng-agent-windows_amd64.exe cmd/agent/main.go
tidy:
@go mod tidy
update: tidy
@go get -v -d ./...
@go get -u all
dep: ## Get the dependencies
@go install github.com/goreleaser/goreleaser
@go install github.com/securego/gosec/v2/cmd/gosec@latest
lint: ## Lint the files
@env CGO_ENABLED=0 go fmt ${GOFILES}
@env CGO_ENABLED=0 go vet ${GOFILESNOTEST}
security:
@gosec -tests ./...
release:
@goreleaser release --config .github/goreleaser.yml
clean:
@rm -rf ${BASEDIR}
terminal_proxy:
go run cmd/proxy/main.go -selfcert
terminal_agent:
go run cmd/agent/main.go -connect localhost:11601 -ignore-cert
.PHONY: all linux windows tidy update dep lint security release clean terminal