| 1 | ## Define the configuration variables.
|
|---|
| 2 |
|
|---|
| 3 | Build = build
|
|---|
| 4 | Figures = figures
|
|---|
| 5 | Macros = ../../LaTeXmacros
|
|---|
| 6 | TeXLIB = .:style:text:${Macros}:${Build}:../../bibliography:
|
|---|
| 7 | LaTeX = TEXINPUTS=${TeXLIB} && export TEXINPUTS && latex -halt-on-error -output-directory=${Build}
|
|---|
| 8 | BibTeX = BIBINPUTS=${TeXLIB} && export BIBINPUTS && bibtex -terse
|
|---|
| 9 |
|
|---|
| 10 | MAKEFLAGS = --no-print-directory --silent #
|
|---|
| 11 | VPATH = ${Build} ${Figures}
|
|---|
| 12 |
|
|---|
| 13 | ## Define the text source files.
|
|---|
| 14 |
|
|---|
| 15 | SOURCES = ${addsuffix .tex, \
|
|---|
| 16 | thesis \
|
|---|
| 17 | }
|
|---|
| 18 |
|
|---|
| 19 | FIGURES = ${addsuffix .tex, \
|
|---|
| 20 | }
|
|---|
| 21 |
|
|---|
| 22 | PICTURES = ${addsuffix .pstex, \
|
|---|
| 23 | }
|
|---|
| 24 |
|
|---|
| 25 | PROGRAMS = ${addsuffix .tex, \
|
|---|
| 26 | }
|
|---|
| 27 |
|
|---|
| 28 | GRAPHS = ${addsuffix .tex, \
|
|---|
| 29 | }
|
|---|
| 30 |
|
|---|
| 31 | ## Define the documents that need to be made.
|
|---|
| 32 |
|
|---|
| 33 | DOCUMENT = thesis.pdf
|
|---|
| 34 | BASE = ${basename ${DOCUMENT}}
|
|---|
| 35 |
|
|---|
| 36 | # Directives #
|
|---|
| 37 |
|
|---|
| 38 | .PHONY : all clean # not file names
|
|---|
| 39 |
|
|---|
| 40 | all : ${DOCUMENT}
|
|---|
| 41 |
|
|---|
| 42 | clean :
|
|---|
| 43 | @rm -frv ${DOCUMENT} ${BASE}.ps ${Build}
|
|---|
| 44 |
|
|---|
| 45 | # File Dependencies #
|
|---|
| 46 |
|
|---|
| 47 | ${DOCUMENT} : ${BASE}.ps
|
|---|
| 48 | ps2pdf $<
|
|---|
| 49 |
|
|---|
| 50 | ${BASE}.ps : ${BASE}.dvi
|
|---|
| 51 | dvips ${Build}/$< -o $@
|
|---|
| 52 |
|
|---|
| 53 | ${BASE}.dvi : Makefile ${GRAPHS} ${PROGRAMS} ${PICTURES} ${FIGURES} ${SOURCES} \
|
|---|
| 54 | ${Macros}/common.tex ${Macros}/indexstyle local.bib ../../bibliography/pl.bib | ${Build}
|
|---|
| 55 | # Must have *.aux file containing citations for bibtex
|
|---|
| 56 | if [ ! -r ${basename $@}.aux ] ; then ${LaTeX} ${basename $@}.tex ; fi
|
|---|
| 57 | -${BibTeX} ${Build}/${basename $@}
|
|---|
| 58 | # Some citations reference others so run again to resolve these citations
|
|---|
| 59 | ${LaTeX} ${basename $@}.tex
|
|---|
| 60 | -${BibTeX} ${Build}/${basename $@}
|
|---|
| 61 | # Make index from *.aux entries and input index at end of document
|
|---|
| 62 | makeglossaries -q -s ${Build}/${basename $@}.ist ${Build}/${basename $@}
|
|---|
| 63 | -version.sh
|
|---|
| 64 | # Run again to finish citations
|
|---|
| 65 | ${LaTeX} ${basename $@}.tex
|
|---|
| 66 |
|
|---|
| 67 | ## Define the default recipes.
|
|---|
| 68 |
|
|---|
| 69 | ${Build}:
|
|---|
| 70 | mkdir -p ${Build}
|
|---|
| 71 |
|
|---|
| 72 | %.tex : %.fig ${Build}
|
|---|
| 73 | fig2dev -L eepic $< > ${Build}/$@
|
|---|
| 74 |
|
|---|
| 75 | %.ps : %.fig | ${Build}
|
|---|
| 76 | fig2dev -L ps $< > ${Build}/$@
|
|---|
| 77 |
|
|---|
| 78 | %.pstex : %.fig | ${Build}
|
|---|
| 79 | fig2dev -L pstex $< > ${Build}/$@
|
|---|
| 80 | fig2dev -L pstex_t -p ${Build}/$@ $< > ${Build}/$@_t
|
|---|
| 81 |
|
|---|
| 82 | #-----------------------------------------------------------------------------------
|
|---|
| 83 | # Tools to generate png files
|
|---|
| 84 | # to create a png we create a pdf and convert it to png
|
|---|
| 85 | %.png : build/%.pstex figures/%.tex ${Build}
|
|---|
| 86 | echo ${basename $@}
|
|---|
| 87 | ${LaTeX} figures/${basename $@}.tex
|
|---|
| 88 | dvips build/${basename $@}.dvi -o build/${basename $@}.ps
|
|---|
| 89 | ps2pdf build/${basename $@}.ps
|
|---|
| 90 | convert -negate ${basename $@}.pdf $@
|
|---|
| 91 |
|
|---|
| 92 | # creating a pdf of a figure requires generating some latex that just includes the figure
|
|---|
| 93 | figures/%.tex: build/%.pstex ${Build}
|
|---|
| 94 | echo -n "\documentclass[preview]{standalone}\n" \
|
|---|
| 95 | "\usepackage[T1]{fontenc}\n" \
|
|---|
| 96 | "\usepackage[usenames]{color}\n" \
|
|---|
| 97 | "\usepackage{graphicx}\n" \
|
|---|
| 98 | "\usepackage{listings}\n" \
|
|---|
| 99 | "\usepackage{xspace}\n" \
|
|---|
| 100 | "\input{style}\n" \
|
|---|
| 101 | "\\\\begin{document}\n" \
|
|---|
| 102 | "{\\\\resizebox{3\\\\textwidth}{!}{\input{${basename ${notdir $@}}.pstex_t}}}\n" \
|
|---|
| 103 | "\end{document}" > $@
|
|---|
| 104 |
|
|---|
| 105 | # Local Variables: #
|
|---|
| 106 | # compile-command: "make" #
|
|---|
| 107 | # End: #
|
|---|