-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
62 lines (49 loc) · 1.87 KB
/
Makefile
File metadata and controls
62 lines (49 loc) · 1.87 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
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
.PHONY: build install clean test generate
BINARIES := ratelord ratelord-d ratelord-tui ratelord-sim
BUILD_DIR := bin
# Get version info for ldflags
VERSION := $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
COMMIT := $(shell git rev-parse --short HEAD 2>/dev/null || echo "unknown")
BUILD_TIME := $(shell date -u +"%Y-%m-%dT%H:%M:%SZ")
LDFLAGS := -X github.com/rmax-ai/ratelord/pkg/version.Version=$(VERSION) \
-X github.com/rmax-ai/ratelord/pkg/version.Commit=$(COMMIT) \
-X github.com/rmax-ai/ratelord/pkg/version.BuildTime=$(BUILD_TIME)
generate:
go generate ./...
web-build:
cd web && npm install && npm run build
build: generate $(BINARIES)
ratelord: cmd/ratelord/main.go
go build -ldflags "$(LDFLAGS)" -o $(BUILD_DIR)/$@ ./cmd/ratelord
ifeq ($(shell uname),Darwin)
@codesign -s - -f $(BUILD_DIR)/$@ 2>/dev/null || true
@echo "Signed $@ for macOS"
endif
ratelord-d: web-build cmd/ratelord-d/main.go
go build -ldflags "$(LDFLAGS)" -o $(BUILD_DIR)/$@ ./cmd/ratelord-d
ifeq ($(shell uname),Darwin)
@codesign -s - -f $(BUILD_DIR)/$@ 2>/dev/null || true
@echo "Signed $@ for macOS"
endif
ratelord-tui: cmd/ratelord-tui/main.go
go build -ldflags "$(LDFLAGS)" -o $(BUILD_DIR)/$@ ./cmd/ratelord-tui
ifeq ($(shell uname),Darwin)
@codesign -s - -f $(BUILD_DIR)/$@ 2>/dev/null || true
@echo "Signed $@ for macOS"
endif
ratelord-sim: cmd/ratelord-sim/main.go
go build -ldflags "$(LDFLAGS)" -o $(BUILD_DIR)/$@ ./cmd/ratelord-sim
ifeq ($(shell uname),Darwin)
@codesign -s - -f $(BUILD_DIR)/$@ 2>/dev/null || true
@echo "Signed $@ for macOS"
endif
install: generate
go install -ldflags "$(LDFLAGS)" ./cmd/ratelord
go install -ldflags "$(LDFLAGS)" ./cmd/ratelord-d
go install -ldflags "$(LDFLAGS)" ./cmd/ratelord-tui
go install -ldflags "$(LDFLAGS)" ./cmd/ratelord-sim
clean:
rm -f $(BUILD_DIR)/*
rm -rf web/dist web/node_modules
test:
go test ./...