wg-quicker/Makefile

64 lines
1.3 KiB
Makefile
Raw Normal View History

export GO111MODULE := on
GO ?= go
GOFLAGS ?= -ldflags '-s -w -extldflags "-static"'
GOARM ?= 5
GOARCH ?= amd64
ifeq ($(GOARCH),arm)
GOARMLINE := GOARM=$(GOARM)
else
GOARMLINE :=
endif
2022-02-07 15:24:04 +01:00
GORELEASER := $(GO) run github.com/goreleaser/goreleaser@v1.3.1
GOLANGCI_LINT := $(GO) run github.com/golangci/golangci-lint/cmd/golangci-lint@v1.44.0
2022-01-07 20:20:48 +01:00
all: clean wg-quicker
.PHONY: clean
clean:
rm wg-quicker || true
rm third_party/wireguard-go/wireguard-go || true
rm assets/wireguard-go/wireguard-go || true
.PHONY: wireguard-go
wireguard-go: clean
cd third_party/wireguard-go; \
GOOS=linux GOARCH=$(GOARCH) $(GOARMLINE) $(GO) build -v -o wireguard-go $(GOFLAGS) .
cp third_party/wireguard-go/wireguard-go assets/wireguard-go
.PHONY: generate
generate:
2022-01-07 20:20:48 +01:00
$(GO) generate ./...
wg-quicker: wireguard-go
$(GO) build -v $(GOFLAGS) -o "$@" cmd/wg-quicker/main.go
.PHONY: build
build:
2022-01-07 20:20:48 +01:00
$(GORELEASER) build --rm-dist --snapshot --parallelism=1
.PHONY: release
release:
2022-02-07 15:24:04 +01:00
$(GORELEASER) release --rm-dist --parallelism=1
.PHONY: test
test:
2022-01-07 20:20:48 +01:00
GOFLAGS=-mod=vendor $(GO) test -race -cover -v ./...
.PHONY: lint
lint:
2022-01-07 20:20:48 +01:00
$(GOLANGCI_LINT) run \
--enable-all \
--disable gomnd \
--disable godox \
--disable exhaustivestruct \
--disable varnamelen \
--timeout 5m
.PHONY: tidy
tidy:
$(GO) mod tidy
$(GO) mod vendor