-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
36 lines (22 loc) · 809 Bytes
/
Makefile
File metadata and controls
36 lines (22 loc) · 809 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
.PHONY: all build vet test
PLATFORMS ?= linux/amd64 linux/arm64 darwin/amd64 darwin/arm64 windows/amd64 windows/arm64
GOOS?=$(shell uname -s | tr '[:upper:]' '[:lower:]')
GOARCH?=$(shell uname -m)
BINDIR := dist
FILENAME := nekko
BINARY ?= $(BINDIR)/$(FILENAME)-$(GOOS)-$(GOARCH)
.PRECIOUS: $(foreach platform,$(PLATFORMS),$(BINDIR)/$(FILENAME)-$(subst /,-,$(platform)))
all: build
build-all: $(foreach platform,$(PLATFORMS),build-local-$(subst /,-,$(platform)))
build-local-%: $(BINDIR)/$(FILENAME)-%;
build: $(BINARY)
vet:
go vet ./...
test:
go test -v ./...
$(BINDIR):
mkdir -p $@
$(BINDIR)/$(FILENAME)-%: GOOS=$(word 1,$(subst -, ,$*))
$(BINDIR)/$(FILENAME)-%: GOARCH=$(word 2,$(subst -, ,$*))
$(BINDIR)/$(FILENAME)-%: $(BINDIR)
GOOS=$(GOOS) GOARCH=$(GOARCH) go build -o $@ ./cmd/nekko