-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathMakefile
46 lines (35 loc) · 1.12 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
VERSION = $(shell git describe --tags --always --dirty)
LDFLAGS=-ldflags "-X main.version=$(VERSION)"
OSARCH=$(shell go env GOHOSTOS)-$(shell go env GOHOSTARCH)
KMFDDM=\
kmfddm-darwin-arm64 \
kmfddm-darwin-amd64 \
kmfddm-linux-amd64 \
kmfddm-linux-arm64 \
kmfddm-linux-arm \
kmfddm-windows-amd64.exe
SUPPLEMENTAL=\
tools/*.sh \
tools/*.py
my: kmfddm-$(OSARCH)
docker: kmfddm-linux-amd64
$(KMFDDM): cmd/kmfddm
GOOS=$(word 2,$(subst -, ,$@)) GOARCH=$(word 3,$(subst -, ,$(subst .exe,,$@))) go build $(LDFLAGS) -o $@ ./$<
kmfddm-%-$(VERSION).zip: kmfddm-% $(SUPPLEMENTAL)
rm -rf $@ $(subst .zip,,$@)
mkdir $(subst .zip,,$@)
echo $^ | xargs -n 1 | cpio -pdmu $(subst .zip,,$@)
zip -r $@ $(subst .zip,,$@)
rm -rf $(subst .zip,,$@)
kmfddm-%-$(VERSION).zip: kmfddm-%.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 kmfddm-*
release: $(foreach bin,$(KMFDDM),$(subst .exe,,$(bin))-$(VERSION).zip)
test:
go test -v -cover -race ./...
.PHONY: my docker $(KMFDDM) clean release test