report: generate many images

This commit is contained in:
Anri Kennel 2024-05-12 16:50:00 +02:00
parent 05d830187c
commit 08036453c9
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
2 changed files with 38 additions and 1 deletions

View file

@ -18,7 +18,9 @@ all: generation tortue traceur svg
# Generation du fichier XML des L-systèmes
generation:
$(CONVERTER) $(SYSTEMS).csv -o $(SYSTEMS).xml
ifeq ($(NOCHECK),)
$(VALIDATE) $(SYSTEMS).xsd $(SYSTEMS).xml 1>/dev/null
endif
# Génération du fichier XML de la tortue + vérification
tortue:
@ -28,12 +30,16 @@ ifeq ($(and $(nom),$(n)),)
@false
endif
$(SAXON) -s:$(SYSTEMS).xml -xsl:$(TORTUE).xsl -o:$(TORTUE).xml nom=$(nom) n=$(n)
ifeq ($(NOCHECK),)
$(VALIDATE) $(TORTUE).xsd $(TORTUE).xml 1>/dev/null
endif
# Génération du fichier XML du traceur + vérification
traceur:
$(SAXON) -s:$(TORTUE).xml -xsl:$(TRACEUR).xsl -o:$(TRACEUR).xml
ifeq ($(NOCHECK),)
$(VALIDATE) $(TRACEUR).xsd $(TRACEUR).xml 1>/dev/null
endif
# Génération du fichier SVG
svg:

View file

@ -6,13 +6,44 @@ PDF = $(TEX:.tex=.pdf)
TEXMK = latexmk -shell-escape -lualatex -interaction=nonstopmode
QPDF = qpdf --linearize --replace-input
MKDIR = mkdir -p
ECHO = echo
CD = cd
MV = mv
REPORT_DIR = report
IMG_DIR = imgs
all: $(PDF)
$(PDF): %.pdf: %.tex
ifneq ($(wildcard $(IMG_DIR)/.*),)
$(TEXMK) $<
@$(QPDF) $@ 2>/dev/null |:
else
# Generate SVG if no imgs/ directory found
@$(MAKE) generate_svg
@$(MAKE) $@
endif
EXTS = aux fdb_latexmk fls log nav out snm synctex.gz toc
clean:
rm -rf $(PDF) _minted-$(NAME)/ $(foreach ext,$(EXTS),$(NAME).$(ext))
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