๐ŸŒง Rainier Ababaolast updated: 10/29/21
โŸจ back to writing

LaTeX in a Makefile

Rainier Ababao ยท March 12, 2016 ยท 1 min read

In my parallel computing class this semester, we have to write reports with timing results and some analysis using LaTeX. Since we already cook up Makefiles to compile our MPI C programs, why don't we construct our reports the same way too?

Here is a Makefile I wrote to compile my programs and construct the PDF for my report:

LATEXTMP=*.aux *.log *.toc
EXECS=ex6 ex7

all: ${EXECS}

ex6: ex6.c
    ${MPICC} -o ex6 ex6.c

ex7: ex7.c
    ${MPICC} -o ex7 ex7.c

report: report.tex
    ${LATEXCMP} report.tex

    rm ${EXECS} ${LATEXTMP}

If you are familiar with Make, this set of rules should be fairly straightforward to follow. I also find this useful for getting rid of the temporary files that pdflatex generates, without say, fat-fingering a regex upon rm.

If this is new to you, the GNU Make Manual is a well-written tutorial to start.

Make Make great again! ๐Ÿ˜›

What kind of automation tools do you use for tasks that aren't typically automated?

React to this article!