1 | # Configuration variables
|
---|
2 |
|
---|
3 | Build = build
|
---|
4 |
|
---|
5 | Benchmarks = benchmarks
|
---|
6 | Pictures = pictures
|
---|
7 | Plots = plots
|
---|
8 | Programs = programs
|
---|
9 |
|
---|
10 | LaTMac = ../../LaTeXmacros
|
---|
11 | BibRep = ../../bibliography
|
---|
12 |
|
---|
13 | TeXSRC = ${wildcard *.tex}
|
---|
14 | PicSRC = ${notdir ${wildcard ${Pictures}/*.png}} ${notdir ${wildcard ${Pictures}/*.fig}}
|
---|
15 | PicSRC := ${PicSRC:.fig=.pdf} # substitute ".fig" with ".pdf"
|
---|
16 | PlotSRC = ${notdir ${wildcard ${Plots}/*.gp}}
|
---|
17 | PlotSRC := ${addprefix ${Build}/plot-,${PlotSRC:.gp=.pdf}} # substitute ".gp" with ".pdf"
|
---|
18 | DemoPgmSRC = ${notdir ${wildcard ${Programs}/*-demo.cfa}}
|
---|
19 | PgmSRC = ${notdir ${wildcard ${Programs}/*}}
|
---|
20 | RunPgmSRC = ${notdir ${wildcard ${Programs}/*.run.*}}
|
---|
21 | BibSRC = ${wildcard *.bib}
|
---|
22 |
|
---|
23 | TeXLIB = .:${LaTMac}:${Build}: # common latex macros
|
---|
24 | BibLIB = .:${BibRep}: # common citation repository
|
---|
25 |
|
---|
26 | #MAKEFLAGS = --no-print-directory # --silent
|
---|
27 | VPATH = ${Build} ${Pictures} ${Programs} # extra search path for file names used in document
|
---|
28 |
|
---|
29 | DOCUMENT = uw-ethesis.pdf
|
---|
30 | BASE = ${basename ${DOCUMENT}} # remove suffix
|
---|
31 |
|
---|
32 | RunPgmExe = ${addprefix ${Build}/,${basename ${basename ${RunPgmSRC}}}}
|
---|
33 | RunPgmOut = ${RunPgmExe:%=%.out}
|
---|
34 | DemoPgmExe = ${addprefix ${Build}/,${basename ${basename ${DemoPgmSRC}}}}
|
---|
35 | DemoPgmOut = ${DemoPgmExe:%=%.out}
|
---|
36 |
|
---|
37 | # Commands
|
---|
38 |
|
---|
39 | LaTeX = TEXINPUTS=${TeXLIB} && export TEXINPUTS && pdflatex -halt-on-error -output-directory=${Build}
|
---|
40 | BibTeX = BIBINPUTS=${BibLIB} && export BIBINPUTS && bibtex
|
---|
41 | CFA = cfa -O0 -g
|
---|
42 | CC = gcc -O0 -g
|
---|
43 | CXX = g++-11 --std=c++20 -O0 -g
|
---|
44 |
|
---|
45 | # Rules and Recipes
|
---|
46 |
|
---|
47 | .PHONY : all clean # not file names
|
---|
48 | .SECONDARY:
|
---|
49 | #.PRECIOUS : ${Build}/% # don't delete intermediates
|
---|
50 | .ONESHELL :
|
---|
51 |
|
---|
52 | all : ${DOCUMENT}
|
---|
53 |
|
---|
54 | clean :
|
---|
55 | @rm -frv ${DOCUMENT} ${Build}
|
---|
56 |
|
---|
57 | # File Dependencies
|
---|
58 |
|
---|
59 | ${DOCUMENT}: ${TeXSRC} $(RunPgmOut) ${DemoPgmOut} ${PlotSRC} ${PicSRC} ${BibSRC} ${BibRep}/pl.bib ${LaTMac}/common.tex Makefile | ${Build}
|
---|
60 | echo ${PicSRC}
|
---|
61 | echo ${GraphSRC_OLD}
|
---|
62 | ${LaTeX} ${BASE}
|
---|
63 | ${BibTeX} ${Build}/${BASE}
|
---|
64 | ${LaTeX} ${BASE}
|
---|
65 | # if needed, run latex again to get citations
|
---|
66 | if fgrep -s "LaTeX Warning: Citation" ${basename $@}.log ; then ${LaTeX} ${BASE} ; fi
|
---|
67 | # ${Glossary} ${Build}/${BASE}
|
---|
68 | # ${LaTeX} ${BASE}
|
---|
69 | cp ${Build}/$@ $@
|
---|
70 |
|
---|
71 | ${Build}:
|
---|
72 | mkdir -p $@
|
---|
73 |
|
---|
74 | ${Build}/%-demo: ${Programs}/%-demo.cfa | ${Build}
|
---|
75 | ${CFA} $< -o $@
|
---|
76 |
|
---|
77 | ${Build}/%: ${Programs}/%-demo.cfa | ${Build}
|
---|
78 | ${CFA} $< -o $@
|
---|
79 |
|
---|
80 | ${Build}/%: ${Programs}/%.run.cfa | ${Build} # cfa cannot handle pipe
|
---|
81 | sed -f ${Programs}/sedcmd $< > ${Build}/tmp.cfa; ${CFA} ${Build}/tmp.cfa -o $@
|
---|
82 |
|
---|
83 | ${Build}/%: ${Programs}/%.run.c | ${Build}
|
---|
84 | sed -f ${Programs}/sedcmd $< | ${CC} -x c -I ${Programs} -o $@ -
|
---|
85 |
|
---|
86 | ${Build}/%: ${Programs}/%.run.cpp | ${Build}
|
---|
87 | sed -f ${Programs}/sedcmd $< | ${CXX} -x c++ -I ${Programs} -o $@ -
|
---|
88 |
|
---|
89 | ${Build}/%.out: ${Build}/% | ${Build}
|
---|
90 | $< > $@
|
---|
91 |
|
---|
92 | %.pdf: %.fig | ${Build}
|
---|
93 | fig2dev -L pdf $< > ${Build}/$@
|
---|
94 |
|
---|
95 | -include $(Plots)/*.d
|
---|
96 |
|
---|
97 | ${Build}/plot-%.dat: ${Plots}/%.py ${Plots}/common.py ${Plots}/ListCommon.py ${Plots}/%.py.INPUTS | ${Build}
|
---|
98 | python3 $< > $@
|
---|
99 |
|
---|
100 | ${Build}/plot-%.pdf: ${Plots}/%.gp ${Plots}/%.gp.INPUTS | ${Build}
|
---|
101 | gnuplot $<
|
---|
102 |
|
---|
103 | #-include ${Build}/*.d
|
---|
104 |
|
---|
105 |
|
---|
106 | # troubleshooting, e.g. `make echo_DEMOS` runs `echo $(DEMOS)`
|
---|
107 | echo_% :
|
---|
108 | @echo '$($(@:echo_%=%))'
|
---|
109 |
|
---|