-
Notifications
You must be signed in to change notification settings - Fork 45
/
makefile
46 lines (34 loc) · 988 Bytes
/
makefile
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
## Makefile based on http://git.io/GIs6og
## Define standard Markdown extension
MEXT = md
## All markdown files in the working directory
SRC = $(wildcard *.$(MEXT))
## Bibliography
BIB = /afs/psi.ch/user/h/haberthuer/Documents/library.bib
## Get last commit hash
ID := $(shell git log --oneline --no-color | cut -c -6 | head -n 1)
## File names
PDFS=$(SRC:.md=.pdf)
HTML=$(SRC:.md=.html)
TEX=$(SRC:.md=.tex)
DOC=$(SRC:.md=.docx)
## Targets
all: $(PDFS) $(HTML) $(TEX) $(DOC)
pdf: clean $(PDFS)
html: clean $(HTML)
tex: clean $(TEX)
doc: clean $(DOC)
%.html: %.md
pandoc -w html5 -s -S --bibliography=$(BIB) -o $@ $<
rename.ul .html _$(ID).html *.html
%.tex: %.md
pandoc -w latex -s -S --bibliography=$(BIB) -o $@ $<
rename.ul .tex _$(ID).tex *.tex
%.pdf: %.md
pandoc -s -S --bibliography=$(BIB) -o $@ $<
rename.ul .pdf _$(ID).pdf *.pdf
%.docx: %.md
pandoc -s -S --bibliography=$(BIB) -o $@ $<
rename.ul .docx _$(ID).docx *.docx
clean:
rm -f *.html *.pdf *.tex *.docx