-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathMakefile
33 lines (26 loc) · 926 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
DOCKERHUB_USER:=weaveworks
PLUGIN_EXE:=plugin/plugin
PLUGIN_IMAGE:=$(DOCKERHUB_USER)/plugin
PLUGIN_EXPORT:=plugin.tar
.DEFAULT: all
.PHONY: all
all: $(PLUGIN_EXPORT)
PLUGIN_VERSION=git-$(shell git rev-parse --short=12 HEAD)
$(PLUGIN_EXE): plugin/main.go plugin/driver/*.go plugin/skel/*.go
go get -tags netgo ./$(@D)
go build -ldflags "-extldflags \"-static\" -X main.version $(PLUGIN_VERSION)" -tags netgo -o $@ ./$(@D)
@strings $@ | grep cgo_stub\\\.go >/dev/null || { \
rm $@; \
echo "\nYour go standard library was built without the 'netgo' build tag."; \
echo "To fix that, run"; \
echo " sudo go clean -i net"; \
echo " sudo go install -tags netgo std"; \
false; \
}
$(PLUGIN_EXPORT): plugin/Dockerfile $(PLUGIN_EXE)
$(SUDO) docker build -t $(PLUGIN_IMAGE) plugin
$(SUDO) docker save $(PLUGIN_IMAGE):latest > $@
build:
$(SUDO) go clean -i net
$(SUDO) go install -tags netgo std
$(MAKE)