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