1 | # Configuration variables
|
---|
2 |
|
---|
3 | Build = build
|
---|
4 | Pictures = pictures
|
---|
5 | Programs = programs
|
---|
6 |
|
---|
7 | LaTMac = ../../LaTeXmacros
|
---|
8 | BibRep = ../../bibliography
|
---|
9 |
|
---|
10 | TeXSRC = ${wildcard *.tex}
|
---|
11 | PicSRC = ${notdir ${wildcard ${Pictures}/*.png}}
|
---|
12 | DemoSRC = ${notdir ${wildcard ${Programs}/*-demo.cfa}}
|
---|
13 | PgmSRC = ${notdir ${wildcard ${Programs}/*}}
|
---|
14 | RunPgmSRC = ${notdir ${wildcard ${Programs}/*.run.*}}
|
---|
15 | BibSRC = ${wildcard *.bib}
|
---|
16 |
|
---|
17 | TeXLIB = .:${LaTMac}:${Build}: # common latex macros
|
---|
18 | BibLIB = .:${BibRep}: # common citation repository
|
---|
19 |
|
---|
20 | #MAKEFLAGS = --no-print-directory # --silent
|
---|
21 | VPATH = ${Build} ${Pictures} ${Programs} # extra search path for file names used in document
|
---|
22 |
|
---|
23 | DOCUMENT = uw-ethesis.pdf
|
---|
24 | BASE = ${basename ${DOCUMENT}} # remove suffix
|
---|
25 |
|
---|
26 | DemoTex = ${DemoSRC:%.cfa=${Build}/%.tex}
|
---|
27 | RunPgmExe = ${addprefix ${Build}/,${basename ${basename ${RunPgmSRC}}}}
|
---|
28 | RunPgmOut = ${RunPgmExe:%=%.out}
|
---|
29 |
|
---|
30 | # Commands
|
---|
31 |
|
---|
32 | LaTeX = TEXINPUTS=${TeXLIB} && export TEXINPUTS && pdflatex -halt-on-error -output-directory=${Build}
|
---|
33 | BibTeX = BIBINPUTS=${BibLIB} && export BIBINPUTS && bibtex
|
---|
34 | CFA = cfa -O0 -g
|
---|
35 | CC = gcc -O0 -g
|
---|
36 | CXX = g++-11 --std=c++20 -O0 -g
|
---|
37 |
|
---|
38 | # Rules and Recipes
|
---|
39 |
|
---|
40 | .PHONY : all fragments_ran clean # not file names
|
---|
41 | .PRECIOUS : ${Build}/% ${Build}/%-demo # don't delete intermediates
|
---|
42 | .ONESHELL :
|
---|
43 |
|
---|
44 | all : fragments_ran ${DOCUMENT}
|
---|
45 |
|
---|
46 | fragments_ran : $(RunPgmOut)
|
---|
47 |
|
---|
48 | clean :
|
---|
49 | @rm -frv ${DOCUMENT} ${Build}
|
---|
50 |
|
---|
51 | # File Dependencies
|
---|
52 |
|
---|
53 | %.pdf : ${TeXSRC} ${DemoTex} ${PicSRC} ${PgmSRC} ${BibSRC} ${BibRep}/pl.bib ${LaTMac}/common.tex Makefile | ${Build}
|
---|
54 | ${LaTeX} ${BASE}
|
---|
55 | ${BibTeX} ${Build}/${BASE}
|
---|
56 | ${LaTeX} ${BASE}
|
---|
57 | # if needed, run latex again to get citations
|
---|
58 | if fgrep -s "LaTeX Warning: Citation" ${basename $@}.log ; then ${LaTeX} ${BASE} ; fi
|
---|
59 | # ${Glossary} ${Build}/${BASE}
|
---|
60 | # ${LaTeX} ${BASE}
|
---|
61 | cp ${Build}/$@ $@
|
---|
62 |
|
---|
63 | ${Build}:
|
---|
64 | mkdir -p $@
|
---|
65 |
|
---|
66 | %-demo.tex: %-demo | ${Build}
|
---|
67 | $< > $@
|
---|
68 |
|
---|
69 | ${Build}/%-demo: ${Programs}/%-demo.cfa | ${Build}
|
---|
70 | ${CFA} $< -o $@
|
---|
71 |
|
---|
72 | ${Build}/%: ${Programs}/%.run.cfa | ${Build} # cfa cannot handle pipe
|
---|
73 | sed -f ${Programs}/sedcmd $< > ${Build}/tmp.cfa; ${CFA} ${Build}/tmp.cfa -o $@
|
---|
74 |
|
---|
75 | ${Build}/%: ${Programs}/%.run.c | ${Build}
|
---|
76 | sed -f ${Programs}/sedcmd $< | ${CC} -x c -I ${Programs} -o $@ -
|
---|
77 |
|
---|
78 | ${Build}/%: ${Programs}/%.run.cpp | ${Build}
|
---|
79 | sed -f ${Programs}/sedcmd $< | ${CXX} -x c++ -I ${Programs} -o $@ -
|
---|
80 |
|
---|
81 | ${Build}/%.out: ${Build}/% | ${Build}
|
---|
82 | $< > $@
|
---|
83 |
|
---|
84 | -include ${Build}/*.d
|
---|