forked from ustctug/ustcthesis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
72 lines (57 loc) · 1.81 KB
/
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
MAIN = main
NAME = ustcthesis
CLSFILES = $(NAME).cls
BSTFILES = $(NAME)-numerical.bst $(NAME)-authoryear.bst $(NAME)-bachelor.bst
SHELL = bash
LATEXMK = latexmk -xelatex
VERSION = $(shell cat $(NAME).dtx | egrep -o "\[\d\d\d\d/\d\d\/\d\d v.+\]" \
| egrep -o "v\S+")
TEXMF = $(shell kpsewhich --var-value TEXMFHOME)
.PHONY : main cls doc test save clean all install distclean zip FORCE_MAKE
main : $(MAIN).pdf
all : main doc
cls : $(CLSFILES) $(BSTFILES)
doc : $(NAME).pdf
$(MAIN).pdf : $(MAIN).tex $(CLSFILES) $(BSTFILES) FORCE_MAKE
$(LATEXMK) $<
$(NAME).cls : $(NAME).dtx
xetex $<
$(NAME).pdf : $(NAME).dtx FORCE_MAKE
$(LATEXMK) $<
test:
texlua build.lua check --halt-on-error
save:
-texlua build.lua save titlepage
-texlua build.lua save titlepage-english
-texlua build.lua save titlepage-master
-texlua build.lua save titlepage-secret
-texlua build.lua save titlepage-bachelor
-texlua build.lua save statement
-texlua build.lua save statement-secret
-texlua build.lua save main
-texlua build.lua save main-english
-texlua build.lua save main-bachelor
-texlua build.lua save main-bachelor-arabic
-texlua build.lua save main-bachelor-english
clean : FORCE_MAKE
$(LATEXMK) -c $(MAIN).tex
$(LATEXMK) -c $(NAME).dtx
rm -rf build
distclean :
$(LATEXMK) -C $(MAIN).tex
$(LATEXMK) -C $(NAME).dtx
rm -rf build
install : cls doc
mkdir -p $(TEXMF)/{doc,source,tex}/latex/$(NAME)
mkdir -p $(TEXMF)/bibtex/bst/$(NAME)
cp $(BSTFILES) $(TEXMF)/bibtex/bst/$(NAME)
cp $(NAME).pdf $(TEXMF)/doc/latex/$(NAME)
cp $(NAME).dtx $(TEXMF)/source/latex/$(NAME)
cp $(CLSFILES) $(TEXMF)/tex/latex/$(NAME)
zip : main doc
ln -sf . $(NAME)
zip -r ../$(NAME)-$(VERSION).zip $(NAME)/{README.md,LICENSE,\
$(NAME).dtx,$(NAME).pdf,$(NAME).cls,$(NAME)-*.bst,figures,\
$(MAIN).tex,chapters,bib,$(MAIN).pdf,\
latexmkrc,Makefile}
rm $(NAME)