-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
34 lines (26 loc) · 1.12 KB
/
Copy pathMakefile
File metadata and controls
34 lines (26 loc) · 1.12 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
GO ?= go
BIN := bin
DIST := dist
# Embedded build version. Derived from SemVer-style git tags only (--match
# 'v[0-9]*'): a checkout AT tag vX.Y.Z reports vX.Y.Z; a commit after the tag
# carries describe distance metadata (vX.Y.Z-N-gSHA); a tree with no matching
# tag falls back to the commit hash. Release CI overrides VERSION with the
# exact tag name so release binaries are deterministic.
VERSION ?= $(shell git describe --tags --match 'v[0-9]*' --always --dirty 2>/dev/null || echo dev)
LDFLAGS := -s -w -X main.version=$(VERSION)
.PHONY: all build test vet cross clean
all: build
build:
mkdir -p $(BIN)
$(GO) build -trimpath -ldflags "$(LDFLAGS)" -o $(BIN)/proxops ./cmd/proxops
test:
$(GO) test -count=1 ./...
vet:
$(GO) vet ./...
# Static Linux binaries for common ProxOps deployment architectures.
cross:
mkdir -p $(DIST)
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(GO) build -trimpath -ldflags "$(LDFLAGS)" -o $(DIST)/proxops-linux-amd64 ./cmd/proxops
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 $(GO) build -trimpath -ldflags "$(LDFLAGS)" -o $(DIST)/proxops-linux-arm64 ./cmd/proxops
clean:
rm -rf $(BIN) $(DIST)