Files
weave/Makefile
T
Matthias Radestock 8dd97a07de fix up Makefile to cope with its new location
also various other Makefile tidy-ups
- extract consts for various targets
- mark non-file targets as phony
- use $@ when possible
2014-10-22 14:06:16 +01:00

36 lines
1.0 KiB
Makefile

.DEFAULT: all
.PHONY: all publish clean
# If you can use docker without being root, you can do "make SUDO="
SUDO=sudo
WEAVER_EXE=weaver/weaver
WEAVER_IMAGE=zettio/weave
WEAVER_EXPORT=/var/tmp/weave.tar
all: $(WEAVER_EXPORT)
$(WEAVER_EXE): router/*.go weaver/main.go
go get -tags netgo ./weaver
go build -ldflags '-extldflags "-static"' -tags netgo -o $@ ./weaver
@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 install -a -tags netgo std"; \
false; \
}
$(WEAVER_EXPORT): weaver/Dockerfile $(WEAVER_EXE)
$(SUDO) docker build -t $(WEAVER_IMAGE) weaver
$(SUDO) docker save $(WEAVER_IMAGE) > $@
publish: $(WEAVER_EXPORT)
$(SUDO) docker tag $(WEAVER_IMAGE) $(WEAVER_IMAGE):git-`git rev-parse --short=12 HEAD`
$(SUDO) docker push $(WEAVER_IMAGE):latest
$(SUDO) docker push $(WEAVER_IMAGE):git-`git rev-parse --short=12 HEAD`
clean:
-$(SUDO) docker rmi $(WEAVER_IMAGE)
rm -f $(WEAVER_EXE) $(WEAVER_EXPORT)