TEX      = pdflatex
BIB      = bibtex
MAIN     = ietf-landscape
SOURCES  = $(MAIN).tex ietf-refs.bib

.PHONY: all clean watch

all: $(MAIN).pdf

$(MAIN).pdf: $(SOURCES)
	$(TEX) $(MAIN)
	$(BIB) $(MAIN)
	$(TEX) $(MAIN)
	$(TEX) $(MAIN)

clean:
	rm -f $(MAIN).aux $(MAIN).bbl $(MAIN).blg $(MAIN).log \
	      $(MAIN).out $(MAIN).pdf $(MAIN).toc $(MAIN).fls \
	      $(MAIN).fdb_latexmk $(MAIN).synctex.gz

watch:
	@echo "Rebuilding on change..."
	@while true; do \
		inotifywait -q -e modify $(SOURCES) 2>/dev/null || sleep 2; \
		$(MAKE) all; \
	done
