-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
67 lines (51 loc) · 1.43 KB
/
Makefile
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# Go parameters
GOCMD=go
GOBUILD=$(GOCMD) build
GOCLEAN=$(GOCMD) clean
GOTEST=$(GOCMD) test
GOGET=$(GOCMD) get
# Binary names
AVS_BINARY=avsbinary
OPERATOR_BINARY=operatorbinary
EXOKEY_BINARY=exokey
# Go version
GO_VERSION=1.22
# Build flags
LDFLAGS=-ldflags "-s -w"
# Default target
all: clean build
# Build all binaries
build: avs operator exokey
# AVS build
avs:
$(GOBUILD) $(LDFLAGS) -o $(AVS_BINARY) avs/cmd/main.go
# Operator build
operator:
$(GOBUILD) $(LDFLAGS) -o $(OPERATOR_BINARY) operator/cmd/main.go
# ExoKey build
exokey:
GO_VERSION=$(GO_VERSION) $(GOBUILD) $(LDFLAGS) -o $(EXOKEY_BINARY) cmd/exokey/main.go
# Clean build artifacts
clean:
rm -f $(AVS_BINARY) $(OPERATOR_BINARY) $(EXOKEY_BINARY)
# Run tests
test:
$(GOTEST) ./...
# Install dependencies
deps:
$(GOGET) -v ./...
# Lint code
lint:
golangci-lint run
# Cross-platform builds
build-linux:
GOOS=linux GOARCH=amd64 $(GOBUILD) $(LDFLAGS) -o $(AVS_BINARY)-linux avs/cmd/main.go
GOOS=linux GOARCH=amd64 $(GOBUILD) $(LDFLAGS) -o $(OPERATOR_BINARY)-linux operator/cmd/main.go
build-darwin:
GOOS=darwin GOARCH=amd64 $(GOBUILD) $(LDFLAGS) -o $(AVS_BINARY)-darwin avs/cmd/main.go
GOOS=darwin GOARCH=amd64 $(GOBUILD) $(LDFLAGS) -o $(OPERATOR_BINARY)-darwin operator/cmd/main.go
# Import key command
import-key:
./$(EXOKEY_BINARY) import --key-type ecdsa $(PRI_KEY)
# Phony targets
.PHONY: all build avs operator exokey clean test deps lint build-linux build-darwin import-key