-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
61 lines (42 loc) · 1.68 KB
/
Makefile
File metadata and controls
61 lines (42 loc) · 1.68 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
BUILD_DIR = build
# Get the current Git hash
GIT_HASH := $(shell git rev-parse --short HEAD)
ifneq ($(shell git status --porcelain),)
# There are untracked changes
GIT_HASH := $(GIT_HASH)+
endif
# Capture the current build date in RFC3339 format
BUILD_DATE := $(shell date -u +"%Y-%m-%dT%H:%M:%SZ")
all: examples binaries
binaries: ts-plug ts-unplug
ts-plug:
go build -o build/ts-plug ./cmd/ts-multi-plug
ts-unplug:
go build -o build/ts-unplug ./cmd/ts-unplug
darwin: darwin-ts-plug darwin-ts-unplug
darwin-ts-plug:
GOOS=darwin GOARCH=arm64 go build -o build/ts-plug-darwin-arm64 ./cmd/ts-multi-plug
darwin-ts-unplug:
GOOS=darwin GOARCH=arm64 go build -o build/ts-unplug-darwin-arm64 ./cmd/ts-unplug
linux: linux-ts-plug linux-ts-unplug
linux-ts-plug:
GOOS=linux GOARCH=arm64 go build -o build/ts-plug-linux-arm64 ./cmd/ts-multi-plug
GOOS=linux GOARCH=amd64 go build -o build/ts-plug-linux-amd64 ./cmd/ts-multi-plug
linux-ts-unplug:
GOOS=linux GOARCH=arm64 go build -o build/ts-unplug-linux-arm64 ./cmd/ts-unplug
GOOS=linux GOARCH=amd64 go build -o build/ts-unplug-linux-amd64 ./cmd/ts-unplug
install: binaries
cp build/ts-plug $(GOPATH)/bin/ts-plug
cp build/ts-unplug $(GOPATH)/bin/ts-unplug
clean:
rm -rf $(BUILD_DIR)/*
examples:
go build -o $(BUILD_DIR)/hello ./cmd/examples/hello/hello.go
go build -o $(BUILD_DIR)/resolver ./cmd/examples/resolver/resolver.go
# use cached test results while developing
test: examples
# go test -race -timeout 30s -short ./internal/...
staticcheck ./... || true
$(BUILD_DIR):
mkdir -p $(BUILD_DIR)
.PHONY: all test examples clean binaries ts-plug ts-unplug darwin darwin-ts-plug darwin-ts-unplug linux linux-ts-plug linux-ts-unplug install