This commit is contained in:
parent
4b083a8839
commit
28684b66a4
1 changed files with 31 additions and 5 deletions
36
Makefile
36
Makefile
|
|
@ -1,11 +1,37 @@
|
|||
all: linux-amd64
|
||||
CGO_ENABLED = 1
|
||||
DIR = ./build
|
||||
|
||||
.ONESHELL:
|
||||
linux-amd64: fmt
|
||||
GOARCH=amd64 GOOS=linux go build -ldflags '-s -w' -v -o build/wireguard-gui-amd64 .
|
||||
GO_ARCH_AMD = amd64
|
||||
GO_OS_LINUX = linux
|
||||
|
||||
EXECUTABLE = wireguard-gui
|
||||
|
||||
BIN_LINUX_AMD64 = $(DIR)/$(EXECUTABLE)-linux-$(GO_ARCH_AMD)
|
||||
BIN_LINUX_ARM64 = $(DIR)/$(EXECUTABLE)-linux-$(GO_ARCH_ARM)
|
||||
|
||||
CC = go build
|
||||
LDFLAGS = all=-w -s
|
||||
|
||||
.PHONY: all
|
||||
all: linux
|
||||
|
||||
.PHONY: linux
|
||||
linux: $(BIN_LINUX_AMD64)
|
||||
chmod +x $(BIN_LINUX_AMD64)
|
||||
|
||||
.PHONY: $(BIN_LINUX_AMD64)
|
||||
$(BIN_LINUX_AMD64):
|
||||
GOARCH=$(GO_ARCH_AMD) \
|
||||
GOOS=$(GO_OS_LINUX) \
|
||||
$(CC) -ldflags="$(LDFLAGS)" \
|
||||
-o $(BIN_LINUX_AMD64) .
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -rf $(DIR)/*
|
||||
|
||||
tool-gofumpt:
|
||||
which golangci-lint > /dev/null 2>&1 || go install mvdan.cc/gofumpt@latest
|
||||
|
||||
fmt: tool-gofumpt
|
||||
gofumpt -w --extra ./
|
||||
gofumpt -w --extra .
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue