.PHONY: all clean OBJS := $(patsubst %.org, %.pdf, $(wildcard *.org)) CRAP := $(patsubst %.org, %.pdf, $(wildcard *.org)) CRAP += $(patsubst %.org, %.aux, $(wildcard *.org)) CRAP += $(patsubst %.org, %.log, $(wildcard *.org)) CRAP += $(patsubst %.org, %.out, $(wildcard *.org)) CRAP += $(patsubst %.org, %.toc, $(wildcard *.org)) all: $(OBJS) clean: rm -f $(CRAP) %.tex: %.org emacs --eval '(setq enable-local-variables :all)' \ $< \ -f org-export-as-latex \ -f save-buffers-kill-emacs %.pdf: %.tex pdflatex $< pdflatex $<