-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
180 lines (153 loc) · 7.2 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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
######################################################################
##### #
##### LaTeX - Makefile #
##### #
######################################################################
MAIN_SRC = Carl_Friess_BachelorThesis
PDFLATEX_VER = 2011
LATEX_VER = 2011
BIBTEX_VER = 2011
MAKEGLOSSARIES_VER = 2011
LATEX_OPT = --src-specials
ROOT_DIR = .
CONTENT_DIR = content
FIG_DIR = figures
FIG_RAW_DIR = figures_raw
# In general, the present Makefile will consider all *.tex files in
# the content directory as source files. Thus, if any of these files
# (or the main file) will change, a re-build is invoked. If you want
# the Makefile to consider only some specific source files, you can
# list them here. Note, that you do not have to attach the *.tex
# extensions!
CUSTOM_SRC = #01_introduction 02_related_work
######################################################################
##### #
##### Preparation Work #
##### #
######################################################################
# Get the absolute directory path of the current.
ROOT_DIR_PATH = $(shell pwd)
# Get only the directory name of the root directory.
ROOT_DIR_NAME = $(shell basename $(ROOT_DIR_PATH))
# Get the source files which should be investigated for a re-build.
ifeq ($(CUSTOM_SRC), )
CONTENT_SRC = $(wildcard $(ROOT_DIR)/$(CONTENT_DIR)/*.tex)
else
CONTENT_SRC = $(addsuffix .tex, $(addprefix $(ROOT_DIR)/$(CONTENT_DIR)/, $(CUSTOM_SRC)))
endif
# Get only the path to the Tgif source files.
TGIF_SRCS = $(wildcard $(ROOT_DIR)/$(FIG_RAW_DIR)/*.obj)
TGIF_SRCS_NAMES = $(basename $(TGIF_SRCS))
# Get only the path to the Tgif destination files.
TGIF_DEST = $(wildcard $(ROOT_DIR)/$(FIG_DIR)/*.obj)
TGIF_DEST_NAMES = $(basename $(TGIF_SRCS))
# Derive the file names for the resulting EPS and PDF file names for
# the TGIF sources.
TGIF_OUTP_NAMES = $(addprefix $(ROOT_DIR)/$(FIG_DIR)/, $(notdir $(TGIF_SRCS_NAMES)))
TGIF_OUTP_PDF_NAMES = $(addsuffix .pdf, $(TGIF_OUTP_NAMES))
######################################################################
##### #
##### Main Targets #
##### #
######################################################################
pdf: $(MAIN_SRC).pdf
all: pdf glossary bibtex pdf pdf
help:
@echo
@echo "***** IIS Semester Projects/Master Theses LaTeX Report Template *****"
@echo
@echo "Usage : make [options] <target>"
@echo
@echo "Targets : help - Shows the help (this text)."
@echo
@echo " all - (Re)creates output file (PDF) including all other dependencies."
@echo " pdf - (Re)creates the PDF output file."
@echo " figures - (Re)creates all (out-dated) Tgif figures within"
@echo " '$(FIG_RAW_DIR)' and copies them to '$(FIG_DIR)'."
@echo " bibtex - (Re)creates the bibliography using BibTeX."
@echo " glossary - (Re)creates all glossaries (List of acronyms, Glossary, etc.)."
@echo " tar - Creates a TAR archive of the current LaTeX directory."
@echo " zip - Creates a ZIP archive of the current LaTeX directory."
@echo " clean - Cleans up the directory structure."
@echo
@echo "Options : -B - Always build (regardless of whether the dependencies"
@echo " are outdated or not)."
@echo
@echo "Examples : make"
@echo " make figures"
@echo " make bibtex"
@echo
%.pdf: %.tex $(CONTENT_SRC)
pdflatex -shell-escape $(MAIN_SRC).tex
figures: tgif_figures
view:
okular $(MAIN_SRC).pdf &
bibtex:
pdflatex -shell-escape $(MAIN_SRC).tex
bibtex $(MAIN_SRC)
pdflatex -shell-escape $(MAIN_SRC).tex
pdflatex -shell-escape $(MAIN_SRC).tex
glossary:
makeglossaries $(MAIN_SRC)
tar: clean
@echo "***** Creating a TAR archive of the current directory."
@tar -czf $(ROOT_DIR_NAME).tar.gz --exclude .svn \
--exclude $(ROOT_DIR_NAME).tar.gz --exclude README_supervisors \
--exclude $(ROOT_DIR_NAME).zip \
../$(ROOT_DIR_NAME)/
zip: clean
@echo "***** Creating a ZIP archive of the current directory."
-@rm $(ROOT_DIR_NAME).zip
@zip -9 -r -q $(ROOT_DIR_NAME).zip * \
-x '*/.svn/*' -x 'README_supervisors' \
-x '$(ROOT_DIR_NAME).tar.gz' \
-x '$(ROOT_DIR_NAME)' -x '$(ROOT_DIR_NAME)'
clean:
@echo "***** Cleaning the LaTeX directory structure."
@rm -rf $(ROOT_DIR)/*.acr $(ROOT_DIR)/*.alg $(ROOT_DIR)/*.bbl
@rm -rf $(ROOT_DIR)/*.blg $(ROOT_DIR)/*.glg $(ROOT_DIR)/*.gls
@rm -rf $(ROOT_DIR)/*.aux $(ROOT_DIR)/*.glo $(ROOT_DIR)/*.ist
@rm -rf $(ROOT_DIR)/*.lof $(ROOT_DIR)/*.log $(ROOT_DIR)/*.lot
@rm -rf $(ROOT_DIR)/*.toc $(ROOT_DIR)/*.acn $(ROOT_DIR)/*.out
@rm -rf $(ROOT_DIR)/*.tex~ $(ROOT_DIR)/*.tex.backup
@rm -rf $(ROOT_DIR)/*.fdb_latexmk $(ROOT_DIR)/*.fls
@rm -rf $(ROOT_DIR)/Makefile~ $(ROOT_DIR)/pso.conv-*
@rm -rf $(ROOT_DIR)/auto
@rm -rf $(ROOT_DIR)/content/*.tex~ $(ROOT_DIR)/content/*.aux
@rm -rf $(ROOT_DIR)/content/*.log $(ROOT_DIR)/content/auto
@rm -rf $(ROOT_DIR)/content/*.tex.backup
@rm -rf $(ROOT_DIR)/content/*.fdb_latexmk $(ROOT_DIR)/content/*.fls
@rm -rf $(ROOT_DIR)/glossaries/*.tex~ $(ROOT_DIR)/glossaries/auto
@rm -rf $(ROOT_DIR)/preamble/auto $(ROOT_DIR)/preamble/*.tex~
@rm -rf $(ROOT_DIR)/preamble/*.log
@rm -rf $(ROOT_DIR)/bib/auto $(ROOT_DIR)/bib/*.bib~
@rm -rf $(ROOT_DIR)/bib/*.bib.backup
@rm -rf $(ROOT_DIR)/*.mtc* $(ROOT_DIR)/*.maf
######################################################################
##### #
##### Sub Targets #
##### #
######################################################################
tgif_figures: $(TGIF_OUTP_PDF_NAMES)
$(TGIF_OUTP_PDF_NAMES): $(ROOT_DIR)/$(FIG_DIR)/%.pdf : $(ROOT_DIR)/$(FIG_RAW_DIR)/%.obj
@echo "*****"
@echo "***** Printing Tgif figure:"
@echo "***************************"
@echo "***** $(ROOT_DIR)/$(FIG_RAW_DIR)/$*.eps"
@tgif -print -epsi -color -quiet $(ROOT_DIR)/$(FIG_RAW_DIR)/$*.obj
@echo "*****"
@echo "***** Converting Tgif EPS to PDF:"
@echo "*********************************"
@echo "***** $(ROOT_DIR)/$(FIG_RAW_DIR)/$*.eps --> $(ROOT_DIR)/$(FIG_RAW_DIR)/$*.pdf"
@epstopdf $(ROOT_DIR)/$(FIG_RAW_DIR)/$*.eps
@echo "*****"
@echo "***** Moving EPS and PDF figures"
@echo "********************************"
@echo "***** $(ROOT_DIR)/$(FIG_RAW_DIR)/$*.eps --> $(ROOT_DIR)/$(FIG_DIR)/$*.eps"
@echo "***** $(ROOT_DIR)/$(FIG_RAW_DIR)/$*.pdf --> $(ROOT_DIR)/$(FIG_DIR)/$*.pdf"
-@mv $(ROOT_DIR)/$(FIG_RAW_DIR)/$*.eps $(ROOT_DIR)/$(FIG_DIR)/
-@mv $(ROOT_DIR)/$(FIG_RAW_DIR)/$*.pdf $(ROOT_DIR)/$(FIG_DIR)/
@echo "*****"
clean-tgif-figures:
-@rm -f $(TGIF_OUTP_EPS_NAMES) $(TGIF_OUTP_PDF_NAMES)
clean-figures: