This repository has been archived on 2024-05-19. You can view files and clone it, but cannot push or open issues or pull requests.
l-systems/report/Makefile
2024-05-19 00:57:42 +02:00

53 lines
1.7 KiB
Makefile

NAME = document
TEX = $(NAME).tex
SRC = $(TEX)
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)/ $(IMG_DIR)/ svg-inkscape/ \
$(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 koch3,3 koch5,4 dragon,12 sierp,7 \
gosp6,4 gosp4,2 br1,3 br2,3 br3,3 htree,11 \
\
star,7 moore,3 peano,3 koch8,6 \
\
pyramid,3 levey,10 carpet,4 square,4 pentaplexy,3 triangles,3 blocks,2 \
pentl,3; 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