From d97654d95b269eb9f6de8105e2eb01ca5566ae14 Mon Sep 17 00:00:00 2001 From: Sébastien Dailly Date: Fri, 10 May 2024 20:52:40 +0200 Subject: New customisation properties in the Makefile --- common/Makefile.common | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'common') diff --git a/common/Makefile.common b/common/Makefile.common index 460bdc7..311db70 100644 --- a/common/Makefile.common +++ b/common/Makefile.common @@ -13,7 +13,11 @@ all: $(PDFS) BIBS =$(wildcard *.bib) DIR = $(sort $(shell find $(SOURCE) -name '*.rst' -print)) -SOURCES := $(sort $(wildcard $(MODEL)/resources/*.tex) ) +SOURCES = $(sort $(filter-out $(FILTERS), $(wildcard $(MODEL)/resources/*.tex) )) + +# Sources comming from extra styles. +# Used in the target regeneration. +EXT_SOURCES = $(filter %.tex, $(EXTRA_STYLES) ) null := space := $(null) # @@ -35,8 +39,12 @@ PACKAGES = $(subst $(space),$(comma),$(strip $(PACK))) tmp: mkdir tmp +# Hack used to identify the path to the shared configuration in latex. +tmp/model.tex: | tmp + $(file >$@,\def\commonPath{$(MODEL)/../common/}) + # Generate the latex file from rst -tmp/%.tex: %.rst $(INCLUDED_PDF) $(SOURCES)| tmp +tmp/%.tex: %.rst $(INCLUDED_PDF) $(SOURCES) $(EXT_SOURCES) | tmp $$(command -v rst2latex rst2latex.py | head -n 1) \ --no-section-subtitles \ --table-style=borderless \ @@ -46,15 +54,18 @@ tmp/%.tex: %.rst $(INCLUDED_PDF) $(SOURCES)| tmp --documentoption=12pt,A4,table \ --syntax-highlight=short \ $(EXTRA_RST_OPTIONS) \ - --stylesheet=$(PACKAGES),$(EXTRA_STYLES),$(TEX_STYLE) $< $@ + --stylesheet=tmp/model.tex,$(PACKAGES),$(subst $(space),$(comma),\$(EXTRA_STYLES)),$(TEX_STYLE) $< $@ sed -i -e 's/continued on next page/suite sur la page suivante/;s|^%$$||' $@ sed -i -e 's/admonition-/admonition/g' $@ # Generate each pdf with latex -tmp/%.pdf: tmp/%.tex $(BIBS) | tmp +tmp/%.pdf: tmp/%.tex tmp/model.tex $(BIBS) | tmp + set TEXINPUTS=.:$(MODEL):$$(TEXINPUTS) $(TEX) -output-directory tmp $< #bibtex tmp/$*.aux && $(TEX) -output-directory tmp $< || echo "no bib" - while grep 'Rerun to get ' tmp/$*.log ; do $(TEX) -output-directory tmp $< ; done + while grep 'Rerun to get ' tmp/$*.log ; do \ + $(TEX) --halt-on-error -output-directory tmp $< ;\ + done # Put the pdf in the right place %.pdf: tmp/%.pdf | tmp @@ -62,6 +73,7 @@ tmp/%.pdf: tmp/%.tex $(BIBS) | tmp # Update mupdf if the process exist, or do nothing. pkill -HUP mupdf || true +.PHONY: clean clean: rm -r tmp @@ -73,6 +85,7 @@ clean: # Watch mode, which regenerate the documents as soon there is a change in a # file., # requires inotifywait (package inotify-tools) +.PHONY: watch watch: while true; do \ $(MAKE) all; \ -- cgit v1.2.3