2024-02-19 20:04:29 +07:00
|
|
|
export PATH := $(PATH):`go env GOPATH`/bin
|
2020-03-11 12:20:26 +07:00
|
|
|
export GO111MODULE=on
|
2020-09-23 13:54:40 +07:00
|
|
|
LDFLAGS := -s -w
|
2016-01-27 20:24:36 +07:00
|
|
|
|
2024-02-19 16:46:47 +07:00
|
|
|
all: env fmt build
|
2016-01-27 20:24:36 +07:00
|
|
|
|
2017-03-09 23:52:32 +07:00
|
|
|
build: frps frpc
|
2016-01-27 20:24:36 +07:00
|
|
|
|
2024-02-19 16:46:47 +07:00
|
|
|
env:
|
|
|
|
@go version
|
|
|
|
|
2016-08-11 23:39:39 +07:00
|
|
|
# compile assets into binary file
|
2017-03-27 01:21:37 +07:00
|
|
|
file:
|
2019-02-01 18:26:10 +07:00
|
|
|
rm -rf ./assets/frps/static/*
|
|
|
|
rm -rf ./assets/frpc/static/*
|
|
|
|
cp -rf ./web/frps/dist/* ./assets/frps/static
|
|
|
|
cp -rf ./web/frpc/dist/* ./assets/frpc/static
|
2016-08-11 20:47:26 +07:00
|
|
|
|
2016-02-03 17:46:24 +07:00
|
|
|
fmt:
|
2018-03-21 10:52:11 +07:00
|
|
|
go fmt ./...
|
2019-10-12 19:13:12 +07:00
|
|
|
|
2023-02-09 00:11:00 +07:00
|
|
|
fmt-more:
|
|
|
|
gofumpt -l -w .
|
|
|
|
|
2023-05-28 15:50:43 +07:00
|
|
|
gci:
|
|
|
|
gci write -s standard -s default -s "prefix(github.com/fatedier/frp/)" ./
|
|
|
|
|
2022-03-28 11:12:35 +07:00
|
|
|
vet:
|
|
|
|
go vet ./...
|
|
|
|
|
2016-01-27 20:24:36 +07:00
|
|
|
frps:
|
2023-11-21 10:19:35 +07:00
|
|
|
env CGO_ENABLED=0 go build -trimpath -ldflags "$(LDFLAGS)" -tags frps -o bin/frps ./cmd/frps
|
2016-01-27 20:24:36 +07:00
|
|
|
|
|
|
|
frpc:
|
2023-11-21 10:19:35 +07:00
|
|
|
env CGO_ENABLED=0 go build -trimpath -ldflags "$(LDFLAGS)" -tags frpc -o bin/frpc ./cmd/frpc
|
2016-02-03 17:14:16 +07:00
|
|
|
|
2016-05-17 18:13:37 +07:00
|
|
|
test: gotest
|
|
|
|
|
|
|
|
gotest:
|
2018-07-11 22:27:47 +07:00
|
|
|
go test -v --cover ./assets/...
|
|
|
|
go test -v --cover ./cmd/...
|
2020-09-23 12:49:14 +07:00
|
|
|
go test -v --cover ./client/...
|
2018-07-11 22:27:47 +07:00
|
|
|
go test -v --cover ./server/...
|
2020-09-23 12:49:14 +07:00
|
|
|
go test -v --cover ./pkg/...
|
2017-03-09 23:52:32 +07:00
|
|
|
|
2020-06-02 21:48:55 +07:00
|
|
|
e2e:
|
|
|
|
./hack/run-e2e.sh
|
|
|
|
|
2021-06-18 15:48:36 +07:00
|
|
|
e2e-trace:
|
|
|
|
DEBUG=true LOG_LEVEL=trace ./hack/run-e2e.sh
|
|
|
|
|
2023-06-02 15:06:29 +07:00
|
|
|
e2e-compatibility-last-frpc:
|
|
|
|
if [ ! -d "./lastversion" ]; then \
|
|
|
|
TARGET_DIRNAME=lastversion ./hack/download.sh; \
|
|
|
|
fi
|
|
|
|
FRPC_PATH="`pwd`/lastversion/frpc" ./hack/run-e2e.sh
|
|
|
|
rm -r ./lastversion
|
|
|
|
|
|
|
|
e2e-compatibility-last-frps:
|
|
|
|
if [ ! -d "./lastversion" ]; then \
|
|
|
|
TARGET_DIRNAME=lastversion ./hack/download.sh; \
|
|
|
|
fi
|
|
|
|
FRPS_PATH="`pwd`/lastversion/frps" ./hack/run-e2e.sh
|
|
|
|
rm -r ./lastversion
|
|
|
|
|
2022-03-28 11:12:35 +07:00
|
|
|
alltest: vet gotest e2e
|
2018-01-18 13:53:44 +07:00
|
|
|
|
2016-05-17 18:13:37 +07:00
|
|
|
clean:
|
|
|
|
rm -f ./bin/frpc
|
|
|
|
rm -f ./bin/frps
|
2023-06-02 15:06:29 +07:00
|
|
|
rm -rf ./lastversion
|