sing-box/Makefile

49 lines
1.0 KiB
Makefile
Raw Normal View History

2022-08-13 18:36:49 +08:00
NAME = sing-box
COMMIT = $(shell git rev-parse --short HEAD)
TAGS ?= with_quic,with_clash_api
PARAMS = -v -trimpath -tags '$(TAGS)' -ldflags \
2022-08-12 22:53:46 +08:00
'-X "github.com/sagernet/sing-box/constant.Commit=$(COMMIT)" \
-w -s -buildid='
2022-08-13 18:36:49 +08:00
MAIN = ./cmd/sing-box
2022-08-12 22:53:46 +08:00
.PHONY: test release
build:
go build $(PARAMS) $(MAIN)
install:
go install $(PARAMS) $(MAIN)
fmt:
2022-08-13 18:36:49 +08:00
@gofumpt -l -w .
@gofmt -s -w .
@gci write -s "standard,prefix(github.com/sagernet/),default" .
2022-08-12 22:53:46 +08:00
fmt_install:
go install -v mvdan.cc/gofumpt@latest
go install -v github.com/daixiang0/gci@v0.4.0
2022-08-12 22:53:46 +08:00
lint:
GOOS=linux golangci-lint run ./...
2022-08-17 20:15:35 +08:00
GOOS=android golangci-lint run ./...
2022-08-12 22:53:46 +08:00
GOOS=windows golangci-lint run ./...
GOOS=darwin golangci-lint run ./...
GOOS=freebsd golangci-lint run ./...
lint_install:
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
2022-08-12 22:53:46 +08:00
test:
2022-08-13 18:36:49 +08:00
@go test -v . && \
2022-08-17 20:10:59 +08:00
pushd test && \
go test -v . && \
popd
2022-08-12 22:53:46 +08:00
clean:
rm -rf bin dist
rm -f $(shell go env GOPATH)/sing-box
update:
git fetch
git reset FETCH_HEAD --hard
git clean -fdx