add CI files
add makefile add fpm conf
This commit is contained in:
parent
57527983c1
commit
87e76093a5
8 changed files with 155 additions and 1 deletions
56
Makefile
Normal file
56
Makefile
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
CGO_ENABLED = 0
|
||||
DIR = ./build
|
||||
|
||||
GO_ARCH_AMD = amd64
|
||||
GO_ARCH_ARM = arm64
|
||||
|
||||
GO_OS_WIN = windows
|
||||
GO_OS_DARWIN = darwin
|
||||
GO_OS_LINUX = linux
|
||||
|
||||
EXECUTABLE = i3-wallpaper-manager
|
||||
|
||||
BIN_LINUX_AMD64 = $(DIR)/$(EXECUTABLE)-linux-$(GO_ARCH_AMD)
|
||||
BIN_LINUX_ARM64 = $(DIR)/$(EXECUTABLE)-linux-$(GO_ARCH_ARM)
|
||||
|
||||
CC = go build
|
||||
CFLAGS = -trimpath
|
||||
LDFLAGS = all=-w -s
|
||||
GCFLAGS = all=
|
||||
ASMFLAGS = all=
|
||||
|
||||
.PHONY: all
|
||||
all: linux
|
||||
|
||||
.PHONY: linux
|
||||
linux: $(BIN_LINUX_AMD64) $(BIN_LINUX_ARM64)
|
||||
chmod +x $(BIN_LINUX_ARM64)
|
||||
chmod +x $(BIN_LINUX_AMD64)
|
||||
|
||||
.PHONY: $(BIN_LINUX_AMD64)
|
||||
$(BIN_LINUX_AMD64):
|
||||
GO111MODULE=$(GOMOD) \
|
||||
GOARCH=$(GO_ARCH_AMD) \
|
||||
GOOS=$(GO_OS_LINUX) \
|
||||
CGO_ENABLED=$(CGO_ENABLED) \
|
||||
$(CC) $(CFLAGS) -ldflags="$(LDFLAGS)" -gcflags="$(GCFLAGS)" -asmflags="$(ASMFLAGS)" \
|
||||
-o $(BIN_LINUX_AMD64) .
|
||||
|
||||
.PHONY: $(BIN_LINUX_ARM64)
|
||||
$(BIN_LINUX_ARM64):
|
||||
GO111MODULE=$(GOMOD) \
|
||||
GOARCH=$(GO_ARCH_ARM) \
|
||||
GOOS=$(GO_OS_LINUX) \
|
||||
CGO_ENABLED=$(CGO_ENABLED) \
|
||||
$(CC) $(CFLAGS) -ldflags="$(LDFLAGS)" -gcflags="$(GCFLAGS)" -asmflags="$(ASMFLAGS)" \
|
||||
-o $(BIN_LINUX_ARM64) .
|
||||
|
||||
.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 .
|
||||
Loading…
Add table
Add a link
Reference in a new issue