rainier ababao reads and writes

LaTeX in a Makefile

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
MPICC?=mpicc
LATEXCMP=pdflatex

all: ${EXECS}

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

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

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

clean:
    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?