You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
mu-go/Makefile

68 lines
1.9 KiB

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
fmt: tool-gofumpt
gofumpt -w --extra ./src
.ONESHELL:
run-code-quality-analysis:
export SONAR_TOKEN="$$SONAR_TOKEN_DEBLAN_MU_GO"
sonar-scanner -Dsonar.projectKey=deblan-mu-go -Dsonar.sources=. -Dsonar.host.url="$$SONAR_SERVER"