-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
52 lines (41 loc) · 1.21 KB
/
Copy pathMakefile
File metadata and controls
52 lines (41 loc) · 1.21 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
GO ?= go
BIN := bin/plasticturtle
SHIM := bin/plasticturtle-softnet-shim
# Stamped into the binary so `plasticturtle --version` reports something traceable rather
# than the literal string "dev".
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo dev)
LDFLAGS := -ldflags "-X main.version=$(VERSION)"
.PHONY: check
check: fmt-check vet build test
.PHONY: fmt
fmt:
gofmt -w .
.PHONY: fmt-check
fmt-check:
@out="$$(gofmt -l . )"; \
if [ -n "$$out" ]; then echo "gofmt needed:"; echo "$$out"; exit 1; fi
.PHONY: vet
vet:
$(GO) vet ./...
.PHONY: build
build: $(BIN) $(SHIM)
# pt and its firewall shim are built together and live side by side: `pt setup`
# installs the shim it finds next to itself.
.PHONY: $(BIN)
$(BIN):
$(GO) build $(LDFLAGS) -o $(BIN) ./cmd/plasticturtle
.PHONY: $(SHIM)
$(SHIM):
$(GO) build $(LDFLAGS) -o $(SHIM) ./cmd/plasticturtle-softnet-shim
.PHONY: test
test:
$(GO) test -race ./...
# Opt-in end-to-end test against a real Tart image. Requires macOS, tart, and
# ghcr.io/cirruslabs/macos-tahoe-base pulled locally. Slow by nature: it boots
# a VM.
.PHONY: integration
integration:
$(GO) test -race -count=1 -tags integration -timeout 30m ./...
.PHONY: clean
clean:
rm -rf bin