-
Notifications
You must be signed in to change notification settings - Fork 44
/
Makefile
55 lines (43 loc) · 1.43 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
VERSION = $(shell git describe --tags --always --dirty)
LDFLAGS=-ldflags "-X main.version=$(VERSION)"
OSARCH=$(shell go env GOHOSTOS)-$(shell go env GOHOSTARCH)
NANOMDM=\
nanomdm-darwin-amd64 \
nanomdm-darwin-arm64 \
nanomdm-linux-amd64 \
nanomdm-linux-arm64 \
nanomdm-linux-arm \
nanomdm-windows-amd64.exe
NANO2NANO=\
nano2nano-darwin-amd64 \
nano2nano-darwin-arm64 \
nano2nano-linux-amd64 \
nano2nano-linux-arm64 \
nano2nano-linux-arm \
nano2nano-windows-amd64.exe
SUPPLEMENTAL=\
tools/cmdr.py \
docs/enroll.mobileconfig
my: nanomdm-$(OSARCH) nano2nano-$(OSARCH)
$(NANOMDM): cmd/nanomdm
GOOS=$(word 2,$(subst -, ,$@)) GOARCH=$(word 3,$(subst -, ,$(subst .exe,,$@))) go build $(LDFLAGS) -o $@ ./$<
$(NANO2NANO): cmd/nano2nano
GOOS=$(word 2,$(subst -, ,$@)) GOARCH=$(word 3,$(subst -, ,$(subst .exe,,$@))) go build $(LDFLAGS) -o $@ ./$<
nanomdm-%-$(VERSION).zip: nanomdm-%.exe nano2nano-%.exe $(SUPPLEMENTAL)
rm -rf $(subst .zip,,$@)
mkdir $(subst .zip,,$@)
ln $^ $(subst .zip,,$@)
zip -r $@ $(subst .zip,,$@)
rm -rf $(subst .zip,,$@)
nanomdm-%-$(VERSION).zip: nanomdm-% nano2nano-% $(SUPPLEMENTAL)
rm -rf $(subst .zip,,$@)
mkdir $(subst .zip,,$@)
ln $^ $(subst .zip,,$@)
zip -r $@ $(subst .zip,,$@)
rm -rf $(subst .zip,,$@)
clean:
rm -rf nanomdm-* nano2nano-*
release: $(foreach bin,$(NANOMDM),$(subst .exe,,$(bin))-$(VERSION).zip)
test:
go test -v -cover -race ./...
.PHONY: my $(NANOMDM) $(NANO2NANO) clean release test