-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
46 lines (31 loc) · 981 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
MAKE = make
LATEXMK = latexmk
LATEXMKFLAG += -halt-on-error -lualatex
CP = cp
CD = cd
RM = rm
SRC = main
TARGET = $(addsuffix .pdf, $(SRC))
TEXFILES = ./texfiles
CLASS = word
TEXDEPS = $(addsuffix .cls, $(TEXFILES)/$(CLASS))
TEXDTX = $(addsuffix .dtx, $(TEXFILES)/$(CLASS))
TEXINS = $(addsuffix .ins, $(TEXFILES)/$(CLASS))
PANDOC = pandoc
PANDOC_TEMPLATE = word-template.latex
.PHONY: all continue clean pandoc
all: $(SRC).pdf
%.pdf: %.tex $(CLASS).cls
$(MAKE) $(TEXDEPS)
$(LATEXMK) $(LATEXMKFLAG) $<
continue:
LATEXMKFLAG +=-pvc $(MAKE)
$(CLASS).cls: $(TEXDEPS)
$(CP) -r $(foreach deps, $(TEXDEPS), $(deps)) ./
$(TEXDEPS): $(TEXDTX) $(TEXINS)
LATEXMKFLAG="$(LATEXMKFLAG)" $(MAKE) $(CLASS).cls -C $(TEXFILES)
clean:
$(RM) -f $(TEXDEPS)
$(LATEXMK) -C
pandoc:
$(PANDOC) -f markdown -t latex -o $(SRC).tex --listings -M listings --template $(PANDOC_TEMPLATE) $(SRC).md