-
-
Notifications
You must be signed in to change notification settings - Fork 40
/
Makefile
121 lines (87 loc) · 2.87 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# Makefile for hitszthesis
# Compiling method: latexmk/xelatex/pdflatex
METHOD = xelatex
# Set opts for latexmk if you use it
LATEXMKOPTS = -xelatex
# Set opts for xelatex if you use it
XELATEXOPTS = -shell-escape
# Basename of thesis
THESISMAIN = main
PACKAGE=hitszthesis
SOURCES=$(PACKAGE).ins $(PACKAGE).dtx
THESISCONTENTS=$(THESISMAIN).tex front/*.tex body/*.tex back/*.tex $(FIGURES) *.bst
# NOTE: update this to reflect your local file types.
FIGURES=$(wildcard figures/*.eps figures/*.pdf)
BIBFILE=*.bib
CLSFILES=dtx-style.sty $(PACKAGE).cls $(PACKAGE).ist h$(PACKAGE).cfg
# make deletion work on Windows
ifdef SystemRoot
RM = del /Q
OPEN = start
else
RM = rm -f
OPEN = open
endif
.PHONY: all clean distclean dist thesis wordcount viewthesis doc dev pub viewdoc cls check FORCE_MAKE
all: doc thesis
cls: $(CLSFILES)
$(CLSFILES): $(SOURCES)
xelatex $(PACKAGE).ins
viewdoc: doc
$(OPEN) $(PACKAGE).pdf
doc: $(PACKAGE).pdf
wordcount : $(THESISMAIN).tex
@texcount $< -inc -chinese
viewthesis: thesis
$(OPEN) $(THESISMAIN).pdf
thesis: $(THESISMAIN).pdf
ifeq ($(METHOD),latexmk)
LATEXCMD := $(METHOD) $(LATEXMKOPTS)
$(PACKAGE).pdf: $(CLSFILES) FORCE_MAKE
$(LATEXCMD) $(LATEXMKOPTS) $(PACKAGE).dtx
$(THESISMAIN).pdf: $(CLSFILES) FORCE_MAKE
$(LATEXCMD) $(LATEXMKOPTS) $(THESISMAIN)
else ifeq ($(METHOD),xelatex)
LATEXCMD := $(METHOD) $(XELATEXOPTS)
$(PACKAGE).pdf: $(CLSFILES)
$(LATEXCMD) $(PACKAGE).dtx
makeindex -s gind.ist -o $(PACKAGE).ind $(PACKAGE).idx
makeindex -s gglo.ist -o $(PACKAGE).gls $(PACKAGE).glo
$(LATEXCMD) $(PACKAGE).dtx
$(LATEXCMD) $(PACKAGE).dtx
$(THESISMAIN).idx: $(THESISMAIN).bbl
$(LATEXCMD) $(THESISMAIN)
$(LATEXCMD) $(THESISMAIN)
$(THESISMAIN)_china.idx : $(CLSFILES) $(THESISMAIN).bbl $(THESISMAIN).idx
splitindex $(THESISMAIN) -- -s $(PACKAGE).ist
$(THESISMAIN)_english.ind $(THESISMAIN)_china.ind $(THESISMAIN)_english.idx : $(THESISMAIN)_china.idx
$(THESISMAIN).pdf: $(CLSFILES) $(THESISCONTENTS) $(THESISMAIN)_china.ind $(THESISMAIN)_china.idx $(THESISMAIN)_english.ind $(THESISMAIN)_english.idx $(THESISMAIN).bbl
$(LATEXCMD) $(THESISMAIN)
splitindex $(THESISMAIN) -- -s $(PACKAGE).ist
$(LATEXCMD) $(THESISMAIN)
$(THESISMAIN).bbl: $(BIBFILE) $(THESISCONTENTS)
$(LATEXCMD) $(THESISMAIN)
-bibtex $(THESISMAIN)
$(RM) $(THESISMAIN).pdf
else
$(error Unknown METHOD: $(METHOD))
endif
dev: doc thesis clean
pub: doc thesis cleanall
clean:
latexmk -c $(PACKAGE).dtx
latexmk -c $(THESISMAIN)
-@$(RM) *~ *.idx *.ind *.ilg *.thm *.toe *.bbl *.hd
cleanall: clean
-@$(RM) $(PACKAGE).pdf $(THESISMAIN).pdf
distclean: cleanall
-@$(RM) $(CLSFILES)
-@$(RM) -r dist
check: FORCE_MAKE
ag 'Dissertation Template for Harbin Institute of Technology, ShenZhen|\\def\\version|"version":' hitszthesis.dtx package.json
dist: all
@if [ -z "$(version)" ]; then \
echo "Usage: make dist version=[x.y.z | ctan]"; \
else \
npm run build -- --version=$(version); \
fi