-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathbuild
executable file
·89 lines (80 loc) · 1.71 KB
/
build
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
#!/bin/bash
function clean_extract {
echo "clean extract..."
for fname in *.def *.cls *.tex; do
/bin/rm -rf ${fname}
done
}
function clean_aux {
echo "clean aux..."
for fname in *.aux *.lof *.log *.out *.toc *.glo *.hd *.idx; do
/bin/rm -rf ${fname}
done
/bin/rm -rf _minted*
}
function clean_pdf {
echo "clean pdf..."
for fname in *.pdf; do
/bin/rm -rf ${fname}
done
}
function clean_all {
clean_extract
clean_aux
clean_pdf
}
function extract {
echo "extracting..."
xelatex sduthesis.ins
for fname in *.md; do
mv ${fname} ${fname%.*}
done
}
function build_document {
echo "building documents..."
mode="-interaction=batchmode"
xelatex ${mode} sduthesis.dtx
xelatex ${mode} sduthesis.dtx
xelatex ${mode} sduthesis-demo.tex
xelatex ${mode} sduthesis-demo.tex
}
flag=$1
flag=${flag:-"all"}
if [ ${flag}x == "all"x ]; then
clean_all
extract
build_document
clean_aux
fi
if [ ${flag}x == "clean"x ]; then
clean_all
fi
if [ ${flag}x == "extract"x ]; then
clean_extract
extract
fi
if [ ${flag}x == "doc"x ]; then
build_document
fi
if [ ${flag}x == "cleanaux"x ]; then
clean_aux
fi
if [ ${flag}x == "cleanext"x ]; then
clean_extract
fi
if [ ${flag}x == "help"x ]; then
clear
echo "This is the build script for SDUThesis."
echo ""
echo "USAGE: "
echo " build [param]"
echo ""
echo "param:"
echo " help Display this help text."
echo " all Do all tasks."
echo " clean Clean all extracted files, aux files and pdf files."
echo " cleanaux Clean aux files."
echo " cleanext Clean extracted files."
echo " extract Extract the Thesis Template from .ins and .dtx files."
echo " doc Build documentations."
fi