-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
36 lines (25 loc) · 912 Bytes
/
Copy pathMakefile
File metadata and controls
36 lines (25 loc) · 912 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
BINARY := action1
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
LDFLAGS := -ldflags "-s -w -X github.com/dimer47/action1-cli/internal/cli.Version=$(VERSION)"
.PHONY: build install clean test lint
build:
go build $(LDFLAGS) -o bin/$(BINARY) .
install:
go install $(LDFLAGS) .
clean:
rm -rf bin/
test:
go test ./...
lint:
golangci-lint run
# Cross-compilation
.PHONY: build-all
build-all: build-darwin-amd64 build-darwin-arm64 build-linux-amd64 build-windows-amd64
build-darwin-amd64:
GOOS=darwin GOARCH=amd64 go build $(LDFLAGS) -o bin/$(BINARY)-darwin-amd64 .
build-darwin-arm64:
GOOS=darwin GOARCH=arm64 go build $(LDFLAGS) -o bin/$(BINARY)-darwin-arm64 .
build-linux-amd64:
GOOS=linux GOARCH=amd64 go build $(LDFLAGS) -o bin/$(BINARY)-linux-amd64 .
build-windows-amd64:
GOOS=windows GOARCH=amd64 go build $(LDFLAGS) -o bin/$(BINARY)-windows-amd64.exe .