NIM ?= nim
SRC := src/termimg
TEST := tests/test_termimg
EXAMPLE := examples/demo

.PHONY: check test example clean all

all: check test example

check:
	$(NIM) check --path:src src/termimg.nim
	$(NIM) check --path:src $(TEST).nim
	$(NIM) check --path:src $(EXAMPLE).nim

test: check
	$(NIM) c --path:src -r $(TEST).nim 2>&1 | tail -1

example: check
	$(NIM) c --path:src -r $(EXAMPLE).nim

clean:
	rm -rf nimcache
	rm -f $(TEST)
	rm -f $(EXAMPLE)
	find . -type f -name '*.nim.bak.*' -delete
	find . -type f -name '*.o' -delete
