BINARY_NAME=exploredns
SERVER_BINARY_NAME=exploredns-server
BUILD_DIR=bin
GO=go
GOFLAGS=-v

.PHONY: build build-server build-all test lint clean cover

build:
	$(GO) build $(GOFLAGS) -o $(BUILD_DIR)/$(BINARY_NAME) ./cmd/exploredns

build-server:
	$(GO) build $(GOFLAGS) -o $(BUILD_DIR)/$(SERVER_BINARY_NAME) ./cmd/server

build-all: build build-server

test:
	$(GO) test -v -race -coverprofile=coverage.out ./...

cover: test
	$(GO) tool cover -func=coverage.out
	$(GO) tool cover -html=coverage.out -o coverage.html

lint:
	$(GO) vet ./...

clean:
	rm -rf $(BUILD_DIR)
	rm -f coverage.out coverage.html
