refgen/Makefile

42 lines
989 B
Makefile

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 $(files) | sed 's/\.org/.$@/g' | sed 's/org\//out\//g'`; \
$(MAKE) $$GOALS;
out tmp :
mkdir $@
.SECONDEXPANSION:
out/%.org out/%.tex out/%.pdf out/%.html : $$(subst out,tmp,$$@) | out
cp $< out/
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 out/* ~/public_html/holdets_time/