forbedr rekursive kald til make

This commit is contained in:
Christoffer Müller Madsen 2017-10-04 14:47:48 +02:00
parent 909e349f06
commit a89c213ef8

View File

@ -1,21 +1,20 @@
PDFLATEX ?= pdflatex PDFLATEX ?= pdflatex
PDFLATEX_FLAGS ?= -halt-on-error -output-directory tmp PDFLATEX_FLAGS ?= -halt-on-error -output-directory tmp
.PHONY: clean upload org html pdf tex files := $(wildcard org/*.org)
.PHONY: clean upload publish org html pdf tex
all: org html pdf tex all: org html pdf tex
org html pdf tex: org html pdf tex : $(wildcard org/*.org)
for org in $(wildcard org/*.org); do \ GOALS=`echo $(files) | sed 's/\.org/.$@/g' | sed 's/org\//out\//g'`; \
$(MAKE) `echo $$org | sed s/.org/.$@/ | sed s/org/out/`; \ $(MAKE) $$GOALS;
done
out tmp : out tmp :
mkdir $@ mkdir $@
.SECONDEXPANSION: .SECONDEXPANSION:
out/%.org out/%.tex out/%.pdf out/%.html : $$(subst out,tmp,$$@) out/%.org out/%.tex out/%.pdf out/%.html : $$(subst out,tmp,$$@) | out
echo $@
echo $<
echo $(subst out,tmp,$@)
cp $< out/ cp $< out/
tmp/%.org : org/%.org | tmp tmp/%.org : org/%.org | tmp
@ -23,7 +22,6 @@ tmp/%.org : org/%.org | tmp
sed -i '1i#+SETUPFILE: ../setup.org' $@ sed -i '1i#+SETUPFILE: ../setup.org' $@
tmp/%.tex : tmp/%.org | tmp tmp/%.tex : tmp/%.org | tmp
cd tmp;
emacs --batch $< -l ../init.el -f org-mode --eval '(org-latex-export-to-latex)' emacs --batch $< -l ../init.el -f org-mode --eval '(org-latex-export-to-latex)'
tmp/%.pdf : tmp/%.tex | tmp tmp/%.pdf : tmp/%.tex | tmp
@ -34,8 +32,10 @@ tmp/%.html : tmp/%.org | tmp
emacs --batch $< -l ../init.el -f org-mode --eval '(org-html-export-to-html)' emacs --batch $< -l ../init.el -f org-mode --eval '(org-html-export-to-html)'
clean: clean:
rm -r tmp rm -r tmp out
upload: upload:
scp -P 35284 out/* christoffer@users.guava.space:public_html/holdets_time/ scp -P 35284 out/* christoffer@users.guava.space:public_html/holdets_time/
publish:
cp out/* ~/public_html/holdets_time/