PDFLATEX ?= pdflatex PDFLATEX_FLAGS ?= -halt-on-error -output-directory tmp files := $(wildcard org/*.org) .PHONY: clean upload publish org html pdf tex all: org html pdf tex org html pdf tex : $(wildcard org/*.org) GOALS=`echo $(foreach file,$(files),out/$(basename $(notdir $(file)))/$(notdir $(file))) | sed 's/\.org/.$@/g'`; \ $(MAKE) $$GOALS; out tmp : mkdir $@ .SECONDEXPANSION: out/%.org out/%.tex out/%.pdf out/%.html : tmp/$$(notdir $$@) | out mkdir -p $(@D) echo $@ echo out/$(basename $(notdir $@)) echo $(notdir $@) out/$(basename $(notdir $<)) $< cp $< out/$(basename $(notdir $<)) tmp/%.org : org/%.org | tmp cp $< tmp/ sed -i '1i#+SETUPFILE: ../setup.org' $@ tmp/%.tex : tmp/%.org | tmp emacs --batch $< -l ../init.el -f org-mode --eval '(org-latex-export-to-latex)' tmp/%.pdf : tmp/%.tex | tmp $(PDFLATEX) $(PDFLATEX_FLAGS) $<; \ $(PDFLATEX) $(PDFLATEX_FLAGS) $< tmp/%.html : tmp/%.org | tmp emacs --batch $< -l ../init.el -f org-mode --eval '(org-html-export-to-html)' clean: rm -r tmp out upload: scp -P 35284 out/* christoffer@users.guava.space:public_html/holdets_time/ publish: cp -r out/* ~/public_html/holdets_time/