source: doc/theses/mike_brooks_MMath/Makefile @ d414664

Last change on this file since d414664 was b64d0f4, checked in by Peter A. Buhr <pabuhr@…>, 4 months ago

second attempt changing program-input style

  • Property mode set to 100644
File size: 2.2 KB
RevLine 
[bbf6a180]1# Configuration variables
[8e819a9]2
[bbf6a180]3Build = build
4Pictures = pictures
5Programs = programs
[8e819a9]6
[bbf6a180]7TeXSRC = ${wildcard *.tex}
8PicSRC = ${notdir ${wildcard ${Pictures}/*.png}}
9DemoSRC = ${notdir ${wildcard ${Programs}/*-demo.cfa}}
[5717495]10PgmSRC = ${notdir ${wildcard ${Programs}/*}}
11RunPgmSRC = ${notdir ${wildcard ${Programs}/*.run.*}}
[bbf6a180]12BibSRC = ${wildcard *.bib}
[8e819a9]13
[bbf6a180]14TeXLIB = .:../../LaTeXmacros:${Build}:          # common latex macros
15BibLIB = .:../../bibliography                   # common citation repository
[8e819a9]16
[5717495]17#MAKEFLAGS = --no-print-directory # --silent
[bbf6a180]18VPATH = ${Build} ${Pictures} ${Programs} # extra search path for file names used in document
[8e819a9]19
[bbf6a180]20DOCUMENT = uw-ethesis.pdf
21BASE = ${basename ${DOCUMENT}}                  # remove suffix
[8e819a9]22
[5717495]23DemoTex = ${DemoSRC:%.cfa=${Build}/%.tex} 
24RunPgmExe = ${addprefix ${Build}/,${basename ${basename ${RunPgmSRC}}}}
25RunPgmOut = ${RunPgmExe:%=%.out}
26
[bbf6a180]27# Commands
[8e819a9]28
[bbf6a180]29LaTeX = TEXINPUTS=${TeXLIB} && export TEXINPUTS && pdflatex -halt-on-error -output-directory=${Build}
30BibTeX = BIBINPUTS=${BibLIB} && export BIBINPUTS && bibtex
[5717495]31CFA = cfa -O0 -g
32CC  = gcc -O0 -g
33CXX = 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]41all : fragments_ran ${DOCUMENT}
42
43fragments_ran : $(RunPgmOut)
[8e819a9]44
45clean :
[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
[b64d0f4]69${Build}/%: ${Programs}/%.run.cfa | ${Build} # cfa cannot handle pipe
70        sed -f ${Programs}/sedcmd $< > ${Build}/tmp.cfa; ${CFA} ${Build}/tmp.cfa -o $@
[5717495]71
72${Build}/%: ${Programs}/%.run.c | ${Build}
[b64d0f4]73        sed -f ${Programs}/sedcmd $< | ${CC} -x c -I ${Programs} -o $@ -
[5717495]74
75${Build}/%: ${Programs}/%.run.cpp | ${Build}
[b64d0f4]76        sed -f ${Programs}/sedcmd $< | ${CXX} -x c++ -I ${Programs} -o $@ -
[bbf6a180]77
[5717495]78${Build}/%.out: ${Build}/% | ${Build}
79        $< > $@
[8e819a9]80
[5717495]81-include ${Build}/*.d
Note: See TracBrowser for help on using the repository browser.