-
Notifications
You must be signed in to change notification settings - Fork 66
/
Makefile
109 lines (85 loc) · 2.99 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
## please modify the following line for naming the end products (PDFs, ZIPs, ...)
PROJECTNAME = "Projectname"
## -----------------------------------------
## DO NOT EDIT BELOW THIS LINE
## -----------------------------------------
## Makefile von Karl Voit ([email protected])
## some Makefile-hints taken from:
## http://www.ctan.org/tex-archive/help/uk-tex-faq/Makefile
MAINDOCUMENTBASENAME = main
MAINDOCUMENTFILENAME = ${MAINDOCUMENTBASENAME}.tex
## COMMANDS:
PDFLATEX_CMD = pdflatex
#BIBTEX_CMD = bibtex
BIBTEX_CMD = biber
MAKEIDX_CMD = makeindex
DATESTAMP = `/bin/date +%Y-%m-%d`
DATESTAMP_AND_PROJECT = ${DATESTAMP}_${PROJECTNAME}
#PDFVIEWER = xpdf
PDFVIEWER = acroread
TEMPLATEDOCUBASENAME = Template-Documentation
TEMPLATEDOCUFILE = ${TEMPLATEDOCUBASENAME}.tex
#help
#helpThe main targets of this Makefile are:
#help help this help
.PHONY: help
help:
@sed -n 's/^#help//p' < Makefile
#help all see "pdf"
.PHONY: all
all: pdf
#help pdf creates a pdf file using pdflatex
.PHONY: pdf
pdf:
${PDFLATEX_CMD} ${MAINDOCUMENTFILENAME}
-${BIBTEX_CMD} ${MAINDOCUMENTBASENAME}
${PDFLATEX_CMD} ${MAINDOCUMENTFILENAME}
${PDFLATEX_CMD} ${MAINDOCUMENTFILENAME}
-mv ${MAINDOCUMENTBASENAME}.pdf ${DATESTAMP_AND_PROJECT}.pdf
#help wc counts the words from the PDF generated
wc: pdf
pdftops ${DATESTAMP_AND_PROJECT}.pdf
ps2ascii ${DATESTAMP_AND_PROJECT}.ps > ${DATESTAMP_AND_PROJECT}.txt
wc -w ${DATESTAMP_AND_PROJECT}.txt
# --------------------------------------------------------
#help view view the PDF-file
.PHONY: view
view: pdf
${PDFVIEWER} ${DATESTAMP_AND_PROJECT}.pdf
# --------------------------------------------------------
#help clean clean up temporary files
.PHONY: clean
clean:
-rm -r *.bcf *.run.xml _*_.* *~ *.aux *-blx.bib *.bbl ${MAINDOCUMENTBASENAME}.dvi *.ps *.blg *.idx *.ilg *.ind *.toc *.log *.log *.brf *.out *.lof *.lot *.gxg *.glx *.gxs *.glo *.gls *.tdo -f
#help purge cleaner than clean ;-)
.PHONY: purge
purge: clean
-rm 20*.pdf *.ps -f
#help force force rebuild next run
.PHONY: force
force:
touch *tex
# TOOLS:
#help zip create ZIP-file
.PHONY: zip
zip: purge pdf clean
zip -r ../${PROJECTNAME}_${TIMESTAMP}.zip *
.PHONY: publish
publish: templatedocu pdf clean
-rm 20*.pdf ${TEMPLATEDOCUFILE} -f
git status
#help templatedocu updates tex-files for the documentation of this template
#help needs: echo, sed, grep
.PHONY: templatedocu
templatedocu:
grep "%doc%" template/preamble.tex | sed 's/^.*%doc% //' > ${TEMPLATEDOCUFILE}
grep "%doc%" template/mycommands.tex | sed 's/^.*%doc% //' >> ${TEMPLATEDOCUFILE}
grep "%doc%" template/typographic_settings.tex | sed 's/^.*%doc% //' >> ${TEMPLATEDOCUFILE}
grep "%doc%" template/pdf_settings.tex | sed 's/^.*%doc% //' >> ${TEMPLATEDOCUFILE}
echo "%%---------------------------------------%%" >>${TEMPLATEDOCUFILE}
printf '%s\n' "\printbibliography\end{document}" >>${TEMPLATEDOCUFILE}
${PDFLATEX_CMD} ${TEMPLATEDOCUFILE}
${PDFLATEX_CMD} ${TEMPLATEDOCUFILE}
${BIBTEX_CMD} ${TEMPLATEDOCUBASENAME}
${PDFLATEX_CMD} ${TEMPLATEDOCUFILE}
#end