all: build

OPTS ?= --progress --no-debug
Q ?= @
SHOULD_UPDATE = ./bin/should-update
DBDIR=/tmp/tests-on-dodb

benchmark-cars:
	$(Q)crystal build spec/benchmark-cars.cr $(OPTS) --release

build: benchmark-cars

wipe-db:
	rm -r $(DBDIR)

release:
	make build OPTS="--release --progress"

doc:
	crystal docs src/dodb.cr

HTTPD_ACCESS_LOGS ?= /tmp/access-dodb-docs.log
HTTPD_ADDR        ?= 127.0.0.1
HTTPD_PORT        ?= 9000
DIR               ?= docs
serve-doc:
	darkhttpd $(DIR) --addr $(HTTPD_ADDR) --port $(HTTPD_PORT) --log $(HTTPD_ACCESS_LOGS)