summaryrefslogtreecommitdiffstats
path: root/presentations/fri-demokratisk/Makefile
blob: e18abb3558d99d369c7891aaca4c89172b643605 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
SHELL = /bin/bash

AUTHOR = eek
DATE = 2015-10
VERSION = draft

all: notes posters images

author := $(AUTHOR)
date := $(DATE)
base := $(notdir $(shell pwd))
version := $(VERSION)
pre = $(author)-$(date)-$(base)
suf = $(version)

notes: $(pre)-notes-$(suf).pdf

posters: $(pre)-posters-$(suf).pdf

IMAGES = Richard_Stallman_at_Marlboro_College.jpg Heckert_GNU.png Tux.pdf

$(IMAGES):
	make -C images $@

$(pre)-notes-$(suf).tex: script.mdwn
	pandoc -s -f markdown -t latex -V classoption=a4paper,twocolumn,11pt -V geometry=left=10mm,right=15mm,top=20mm,bottom=15mm,includefoot  < $< |\
	sed '/{geometry}/ a \\\\setlength\\columnsep{25mm}\\setlength\\columnseprule{0pt}' |\
	sed '/\\subtitle/ i \\\newcommand{\\subtitle}[1]{}'> $@

$(pre)-posters-$(suf).tex: posters.tex
	sed "/input.bib/ s/bib/$(pre)-bib-$(suf)/" < $< > $@

$(pre)-bib-$(suf).tex: $(pre)-notes-$(suf).tex
	sed -n '/subsection.Den som vill veta mer/,/subsection/ p' < $< | sed '1,2 d; $$ d' > $@

$(pre)-posters-$(suf).pdf: $(pre)-posters-$(suf).tex $(pre)-bib-$(suf).tex $(IMAGES)
	jobname=$(basename $@) ;\
	latex_count=5 ;\
	latex_log=$$jobname.log ;\
	pdflatex -jobname $$jobname $< ;\
	while egrep -s 'Rerun (LaTeX|to get cross-references right)' $$latex_log && [ $$latex_count -gt 0 ] ;\
	   do echo "Rerunning latex...." ;  pdflatex -jobname $$jobname $< ;\
	   latex_count=`expr $$latex_count - 1`;\
	done;

%.pdf: %.tex
	jobname=$(basename $@) ;\
	latex_count=5 ;\
	latex_log=$$jobname.log ;\
	pdflatex -jobname $$jobname $< ;\
	while egrep -s 'Rerun (LaTeX|to get cross-references right)' $$latex_log && [ $$latex_count -gt 0 ] ;\
	   do echo "Rerunning latex...." ;  pdflatex -jobname $$jobname $< ;\
	   latex_count=`expr $$latex_count - 1`;\
	done;