2024-04-15 19:10:30 +02:00
|
|
|
NAME = document
|
|
|
|
|
|
|
|
TEX = $(NAME).tex
|
|
|
|
SRC = $(TEX)
|
|
|
|
PDF = $(TEX:.tex=.pdf)
|
|
|
|
|
|
|
|
TEXMK = latexmk -shell-escape -lualatex -interaction=nonstopmode
|
2024-04-26 21:05:19 +02:00
|
|
|
QPDF = qpdf --linearize --replace-input
|
2024-05-12 16:50:00 +02:00
|
|
|
MKDIR = mkdir -p
|
|
|
|
ECHO = echo
|
|
|
|
CD = cd
|
|
|
|
MV = mv
|
|
|
|
|
|
|
|
REPORT_DIR = report
|
|
|
|
IMG_DIR = imgs
|
|
|
|
|
2024-04-15 19:10:30 +02:00
|
|
|
|
|
|
|
all: $(PDF)
|
|
|
|
|
|
|
|
$(PDF): %.pdf: %.tex
|
2024-05-12 16:50:00 +02:00
|
|
|
ifneq ($(wildcard $(IMG_DIR)/.*),)
|
2024-04-15 19:10:30 +02:00
|
|
|
$(TEXMK) $<
|
2024-04-26 21:05:19 +02:00
|
|
|
@$(QPDF) $@ 2>/dev/null |:
|
2024-05-12 16:50:00 +02:00
|
|
|
else
|
|
|
|
# Generate SVG if no imgs/ directory found
|
|
|
|
@$(MAKE) generate_svg
|
|
|
|
@$(MAKE) $@
|
|
|
|
endif
|
|
|
|
|
2024-04-15 19:10:30 +02:00
|
|
|
|
|
|
|
EXTS = aux fdb_latexmk fls log nav out snm synctex.gz toc
|
|
|
|
clean:
|
2024-05-12 16:50:00 +02:00
|
|
|
rm -rf $(PDF) _minted-$(NAME)/ $(IMG_DIR)/ \
|
|
|
|
$(foreach ext,$(EXTS),$(NAME).$(ext))
|
|
|
|
|
|
|
|
generate_svg:
|
|
|
|
@$(MKDIR) $(IMG_DIR)
|
|
|
|
# List of Lsystem to generate as pair `name,n`, space separated
|
|
|
|
@$(CD) ..; $(MAKE) -s generation; \
|
|
|
|
for pair in \
|
|
|
|
snow,5 koch,2 koch1,2 koch2,3 koch3,3 koch5,4 sierp,7 gosp6,4 gosp4,2 \
|
|
|
|
star,7 moore,3 peano,3 koch8,6 pyramid,3 carpet,4 square,4 pentaplexy,3 \
|
|
|
|
triangles,3 blocks,2; do \
|
|
|
|
IFS=',' read -r nom n <<< "$$pair"; \
|
|
|
|
$(MAKE) -s NOCHECK=1 tortue nom=$$nom n=$$n; \
|
|
|
|
$(MAKE) -s NOCHECK=1 traceur; $(MAKE) -s svg; \
|
|
|
|
$(MV) image.svg $(REPORT_DIR)/$(IMG_DIR)/$$nom.svg; \
|
|
|
|
$(ECHO) "'$$nom' generated with $$n iterations."; \
|
|
|
|
done
|