-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
18 lines (15 loc) · 814 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
BINARY_NAME=subping
CGO_ENABLED=0
VERSION=$(shell git describe --tags --abbrev=0)
BUILD_FLAGS="-w -s -X main.subpingVersion=$(VERSION)"
PLATFORMS = linux/amd64 linux/386 linux/arm64 linux/arm windows/amd64 windows/386 windows/arm64 windows/arm
LINUX_PATFORMS=$(filter-out windows/%, $(PLATFORMS))
IMAGE_NAME=ghcr.io/fadhilyori/subping:latest
build:
go build -ldflags=$(BUILD_FLAGS) -o out/$(BINARY_NAME) ./cmd/subping/
build-docker:
docker build --build-arg VERSION=$(VERSION) -t $(IMAGE_NAME) .
build-all:
mkdir -p out
$(foreach platform,$(PLATFORMS),\
CGO_ENABLED=$(CGO_ENABLED) GOOS=$(word 1,$(subst /, ,$(platform))) GOARCH=$(word 2,$(subst /, ,$(platform))) go build -ldflags=$(BUILD_FLAGS) -o out/$(BINARY_NAME)-$(word 1,$(subst /, ,$(platform)))-$(word 2,$(subst /, ,$(platform))) ./cmd/subping/;)