-
Notifications
You must be signed in to change notification settings - Fork 13
/
Makefile
68 lines (53 loc) · 1.99 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
68
VERSION = $(shell git describe --tags --always --dirty)
LDFLAGS=-ldflags "-X main.version=$(VERSION)"
OSARCH=$(shell go env GOHOSTOS)-$(shell go env GOHOSTARCH)
DEPTOKENS=\
deptokens-darwin-arm64 \
deptokens-darwin-amd64 \
deptokens-linux-amd64 \
deptokens-linux-arm64 \
deptokens-linux-arm \
deptokens-windows-amd64.exe
DEPSERVER=\
depserver-darwin-arm64 \
depserver-darwin-amd64 \
depserver-linux-amd64 \
depserver-linux-arm64 \
depserver-linux-arm \
depserver-windows-amd64.exe
DEPSYNCER=\
depsyncer-darwin-arm64 \
depsyncer-darwin-amd64 \
depsyncer-linux-amd64 \
depsyncer-linux-arm64 \
depsyncer-linux-arm \
depsyncer-windows-amd64.exe
SUPPLEMENTAL=\
tools/*.sh \
docs/dep-profile.example.json
my: deptokens-$(OSARCH) depserver-$(OSARCH) depsyncer-$(OSARCH)
docker: depserver-linux-amd64 depsyncer-linux-amd64
$(DEPTOKENS): cmd/deptokens
GOOS=$(word 2,$(subst -, ,$@)) GOARCH=$(word 3,$(subst -, ,$(subst .exe,,$@))) go build $(LDFLAGS) -o $@ ./$<
$(DEPSERVER): cmd/depserver
GOOS=$(word 2,$(subst -, ,$@)) GOARCH=$(word 3,$(subst -, ,$(subst .exe,,$@))) go build $(LDFLAGS) -o $@ ./$<
$(DEPSYNCER): cmd/depsyncer
GOOS=$(word 2,$(subst -, ,$@)) GOARCH=$(word 3,$(subst -, ,$(subst .exe,,$@))) go build $(LDFLAGS) -o $@ ./$<
nanodep-%-$(VERSION).zip: depserver-% depsyncer-% deptokens-% $(SUPPLEMENTAL)
rm -rf $@ $(subst .zip,,$@)
mkdir $(subst .zip,,$@)
echo $^ | xargs -n 1 | cpio -pdmu $(subst .zip,,$@)
zip -r $@ $(subst .zip,,$@)
rm -rf $(subst .zip,,$@)
nanodep-%-$(VERSION).zip: depserver-%.exe depsyncer-%.exe deptokens-%.exe $(SUPPLEMENTAL)
rm -rf $@ $(subst .zip,,$@)
mkdir $(subst .zip,,$@)
echo $^ | xargs -n 1 | cpio -pdmu $(subst .zip,,$@)
zip -r $@ $(subst .zip,,$@)
rm -rf $(subst .zip,,$@)
clean:
rm -f deptokens-* depserver-* depsyncer-* nanodep-*.zip
release: $(foreach bin,$(DEPSERVER),$(subst .exe,,$(subst depserver,nanodep,$(bin)))-$(VERSION).zip)
test:
go test -v -cover -race ./...
.PHONY: my docker $(DEPTOKENS) $(DEPSERVER) $(DEPSYNCER) clean release test