-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
37 lines (28 loc) · 1.15 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
TEX := $(shell find content/**/*.tex) # find all `.tex` files in `content`
TEX_TARGET := $(patsubst %.tex, build/%.md, $(TEX)) # target them in the `build` folder
MARKDOWN := $(shell find content/**/*.md) # find all `.md` files in `content`
MARKDOWN_TARGET := $(patsubst %.md, build/%.md, $(MARKDOWN)) # target them in the `build` folder
# TODO: implement
# FIGURES := $(shell find assets/figures/*.tex)
# FIGURES_TARGET := $(patsubst %.tex, build/%.pdf, $(FIGURES))
all: content
# generate pdf of the latex figures
# figures: $(FIGURES_TARGET)
# build/figures/%.pdf: figures/%.tex
# mkdir -p $(dir $@)
# latexmk -pdf -jobname=$(@:%.pdf=%) $<
# build the target markdown content using the latex and markdown files
content: tex markdown
# convert latex content to markdown using pandoc
tex: $(TEX_TARGET)
build/%.md: %.tex
mkdir -p $(dir $@)
pandoc -f latex -t markdown $< -s -o $@
# convert markdown content to markdown using pandoc, it is almost just copying but transforms to strict markdown if needed
markdown: $(MARKDOWN_TARGET)
build/%.md: %.md
mkdir -p $(dir $@)
pandoc -f markdown -t markdown $< -s -o $@
# remove the `build` folder
clean:
@rm -rf build