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

54 lines
1.7 KiB
Makefile
Raw Normal View History

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-19 00:57:42 +02:00
rm -rf $(PDF) _minted-$(NAME)/ $(IMG_DIR)/ svg-inkscape/ \
2024-05-12 16:50:00 +02:00
$(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; \
2024-05-19 00:57:42 +02:00
$(ECHO) "'$$nom' generated with $$n iterations."; \
2024-05-12 16:50:00 +02:00
done