LISTEN ?= :8080
AUDIT_PATH ?=
EXPORT_DIR ?= $(CURDIR)/.tmp/export
VERSION ?= $(shell sh ./scripts/resolve-version.sh)
GO_LDFLAGS := -X main.Version=$(VERSION)

RUN_ARGS := web --listen $(LISTEN) --export-dir $(EXPORT_DIR)
ifneq ($(AUDIT_PATH),)
RUN_ARGS += --audit-path $(AUDIT_PATH)
endif

.PHONY: run build test

run:
	mkdir -p $(EXPORT_DIR)
	go run -ldflags "$(GO_LDFLAGS)" ./cmd/bee $(RUN_ARGS)

build:
	go build -ldflags "$(GO_LDFLAGS)" -o bee ./cmd/bee

test:
	go test ./...
