forked from cpfaff/Open-Science-Thesis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
209 lines (164 loc) · 6.82 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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
##------------------------------------------------------------------------------------##
##------------------------------------------------------------------------------------##
## Content: Open-Science-Thesis LaTeX-Makefile
## Usage: Compile Open-Science-Theses
## Author: Claas-Thido Pfaff
##------------------------------------------------------------------------------------##
##------------------------------------------------------------------------------------##
# Maindocument
DOCUMENT = open_science_thesis
# Dependencies maindocument
DEPENDENCIES = $(DOCUMENT).Rnw ost/subdocuments/*.cls usr/subdocuments/bibliography/*.bib usr/subdocuments/chapters/* usr/subdocuments/options/* ost/data/*.csv
# Programs used
KNITR = knit
BIBTEX = biber
COMPILER = pdflatex -interaction=nonstopmode
# The Open-Science-Thesis is prepared for Lua-LaTeX if you prefer it. Just comment out pdflatex and comment in lualatex as compiler
# COMPILER = lualatex
PACKER= tar -czf
REMOVER = @-rm -r
PRINTER = @-echo
GREPPER = @-grep
RIGHTSETTER = @-chmod
COPY = @-cp -r
PDFVIEWER = okular
DATE = $(shell date +%y%m%d)
GLOSSARYINDEXER = makeglossaries
# Example and Empty files
SUBDOCFOLDER = usr/subdocuments/
EXMPLDOCS = ost/subdocuments/exmpl/bibliography/ ost/subdocuments/exmpl/chapters/ ost/subdocuments/exmpl/options/
TEMPDOCS = ost/subdocuments/temp/bibliography/ ost/subdocuments/temp/chapters/ ost/subdocuments/temp/options/
TEMPREADME = ost/subdocuments/temp/README.md
EXMPLREADME = ost/subdocuments/exmpl/README.md
# Base folder
BASEFOLDER = `pwd`
# Git hooks
HOOKSOURCE = ost/data/ostGitHook
GITHOOKPATH = .git/hooks
HOOKRIGHTS = 744
# Archive document
ARCHNAME = $(DOCUMENT)_$(DATE).tar.gz
ARCHFILES = $(DOCUMENT).pdf $(DOCUMENT).Rnw ost/ usr/ makefile
# Clean up the document folder
CLEANFILES = usr/graphics/dynamic/* *.gin usr/cache/* *.xdy *tikzDictionary *.idx *.mtc* *.glo *.maf *.ptc *.tikz *.lot *.dpth *.figlist *.dep *.log *.makefile *.out *.map *.tex *.toc *.aux *.tmp *.bbl *.blg *.lof *.acn *.acr *.alg *.mw *.tdo *.glg *.gls *.ilg *.ind *.ist *.slg *.syg *.syi *.acn *.dvi *.ist *.syg *.synctex.gz *.bcf *.run.xml *-blx.bib *.txt
# Default rule
all: $(DOCUMENT).pdf
$(DOCUMENT).pdf: $(DEPENDENCIES)
$(KNITR) $(DOCUMENT).Rnw $(DOCUMENT).tex --no-convert
$(COMPILER) $(DOCUMENT).tex
$(COMPILER) $(DOCUMENT).tex
$(BIBTEX) $(DOCUMENT)
$(COMPILER) $(DOCUMENT).tex
gloss:
$(COMPILER) $(DOCUMENT).tex
$(GLOSSARYINDEXER) $(DOCUMENT)
$(COMPILER) $(DOCUMENT).tex
$(GLOSSARYINDEXER) $(DOCUMENT)
$(COMPILER) $(DOCUMENT).tex
allgloss:
$(KNITR) $(DOCUMENT).Rnw $(DOCUMENT).tex --no-convert
$(COMPILER) $(DOCUMENT).tex
$(COMPILER) $(DOCUMENT).tex
$(BIBTEX) $(DOCUMENT)
$(COMPILER) $(DOCUMENT).tex
$(GLOSSARYINDEXER) $(DOCUMENT)
$(COMPILER) $(DOCUMENT).tex
$(GLOSSARYINDEXER) $(DOCUMENT)
$(COMPILER) $(DOCUMENT).tex
# Initproject
# It usese the R package ProjectTemplate to create a Project inside the
# usr/statistics folder. The Template offers a nice and clean folder structure
# and services for your analyses. For more information see the projects
# homepage.
initrproject:
# Works only with R package "Project Template" installed
rm -rf usr/statistics/rproject
Rscript -e "library(ProjectTemplate); create.project('usr/statistics/rproject')"
# Buildserver
# It is a continous integration service for your Open-Science-Thesis document.
# You can start it by issuing the task below. It starts a server that tracks
# changes in the directory and rebuilds your document to pdf.
continous:
# needs ruby and gem fssm
ruby ost/server/buildserver.rb
# latexmk -pvc -pdf -interaction=nonstopmode $(DOCUMENT).tex
# Showpdf
# Simply calls the PDF viewer defined under pgrogams to schow you the created
# PDF file.
showpdf:
$(PDFVIEWER) $(DOCUMENT).pdf &
# Warnings
# Extracts warning messages from the LaTeX log files to display them nicely for
# inspection.
warnings:
$(PRINTER) "----------------------------------------------------o"
$(PRINTER) "Multiple defined lables!"
$(PRINTER) ""
$(GREPPER) 'multiply defined' $(DOCUMENT).log
$(PRINTER) "----------------------------------------------------o"
$(PRINTER) "Undefined lables!"
$(PRINTER) ""
$(GREPPER) 'undefined' $(DOCUMENT).log
$(PRINTER) "----------------------------------------------------o"
$(PRINTER) "Warnings!"
$(PRINTER) ""
$(GREPPER) 'Warning' $(DOCUMENT).log
$(PRINTER) "----------------------------------------------------o"
$(PRINTER) "Over- and Underfull boxes!"
$(PRINTER) ""
$(GREPPER) 'Overfull' $(DOCUMENT).log
$(GREPPER) 'Underfull' $(DOCUMENT).log
$(PRINTER) "----------------------------------------------------o"
# Clean
# Cleans the document from generated files. This taks is called automatically
# before backing up the document.
clean:
$(REMOVER) $(CLEANFILES)
# Archive
# Backup of the document. It creates a archive with all files inside it to
# reproduce the document.
archive:
make clean
$(PACKER) $(ARCHNAME) $(ARCHFILES)
# Example and Temps content
# The tasks for example and temp content can be used switch between an empty
# and a document with examples. This is useful as the Open-Science-Thesis comes
# usually filled with example content to show you how things work. If you are
# already familiar with LaTeX and onyly want to have an empty document to start
# with you can just issue eht "tmpdoc" task below. If you like to remove the
# content from the GitHub readme file you can use the "rmpreadme" task instead.
# The original exmaple contens can be restored with the "exmpl*" tasks but
# NOTE: This overwrites your files.
# exmpldoc:
# $(COPY) $(EXMPLDOCS) $(SUBDOCFOLDER)
# exmplreadme:
# $(COPY) $(EXMPLREADME) $(BASEFOLDER)
# tmpdoc:
# $(COPY) $(TEMPDOCS) $(SUBDOCFOLDER)
# tmpreadme:
# $(COPY) $(TEMPREADME) $(BASEFOLDER)
# set-/rmgithooks
# The set task creates the githooks required to display github information
# inside of your PDF. If you do no longer need the hooks you can also remove
# them with the rmgithooks task.
setgithooks:
$(COPY) $(HOOKSOURCE) $(GITHOOKPATH)/post-checkout
$(COPY) $(HOOKSOURCE) $(GITHOOKPATH)/post-commit
$(COPY) $(HOOKSOURCE) $(GITHOOKPATH)/post-merge
$(RIGHTSETTER) $(HOOKRIGHTS) $(GITHOOKPATH)/*
rmgithooks:
$(REMOVER) $(GITHOOKPATH)/post-checkout
$(REMOVER) $(GITHOOKPATH)/post-commit
$(REMOVER) $(GITHOOKPATH)/post-merge
# Prep
# As the name suggest this is for preparation purposes and should be used for
# development only. It helps me to put all stuff where I need it for example
# and temp content.
prep:
# This is a development only task
$(COPY) usr/subdocuments/* ost/subdocuments/exmpl/
$(COPY) README.md ost/subdocuments/exmpl/
$(COPY) usr/subdocuments/options/ ost/subdocuments/temp/
# Installers (this package is not maintained at the moment but works well so far)
installtikzdev:
Rscript -e "install.packages('tikzDevice', repos='http://R-Forge.R-project.org')"