-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
37 lines (30 loc) · 1.16 KB
/
Makefile
File metadata and controls
37 lines (30 loc) · 1.16 KB
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
37
BINARY := keel
MODULE := github.com/getkaze/keel
VERSION := $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
LDFLAGS := -s -w -X main.version=$(VERSION)
# Default: build for current platform
.PHONY: build
build:
go build -ldflags "$(LDFLAGS)" -o bin/$(BINARY) .
# Cross-compile for Linux amd64 (EC2 / remote targets)
.PHONY: build-linux
build-linux:
GOOS=linux GOARCH=amd64 go build -ldflags "$(LDFLAGS)" -o bin/$(BINARY)-linux-amd64 .
# Cross-compile for Linux arm64
.PHONY: build-linux-arm64
build-linux-arm64:
GOOS=linux GOARCH=arm64 go build -ldflags "$(LDFLAGS)" -o bin/$(BINARY)-linux-arm64 .
# Cross-compile for macOS amd64 (Intel Mac)
.PHONY: build-darwin
build-darwin:
GOOS=darwin GOARCH=amd64 go build -ldflags "$(LDFLAGS)" -o bin/$(BINARY)-darwin-amd64 .
# Cross-compile for macOS arm64 (Apple Silicon)
.PHONY: build-darwin-arm64
build-darwin-arm64:
GOOS=darwin GOARCH=arm64 go build -ldflags "$(LDFLAGS)" -o bin/$(BINARY)-darwin-arm64 .
# Build for all targets
.PHONY: build-all
build-all: build build-linux build-linux-arm64 build-darwin build-darwin-arm64
.PHONY: clean
clean:
rm -f bin/$(BINARY) bin/$(BINARY)-linux-* bin/$(BINARY)-darwin-*