forked from freenas/bhyve-vm-goagent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
58 lines (49 loc) · 1.6 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
GO ?= go
TARGET := bhyve-vm-goagent
OS := freebsd netbsd linux windows
ARCH := 386 amd64
VERSION := `grep \"VERSION\" main.go | cut -d '"' -f 2 | head -1`
HOSTOS := `go env | grep GOHOSTOS | cut -d '"' -f 2 | head -1`
all: build
deps:
@echo "===> Downloading crossbuild dependencies."
go get github.com/gorilla/websocket
go get github.com/shirou/w32
go get github.com/araujobsd/bhyve-vm-goagent/plugins
go get github.com/araujobsd/bhyve-vm-goagent/termios
go get github.com/araujobsd/bhyve-vm-goagent/websocket
go get github.com/go-ole/go-ole
go get github.com/go-ole/go-ole/oleutil
deps_windows:
go get github.com/StackExchange/wmi
tools:
go build -o goserial ./tools/host/goserial.go
build:
@for arch in $(ARCH); do \
echo "===> building: $(TARGET)-$(HOSTOS)-$$arch-$(VERSION)"; \
if [ $$arch == "386" ] ; then \
GOOS=$$os GOARCH=$$arch go build -o $(TARGET)-$(HOSTOS)-"i386"-"$(VERSION)" $^ ;\
else \
GOOS=$$os GOARCH=$$arch go build -o $(TARGET)-$(HOSTOS)-$$arch-"$(VERSION)" $^ ;\
fi \
done \
release:
@for os in $(OS); do \
for arch in $(ARCH); do \
echo "===> building: $(TARGET)-$$os-$$arch-$(VERSION)"; \
if [ $$arch == "386" ] ; then \
GOOS=$$os GOARCH=$$arch go build -o $(TARGET)-$$os-"i386"-"$(VERSION)" $^ ;\
else \
GOOS=$$os GOARCH=$$arch go build -o $(TARGET)-$$os-$$arch-"$(VERSION)" $^ ;\
fi \
done \
done \
clean:
@$(GO) clean
@for os in $(OS); do \
for arch in $(ARCH); do \
echo "===> Removing: $(TARGET)-$$os-$$arch-$(VERSION)"; \
rm -f $(TARGET)-$$os-$$arch-"$(VERSION)" $^ ;\
done \
done \
.PHONY: all release deps deps_windows tools build clean