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

.PHONY: build
build: $(TARGET)

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

%.pdf: %.tex
	latexmk $<

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

.PHONY: watch
watch_intro:
	latexmk -pvc linux_intro.tex

.PHONY: watch
watch_bof:
	latexmk -pvc bof.tex

.PHONY: lint
lint:
	chktex $(SRC)

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

.PHONY: clean
clean: clean_tex

.PHONY: clean_tex
clean_tex:
	latexmk -C
	rm -rf ./_minted-presentation/
	rm -rf ./_minted-bof/
	rm -rf ./_minted-linux_intro/