Linked Questions

Popular Questions

Make not building dot files before pdf

Asked by At

I have the current folder structure for my project

.
├── Makefile
└── S6
    ├── CD_CS304.md
    ├── CN_CS306.md
    ├── DAA_CS302.md
    └── graphviz
        └── cs304_compilerphases.dot

2 directories, 5 files

I am building separate pdfs for each and every markdown file, here is my Makefile

# Generate PDFs from the Markdown source files
#
# In order to use this makefile, you need some tools:
# - GNU make
# - Pandoc

# All markdown files are considered sources
MD_SOURCES := $(wildcard **/*.md)
OUTPUT_PDFS := $(MD_SOURCES:.md=.pdf)
DOT_SOURCES := $(wildcard **/*.dot)
OUTPUT_DOTPNGS := $(DOT_SOURCES:.dot=.png)

all: $(OUTPUT_DOTPNGS) $(OUTPUT_PDFS) 

# Recipe for building png files from dot files
%.png: %.dot
    dot \
        -Tpng $< \
        -o [email protected]

# Recipe for converting a Markdown file into PDF using Pandoc
%.pdf: %.md
    pandoc \
        --variable fontsize=12pt \
        --variable date:"\today" \
        --variable geometry:a4paper \
        --variable documentclass:book \
        --table-of-contents \
        --number-sections \
        --filter pandoc-fignos \
        -f markdown  $< \
        -o [email protected]


.PHONY : clean

clean: $(OUTPUT_PDFS) $(OUTPUT_DOTPNGS)
    $(RM) $^

I want to embed the output of the dot program into the latex pdf's but here the Makefile does not make the dot files into png and goes straight into compiling the pdf.

This makes the pdf compilation run into errors as the png files are not present.

Related Questions