6  Makefile Pipelines

7 Why Use Makefiles?

A Makefile encodes your analysis pipeline so that anyone can reproduce the results with a single command.
It tracks dependencies and only reruns steps when necessary.

8 Example Makefile

all: figures paper

clean:
    rm -rf analysis/output/*

figures:
    Rscript analysis/scripts/03_figures.R

models:
    Rscript analysis/scripts/02_models.R

paper:
    quarto render paper/manuscript.qmd

Now you can run:

make models
make figures
make paper

This ensures that your analysis scripts run in the correct order and that the manuscript is rendered from up‑to‑date results.