# use bash so process substutution is available
SHELL = bash
SRC = report.tex
TARGET = $(SRC:%.tex=%.pdf)

.PHONY: build
build: dot $(TARGET)

.PHONY: dot
dot:
	$(MAKE) -C ./assets/dot/

# used for `nix-build`
.PHONY: install
install: build
	mkdir -pv ${out}/
	cp $(TARGET) ${out}/

%.pdf: %.tex
	latexmk $<

.PHONY: watch
watch: dot
	latexmk -pvc $(SRC)

.PHONY: lint
lint:
	chktex $(SRC)

.PHONY: languagetool
languagetool:
	languagetool <(cat content.tex | ./scripts/detex-languagetool.py)

.PHONY: clean
clean: clean_dot clean_tex

.PHONY: clean_tex
clean_tex:
	latexmk -C
	rm -rf ./_minted-report/

.PHONY: clean_dot
clean_dot:
	$(MAKE) -C ./assets/dot/ clean
