add multiple architectures builds
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
e0c8708f0d
commit
3a50ce717d
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1 +1,3 @@
|
|||
/bin/*
|
||||
/build/*
|
||||
!/build/.gitkeep
|
||||
|
|
|
@ -16,6 +16,6 @@ pipeline:
|
|||
from_secret: gitnet_api_key
|
||||
base_url: https://gitnet.fr
|
||||
note:
|
||||
files: bin/mugo
|
||||
files: build/mugo
|
||||
when:
|
||||
event: [tag]
|
||||
|
|
59
Makefile
59
Makefile
|
@ -1,5 +1,60 @@
|
|||
build: fmt
|
||||
CGO_ENABLED=0 go build -ldflags '-s -w' -v -o bin/mugo ./src
|
||||
CGO_ENABLED = 0
|
||||
DIR = ./build
|
||||
GOARCH = amd64
|
||||
GOARM = arm64
|
||||
GOOSWIN = windows
|
||||
GOOSX = darwin
|
||||
GOOSLINUX = linux
|
||||
EXECUTABLE = mugo
|
||||
|
||||
WINBIN = $(DIR)/$(EXECUTABLE)-win-$(GOARCH).exe
|
||||
OSXBIN = $(DIR)/$(EXECUTABLE)-darwin-$(GOARCH)
|
||||
LINUXBIN = $(DIR)/$(EXECUTABLE)-linux-$(GOARCH)
|
||||
ARMBIN = $(DIR)/$(EXECUTABLE)-linux-$(GOARM)
|
||||
|
||||
CC = go build
|
||||
CFLAGS = -trimpath
|
||||
LDFLAGS = all=-w -s
|
||||
GCFLAGS = all=
|
||||
ASMFLAGS = all=
|
||||
|
||||
.PHONY: all
|
||||
all: darwin linux win64 arm
|
||||
|
||||
.PHONY: linux
|
||||
linux: $(LINUXBIN)
|
||||
chmod +x $(LINUXBIN)
|
||||
|
||||
.PHONY: arm
|
||||
arm: $(ARMBIN)
|
||||
chmod +x $(ARMBIN)
|
||||
|
||||
.PHONY: darwin
|
||||
darwin: $(OSXBIN)
|
||||
chmod +x $(OSXBIN)
|
||||
|
||||
.PHONY: win64
|
||||
win64: $(WINBIN)
|
||||
|
||||
.PHONY: $(OSXBIN)
|
||||
$(OSXBIN):
|
||||
GO111MODULE=$(GOMOD) GOARCH=$(GOARCH) GOOS=$(GOOSX) CGO_ENABLED=$(CGO_ENABLED) $(CC) $(CFLAGS) -o $(OSXBIN) -ldflags="$(LDFLAGS)" -gcflags="$(GCFLAGS)" -asmflags="$(ASMFLAGS)" ./src
|
||||
|
||||
.PHONY: $(ARMBIN)
|
||||
$(ARMBIN):
|
||||
GO111MODULE=$(GOMOD) GOARCH=$(GOARCH) GOOS=$(GOOSLINUX) CGO_ENABLED=$(CGO_ENABLED) $(CC) $(CFLAGS) -o $(ARMBIN) -ldflags="$(LDFLAGS)" -gcflags="$(GCFLAGS)" -asmflags="$(ASMFLAGS)" ./src
|
||||
|
||||
.PHONY: $(LINUXBIN)
|
||||
$(LINUXBIN):
|
||||
GO111MODULE=$(GOMOD) GOARCH=$(GOARCH) GOOS=$(GOOSLINUX) CGO_ENABLED=$(CGO_ENABLED) $(CC) $(CFLAGS) -o $(LINUXBIN) -ldflags="$(LDFLAGS)" -gcflags="$(GCFLAGS)" -asmflags="$(ASMFLAGS)" ./src
|
||||
|
||||
.PHONY: $(WINBIN)
|
||||
$(WINBIN):
|
||||
GO111MODULE=$(GOMOD) GOARCH=$(GOARCH) GOOS=$(GOOSWIN) CGO_ENABLED=$(CGO_ENABLED) $(CC) $(CFLAGS) -o $(WINBIN) -ldflags="$(LDFLAGS)" -gcflags="$(GCFLAGS)" -asmflags="$(ASMFLAGS)" ./src
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -rf $(DIR)/*
|
||||
|
||||
tool-gofumpt:
|
||||
which golangci-lint > /dev/null 2>&1 || go install mvdan.cc/gofumpt@latest
|
||||
|
|
0
build/.gitkeep
Normal file
0
build/.gitkeep
Normal file
Loading…
Reference in a new issue