-
Notifications
You must be signed in to change notification settings - Fork 10
/
Makefile
40 lines (27 loc) · 921 Bytes
/
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
.PHONY = all clean
PLATFORMS := linux-arm6 linux-arm7 linux-amd64 linux-386 darwin-amd64
VERSION := $(shell git describe --always --tags --dirty="-dev-$$(git rev-parse --short HEAD)")
MAIN := ./cmd/tailscalesd
BUILDCMD := go build -o
ifneq ($(strip $(VERSION)),)
BUILDCMD := go build -ldflags="-X 'main.Version=$(VERSION)'" -o
endif
DISTTARGETS := $(foreach ku,$(PLATFORMS),tailscalesd-$(ku))
SUMS := SHA1SUM.txt SHA256SUM.txt
all: tailscalesd
test:
go test -v ./... -bench=.
tailscalesd:
$(BUILDCMD) $@ $(MAIN)
dist: $(DISTTARGETS) $(SUMS)
@chmod +x $(DISTTARGETS)
tailscalesd-linux-arm%:
env GOOS=linux GOARCH=arm GOARM=$* $(BUILDCMD) $@ $(MAIN)
tailscalesd-linux-%:
env GOOS=linux GOARCH=$* $(BUILDCMD) $@ $(MAIN)
tailscalesd-darwin-%:
env GOOS=darwin GOARCH=$* $(BUILDCMD) $@ $(MAIN)
SHA%SUM.txt: $(DISTTARGETS)
shasum -a $* $(DISTTARGETS) > $@
clean:
@rm -fv $(DISTTARGETS) $(SUMS) tailscalesd