You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

55 lines
1.4 KiB

IMAGE_NAME ?= natsrouter:testing
CODE_PATH ?= /go/src/code.hollensbe.org/erikh/natsrouter
GO_TEST := go test -v ./... -race -count 1
VERSION ?= $(shell git rev-parse HEAD)
DOCKER_CMD := docker run -it \
--rm \
-e IN_DOCKER=1 \
-e SETUID=$$(id -u) \
-e SETGID=$$(id -g) \
-w $(CODE_PATH) \
-v ${PWD}/.go-cache:/tmp/go-build-cache \
-v ${PWD}:$(CODE_PATH) \
$(IMAGE_NAME)
release: distclean
GOBIN=${PWD}/build/ldhcpd-$$(cat VERSION) VERSION=$$(cat VERSION) make install
# FIXME include LICENSE.md
cp README.md example.conf build/ldhcpd-$$(cat VERSION)
cd build && tar cvzf ../ldhcpd-$$(cat ../VERSION).tar.gz ldhcpd-$$(cat ../VERSION)
distclean:
rm -rf build
generate:
GOBIN=${GOPATH}/bin go install -v github.com/golang/protobuf/protoc-gen-go
VERSION=${VERSION} go generate -v ./...
shell: build
mkdir -p .go-cache
$(DOCKER_CMD)
build: get-box
box -t $(IMAGE_NAME) box.rb
docker-check:
@if [ -z "$${IN_DOCKER}" ]; then echo "You really don't want to do this"; exit 1; fi
start: docker-check stop
nats-server &
stop: docker-check
pkill nats-server || :
get-box:
@if [ ! -f "$(shell which box)" ]; \
then \
echo "Need to install box to build the docker images we use. Requires root access."; \
curl -sSL box-builder.sh | sudo bash; \
fi
test:
if [ -z "$${IN_DOCKER}" ]; then make build && $(DOCKER_CMD) $(GO_TEST); else $(GO_TEST); fi
.PHONY: test