From 3e976b241e22a372f7ec70572d2130027ac6b52a Mon Sep 17 00:00:00 2001 From: giuliof Date: Sat, 15 Oct 2022 19:01:29 +0200 Subject: [PATCH] Aggiornato makefile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adesso può convertire .svg->.pdf con inkscape --- Makefile | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 64 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 985c43a..b048809 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,67 @@ -diapo: - mkdir -p build dist - pdflatex -output-directory build presentazione.tex - mv build/presentazione.pdf dist +### VECTOR images conversion parameters ### +ORG_DIR = ./img/originals +VEC_DIR = ./img/vectors +# ...from SVG +SVG_PREFIX = svg +SVGF = $(notdir $(wildcard $(ORG_DIR)/*.svg)) +vpath %.svg $(ORG_DIR) + +# ...from TEX +TEX_PREFIX = tex +TEXF = $(notdir $(wildcard $(ORG_DIR)/*.tex)) +vpath %.tex $(ORG_DIR) + +# ...to PDF +PDF = $(SVGF:.svg=_$(SVG_PREFIX).pdf) +PDF += $(TEXF:.tex=_$(TEX_PREFIX).pdf) + +vpath %.pdf $(VEC_DIR) + +### Select all raster ### +RAST_DIR = ./img/rasters +RASTF = $(wildcard $(RAST_DIR)/*) + +### TEX files ### +TEX_DIR = ./tex +# TEX_DIR+= ./antani +# ... + +TEX = $(foreach dir,$(TEX_DIR),$(wildcard $(dir)/*.tex)) + +vpath %.tex $(TEX_DIR) + +all: build/presentazione.pdf vectors + +build/%.pdf: %.tex $(RASTF) $(TEX) $(PDF) Makefile + @mkdir -p build + @if [ -t 1 ]; then echo -e "\033[1;33m[Mashup ]\033[0m main.tex"; else echo "Mashup"; fi + @pdflatex -output-directory build -synctex=1 -interaction=nonstopmode $< > /dev/null + @pdflatex -output-directory build -synctex=1 -interaction=nonstopmode $< > /dev/null + +vectors: $(PDF) + +%_tex.pdf : %.tex + @mkdir -p $(VEC_DIR) + @if [ -t 1 ]; then echo -e "\033[1;32m[Figure TEX ]\033[0m $^ $@"; else echo "[Figure TEX ] $^ $@"; fi + @pdflatex -jobname $(@:.pdf=) -output-directory $(VEC_DIR) $^ > /dev/null + +%_svg.pdf : %.svg + @mkdir -p $(VEC_DIR) + @if [ -t 1 ]; then echo -e "\033[1;32m[Figure SVG ]\033[0m $^"; else echo "[Figure SVG ] $^"; fi + @inkscape -z -D --file=$^ --export-pdf=$(VEC_DIR)/$@ > /dev/null + +tree: + mkdir -p $(VEC_DIR) + mkdir -p $(ORG_DIR) + mkdir -p $(RAST_DIR) + mkdir -p $(TEX_DIR) + mkdir -p build + cd build && mkdir -p $(TEX_DIR) + clean: rm -rf build + rm -rf $(VEC_DIR) + +mrproper: build + rm -rf dist