source: doc/theses/mike_brooks_MMath/Makefile @ daf4c89

Last change on this file since daf4c89 was 5717495, checked in by Michael Brooks <mlbrooks@…>, 20 months ago

Start of the linked-list chapter.

  • Property mode set to 100644
File size: 2.0 KB
Line 
1# Configuration variables
2
3Build = build
4Pictures = pictures
5Programs = programs
6
7TeXSRC = ${wildcard *.tex}
8PicSRC = ${notdir ${wildcard ${Pictures}/*.png}}
9DemoSRC = ${notdir ${wildcard ${Programs}/*-demo.cfa}}
10PgmSRC = ${notdir ${wildcard ${Programs}/*}}
11RunPgmSRC = ${notdir ${wildcard ${Programs}/*.run.*}}
12BibSRC = ${wildcard *.bib}
13
14TeXLIB = .:../../LaTeXmacros:${Build}:          # common latex macros
15BibLIB = .:../../bibliography                   # common citation repository
16
17#MAKEFLAGS = --no-print-directory # --silent
18VPATH = ${Build} ${Pictures} ${Programs} # extra search path for file names used in document
19
20DOCUMENT = uw-ethesis.pdf
21BASE = ${basename ${DOCUMENT}}                  # remove suffix
22
23DemoTex = ${DemoSRC:%.cfa=${Build}/%.tex} 
24RunPgmExe = ${addprefix ${Build}/,${basename ${basename ${RunPgmSRC}}}}
25RunPgmOut = ${RunPgmExe:%=%.out}
26
27# Commands
28
29LaTeX = TEXINPUTS=${TeXLIB} && export TEXINPUTS && pdflatex -halt-on-error -output-directory=${Build}
30BibTeX = BIBINPUTS=${BibLIB} && export BIBINPUTS && bibtex
31CFA = cfa -O0 -g
32CC  = gcc -O0 -g
33CXX = g++-11 --std=c++20 -O0 -g
34
35# Rules and Recipes
36
37.PHONY : all fragments_ran clean                        # not file names
38.PRECIOUS : ${Build}/% ${Build}/%-demo      # don't delete intermediates
39.ONESHELL :
40
41all : fragments_ran ${DOCUMENT}
42
43fragments_ran : $(RunPgmOut)
44
45clean :
46        @rm -frv ${DOCUMENT} ${Build}
47
48# File Dependencies
49
50%.pdf : ${TeXSRC} ${DemoTex} ${PicSRC} ${PgmSRC} ${BibSRC} Makefile | ${Build}
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}
58        cp ${Build}/$@ $@
59
60${Build}:
61        mkdir -p $@
62
63%-demo.tex: %-demo | ${Build}
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 $@
77
78${Build}/%.out: ${Build}/% | ${Build}
79        $< > $@
80
81-include ${Build}/*.d
Note: See TracBrowser for help on using the repository browser.