-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
115 lines (85 loc) · 5.15 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
###############################################
### LATEX MAKEFILE V 3.5 - Daniel M.R. 2017 ###
###############################################
################################
## Latex Sources and style files
################################
# Name of the main tex file without extension
PROJECT = sample_document
# Style file or list of files
STYFILE = DM_Styles.sty DM_Custom_Commands.sty
## Directories to search for sources
APPENDICESDIR = appendices
CHAPTERSDIR = chapters
TABLESDIR = tables
FIGURESDIR = figures
REFERENCESDIR = references
## Search for sources
# Directories to search for .tex files.
TEXDIRS = $(APPENDICESDIR) $(CHAPTERSDIR) $(TABLESDIR)
# Find .tex files in the subdirectories
# performing a search of *.tex files amongst all the directories defined on $TEXDIRS
TEXTARGETS = $(shell find $(TEXDIRS) -type f -regex ".*\.\tex")
## Search for images
# Search for changes on png figures. This can be changed by changing the figure extension or by adding
# other search pattern for other image extensions.
FIGURETARGETS = $(shell find $(FIGURESFDIR) -type f -regex ".*\.\png")
# Search for changes on the bibliography files.
REFERENCESTARGETS = $(shell find $(REFERENCESDIR) -type f -regex ".*\.\bib")
## Build the final target
# Global set of targets.
# This searches changes on the $PROJECT.tex file, the template $STYFILE (or set of files)
# and the .tex files found on the subdirectories by $TEXTARGETS
TARGETS = $(PROJECT).tex $(STYFILE) $(TEXTARGETS) $(FIGURETARGETS) $(REFERENCESTARGETS)
######################
## Compilation Options
######################
# Command to compile latex source
TEX = pdflatex
# Command to compile bibliography using bibtex
BIBTEX = bibtex
# Command to build index
MAKEIDX = makeindex
# Build the list of symbols for the project. The file nomencl.ist is temporary and
# the name is unimportant.
BUILDSYMBOLS = $(MAKEIDX) $(PROJECT).nlo -s nomencl.ist -o $(PROJECT).nls
# Commmand to build the latex project into PDF (or DVI according to $(TEX).
BUILDTEX = $(TEX) $(PROJECT).tex
# When using vim-latexsuite it adds annoying <++> symbols, this removes that shit from all .tex files
CLEANEQS = grep -lr --include=*.tex '<++>' ./ | xargs sed -i 's/<++>//g'
##############################
## DEFINING TARGETS OPERATIONS
##############################
all: bibliography
$(PROJECT).pdf: $(TARGETS)
#$(CLEANEQS)
$(BUILDTEX)
$(BUILDSYMBOLS)
$(BUILDTEX)
$(BUILDTEX)
#make clean
bibliography: $(TARGETS)
#$(CLEANEQS)
$(BUILDTEX)
$(BUILDSYMBOLS)
$(BIBTEX) $(PROJECT)
$(BUILDTEX)
$(BUILDTEX)
$(BUILDTEX)
#make clean
# Clean all temporary resource files created during the compilation of the master file
clean:
rm -f *.log *.bak *.aux *.bbl *.blg *.idx *.toc *.out *~ *.lof *.lot *.nlo *.nls *.ist *.ilg *.nav *.snm
rm -f $(CHAPTERSDIR)/*.log $(CHAPTERSDIR)/*.bak $(CHAPTERSDIR)/*.aux $(CHAPTERSDIR)/*.bbl $(CHAPTERSDIR)/*.blg $(CHAPTERSDIR)/*.idx $(CHAPTERSDIR)/*.toc $(CHAPTERSDIR)/*.out $(CHAPTERSDIR)/*~ $(CHAPTERSDIR)/*.nlo $(CHAPTERSDIR)/*.nls $(CHAPTERSDIR)/*.ist $(CHAPTERSDIR)/*.ilg $(CHAPTERSDIR)/*.nav $(CHAPTERSDIR)/*.snm
rm -f $(TABLES)/*.log $(TABLES)/*.bak $(TABLES)/*.aux $(TABLES)/*.bbl $(TABLES)/*.blg $(TABLES)/*.idx $(TABLES)/*.toc $(TABLES)/*.out $(TABLES)/*~ $(TABLES)/*.nlo $(TABLES)/*.nls $(TABLES)/*.ist $(TABLES)/*.ilg $(TABLES)/*.nav $(TABLES)/*.snm
rm -f $(APPENDICESDIR)/*.log $(APPENDICESDIR)/*.bak $(APPENDICESDIR)/*.aux $(APPENDICESDIR)/*.bbl $(APPENDICESDIR)/*.blg $(APPENDICESDIR)/*.idx $(APPENDICESDIR)/*.toc $(APPENDICESDIR)/*.out $(APPENDICESDIR)/*~ $(APPENDICESDIR)/*.nlo $(APPENDICESDIR)/*.nls $(APPENDICESDIR)/*.ist $(APPENDICESDIR)/*.ilg $(APPENDICESDIR)/*.nav $(APPENDICESDIR)/*.snm
# Clean all temporary resource files created during compilation and delete the latex output.
clean-all:
rm -f *.dvi *.log *.bak *.aux *.bbl *.blg *.idx *.ps *.eps *.pdf *.toc *.out *~ *.lof *.lot *.nlo *.nls *.ist *.ilg *.nav *.snm
rm -f $(CHAPTERSDIR)/*.dvi $(CHAPTERSDIR)/*.log $(CHAPTERSDIR)/*.bak $(CHAPTERSDIR)/*.aux $(CHAPTERSDIR)/*.bbl $(CHAPTERSDIR)/*.blg $(CHAPTERSDIR)/*.idx $(CHAPTERSDIR)/*.ps $(CHAPTERSDIR)/*.eps $(CHAPTERSDIR)/*.pdf $(CHAPTERSDIR)/*.toc $(CHAPTERSDIR)/*.out $(CHAPTERSDIR)/*~ $(CHAPTERSDIR)/*.nlo $(CHAPTERSDIR)/*.nls $(CHAPTERSDIR)/*.ist $(CHAPTERSDIR)/*.ilg $(CHAPTERSDIR)/*.nav $(CHAPTERSDIR)/*.snm
rm -f $(TABLES)/*.dvi $(TABLES)/*.log $(TABLES)/*.bak $(TABLES)/*.aux $(TABLES)/*.bbl $(TABLES)/*.blg $(TABLES)/*.idx $(TABLES)/*.ps $(TABLES)/*.eps $(TABLES)/*.pdf $(TABLES)/*.toc $(TABLES)/*.out $(TABLES)/*~ $(TABLES)/*.nlo $(TABLES)/*.nls $(TABLES)/*.ist $(TABLES)/*.ilg $(TABLES)/*.nav $(TABLES)/*.snm
rm -f $(APPENDICESDIR)/*.dvi $(APPENDICESDIR)/*.log $(APPENDICESDIR)/*.bak $(APPENDICESDIR)/*.aux $(APPENDICESDIR)/*.bbl $(APPENDICESDIR)/*.blg $(APPENDICESDIR)/*.idx $(APPENDICESDIR)/*.ps $(APPENDICESDIR)/*.eps $(APPENDICESDIR)/*.pdf $(APPENDICESDIR)/*.toc $(APPENDICESDIR)/*.out $(APPENDICESDIR)/*~ $(APPENDICESDIR)/*.nlo $(APPENDICESDIR)/*.nls $(APPENDICESDIR)/*.ist $(APPENDICESDIR)/*.ilg $(APPENDICESDIR)/*.nav $(APPENDICESDIR)/*.snm
# When using vim-latexsuite it adds annoying <++> symbols, this removes that shit from all .tex files
# by calling the predefined command above.
clean-eqs:
$(CLEANEQS)