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/
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) \
release: distclean
GOBIN=${PWD}/build/ldhcpd-$$(cat VERSION) VERSION=$$(cat VERSION) make install
# FIXME include
cp example.conf build/ldhcpd-$$(cat VERSION)
cd build && tar cvzf ../ldhcpd-$$(cat ../VERSION).tar.gz ldhcpd-$$(cat ../VERSION)
rm -rf build
GOBIN=${GOPATH}/bin go install -v
VERSION=${VERSION} go generate -v ./...
shell: build
mkdir -p .go-cache
build: get-box
box -t $(IMAGE_NAME) box.rb
@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 || :
@if [ ! -f "$(shell which box)" ]; \
then \
echo "Need to install box to build the docker images we use. Requires root access."; \
curl -sSL | sudo bash; \
if [ -z "$${IN_DOCKER}" ]; then make build && $(DOCKER_CMD) $(GO_TEST); else $(GO_TEST); fi
.PHONY: test