all: quox

NIXFLAGS := --no-warn-dirty

# these two are real files, but always ask nix if they need remaking
.PHONY: quox
quox:
	@echo [build] quox
	nix build $(NIXFLAGS) --no-link '.#quox'
	ln -sfL $$(nix path-info $(NIXFLAGS) '.#quox')/bin/quox quox

.PHONY: quox-tests
quox-tests:
	@echo [build] quox-tests
	nix build $(NIXFLAGS) --no-link '.#quox-tests'
	ln -sfL $$(nix path-info $(NIXFLAGS) '.#quox-tests')/bin/quox-tests quox-tests


.PHONY: lib
lib:
	@echo [build] quox-lib
	nix build $(NIXFLAGS) --no-link '.#quox-lib'

.PHONY: test
test:
	nix run $(NIXFLAGS) -- '.#quox-tests' -V 14 -c

.PHONY: prove
prove:
	nix build $(NIXFLAGS) --no-link '.#quox-tests'
	prove $$(nix path-info $(NIXFLAGS) '.#quox-tests')/bin/quox-tests

.PHONY: clean
clean:
	@echo [clean]
	rm -f quox quox-tests result

.SILENT: