refgen/Makefile

43 lines
1.0 KiB
Makefile
Raw Normal View History

2017-10-03 21:52:55 +00:00
PDFLATEX ?= pdflatex
PDFLATEX_FLAGS ?= -halt-on-error -output-directory tmp
2017-10-04 12:47:48 +00:00
files := $(wildcard org/*.org)
.PHONY: clean upload publish org html pdf tex
2017-10-03 21:52:55 +00:00
2017-10-04 14:45:19 +00:00
all : org html pdf tex
2017-10-03 21:52:55 +00:00
2017-10-04 12:47:48 +00:00
org html pdf tex : $(wildcard org/*.org)
2017-10-04 13:50:07 +00:00
GOALS=`echo $(foreach file,$(files),out/$(basename $(notdir $(file)))/$(notdir $(file))) | sed 's/\.org/.$@/g'`; \
2017-10-04 12:47:48 +00:00
$(MAKE) $$GOALS;
2017-10-03 21:52:55 +00:00
out tmp :
mkdir $@
.SECONDEXPANSION:
2017-10-04 13:50:07 +00:00
out/%.org out/%.tex out/%.pdf out/%.html : tmp/$$(notdir $$@) | out
mkdir -p $(@D)
cp $< out/$(basename $(notdir $<))
2017-10-03 21:52:55 +00:00
tmp/%.org : org/%.org | tmp
2017-10-04 14:45:19 +00:00
cp $< $@
2017-10-03 21:52:55 +00:00
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:
2017-10-04 12:47:48 +00:00
rm -r tmp out
2017-10-03 21:52:55 +00:00
upload:
scp -P 35284 out/* christoffer@users.guava.space:public_html/holdets_time/
2017-10-04 12:47:48 +00:00
publish:
2017-10-04 13:50:07 +00:00
cp -r out/* ~/public_html/holdets_time/