Commit fad120fe authored by apvrille's avatar apvrille

Update on soclib doc management

parent 6999ac93
......@@ -162,7 +162,10 @@ PROD_USERNAME = apvrille
PROD_ADDRESS = ssh.enst.fr
PROD_PATH = public_html/docs
TTOOL_DOC_SOCLIB = $(TTOOL_DOC)/document_soclib
TTOOL_DOC_SOCLIB_USERGUIDE_DIR = $(TTOOL_DOC)/documents_soclib/USER_GUIDE
TTOOL_DOC_SOCLIB_USERGUIDE_CMD = make user_guide
TTOOL_DOC_SOCLIB_INSTALLATIONGUIDE_DIR = $(TTOOL_DOC)/documents_soclib/INSTALLATION_GUIDE
TTOOL_DOC_SOCLIB_INSTALLATIONGUIDE_CMD = make installation_guide
TTOOL_MODELING = $(TTOOL_PATH)/modeling
TTOOL_SIMULATORS = $(TTOOL_PATH)/simulators
TTOOL_FIGURES = $(TTOOL_PATH)/figures
......@@ -225,7 +228,12 @@ $(STDRELEASE:.tgz=.tar): $(BASERELEASE:.tgz=.tar)
#NC
@mkdir -p $(TTOOL_TARGET)/nc
@cp $(TTOOL_DOC)/README_nc $(TTOOL_TARGET)/nc
@cp $(TTOOL_DOC_SOCLIB)/doc_ttool_soclib.pdf $(TTOOL_TARGET)/doc/
@cd $(TTOOL_DOC_SOCLIB_USERGUIDE_DIR)/&&$(TTOOL_DOC_SOCLIB_USERGUIDE_CMD)
@cp $(TTOOL_DOC_SOCLIB_USERGUIDE_DIR)/build/user_guide.pdf $(TTOOL_TARGET)/doc/prototyping_with_soclib_user_guide.pdf
@cd $(TTOOL_DOC_SOCLIB_INSTALLATIONGUIDE_DIR)/&&$(TTOOL_DOC_SOCLIB_INSTALLATIONGUIDE_CMD)
@cp $(TTOOL_DOC_SOCLIB_INSTALLATIONGUIDE_DIR)/build/installation_guide.pdf $(TTOOL_TARGET)/doc/prototyping_with_soclib_installation_guide.pdf
# Figures
@cp $(TTOOL_FIGURES)/Makefile $(TTOOL_TARGET)/figures
@cp $(TTOOL_FIGURES)/mli.mk $(TTOOL_TARGET)/figures
......@@ -236,7 +244,7 @@ $(STDRELEASE:.tgz=.tar): $(BASERELEASE:.tgz=.tar)
# Basic bin
@cp $(TTOOL_EXE) $(TTOOL_TARGET)/
@cp $(TTOOL_LOTOS_H) $(TTOOL_TARGET)/bin
@$(TAR) uf $@ -C $(TTOOL_TARGET_RELEASE) TTool/lotos TTool/nc TTool/bin TTool/java TTool/figures TTool/nc TTool/lotos TTool/doc/doc_ttool_soclib.pdf $(patsubst $(TTOOL_DOC)/%,TTool/%,$(TTOOL_EXE))
@$(TAR) uf $@ -C $(TTOOL_TARGET_RELEASE) TTool/lotos TTool/nc TTool/bin TTool/java TTool/figures TTool/nc TTool/lotos TTool/doc/prototyping_with_soclib_installation_guide.pdf TTool/doc/prototyping_with_soclib_user_guide.pdf $(patsubst $(TTOOL_DOC)/%,TTool/%,$(TTOOL_EXE))
$(ADVANCED_RELEASE:.tgz=.tar): $(STDRELEASE:.tgz=.tar) documentation
@echo "$(PREFIX) Generating advanced release"
......
......@@ -3,6 +3,8 @@ TOP = installation_guide.tex
# Bibliography (if any)
BIBLIO =
SHELL = /bin/bash
# Figures directory
FIGDIR = fig
......
# Top LaTeX document (without .tex extension)
TOP = euser_guide.tex
TOP = user_guide.tex
# Bibliography (if any)
BIBLIO =
SHELL = /bin/bash
# Figures directory
FIGDIR = fig
......@@ -10,7 +12,7 @@ FIGDIR = fig
MAXPASSES ?= 5
# Main, common, Makefile
include mli.mk
include ../mli.mk
#include Makefile.inc
# Main PDF depends on other PDFs generated from fig, dot, dia, gnuplot or
......
......@@ -5,98 +5,123 @@
# See Copyright Notice in COPYING and license in LICENSE. #
###########################################################
#######################
# Adapt to your needs #
#######################
###################################################
# Default values of most important make variables #
###################################################
# mli needs bash
SHELL := /bin/bash
SHELL ?= /bin/bash
# Default max number of compilations
MAXPASSES ?= 30
# Default figures' sub-directory
FIGDIR ?= $(wildcard figures)
# Default bibliography
BIBLIO ?= $(wildcard biblio.bib)
# Log file for $(GENERATED) productions
GENERATEDLOG ?= generated.log
# List of figures source directories
FIGDIR ?= fig
# Build directory
BUILDDIR ?= build
# Verbosity (0: min...)
V ?= 0
# Tools
# LaTeX compilation
LATEX ?= $(shell which pdflatex 2> /dev/null)
LATEXFLAGS ?= -halt-on-error -interaction=batchmode -output-directory=$(BUILDDIR)
# BibTex
BIBTEX ?= $(shell which bibtex 2> /dev/null)
BIBTEXFLAGS ?=
# Xfig to LaTeX/PDF
FIG2DEV ?= $(shell which fig2dev 2> /dev/null)
FIG2DEVFLAGS ?=
# Graphviz to PDF
DOT ?= $(shell which dot 2> /dev/null)
DOTFLAGS ?= -Tpdf
# EPS to PDF
EPSTOPDF ?= $(shell which epstopdf 2> /dev/null)
EPSTOPDFFLAGS ?=
# DIA to EPS
DIA ?= $(shell which dia 2> /dev/null)
DIAFLAGS ?= -t eps-pango
# Gnuplot to PDF
GNUPLOT ?= $(shell which gnuplot 2> /dev/null)
GNUPLOTFLAGS ?=
# SVG to PDF
SVGTOPDF ?= $(shell which inkscape 2> /dev/null)
SVGTOPDFFLAGS ?=
#########################################################
# Normally you shouldn't have to change anything below. #
# Unless you know what you are doing, of course. #
#########################################################
# SHELL = /bin/bash
TEXTOPS = $(shell grep -l '[^%]*\\begin{document}' *.tex)
PDFTARGETS = $(patsubst %.tex,%.pdf,$(TEXTOPS))
TARGETS = $(patsubst %.tex,%,$(TEXTOPS))
# Verbosity
MAXV := 2
# Tools
PDFLATEX = pdflatex
PDFLATEXFLAGS = -halt-on-error -interaction=batchmode
BIBTEX = bibtex
BIBTEXFLAGS =
FIG2DEV ?= $(shell which fig2dev 2> /dev/null)
FIG2DEVFLAGS =
DOT ?= $(shell which dot 2> /dev/null)
DOTFLAGS = -Tpdf
DIA ?= $(shell which dia 2> /dev/null)
DIAFLAGS = -t eps-pango
EPSTOPDF ?= $(shell which epstopdf 2> /dev/null)
EPSTOPDFFLAGS =
GNUPLOT ?= $(shell which gnuplot 2> /dev/null)
GNUPLOTFLAGS =
INKSCAPE ?= $(shell which inkscape 2> /dev/null)
INKSCAPEFLAGS =
ifeq ($(V),0)
Q := @
ECHO := @echo
P := &> /dev/null
else ifeq ($(V),1)
Q :=
ECHO := @echo -e '\n************************************************************************' && echo
P := &> /dev/null
else
Q :=
ECHO := @echo -e '\n************************************************************************' && echo
P :=
endif
# Files, path...
XFIGSRCS = $(wildcard $(FIGDIR)/*.fig)
XFIGPDFS = $(patsubst %.fig,%.pdf,$(XFIGSRCS))
XFIGPDFTS = $(patsubst %.fig,%.pdf_t,$(XFIGSRCS))
DOTSRCS = $(wildcard $(FIGDIR)/*.dot)
DOTPDFS = $(patsubst %.dot,%.pdf,$(DOTSRCS))
DIASRCS = $(wildcard $(FIGDIR)/*.dia)
DIAEPSS = $(patsubst %.dia,%.eps,$(DIASRCS))
DIAPDFS = $(patsubst %.dia,%.pdf,$(DIASRCS))
INKSCAPESRCS = $(wildcard $(FIGDIR)/*.svg)
INKSCAPEPDFS = $(patsubst %.svg,%.pdf,$(INKSCAPESRCS))
GNUPLOTSRCS = $(wildcard $(FIGDIR)/*.gnuplot)
GNUPLOTPDFS = $(patsubst %.gnuplot,%.pdf,$(GNUPLOTSRCS))
EPSSRCS = $(filter-out $(DIAEPSS),$(wildcard $(FIGDIR)/*.eps))
EPSPDFS = $(patsubst %.eps,%.pdf,$(EPSSRCS))
# Tex files
TEXTOPS = $(shell grep -l '[^%]*\\begin{document}' *.tex)
PDFTARGETS = $(patsubst %.tex,$(BUILDDIR)/%.pdf,$(TEXTOPS))
TARGETS = $(patsubst %.tex,%,$(TEXTOPS))
TEXFILES = $(wildcard *.tex)
# Aux files
define AUXFILE_names
$(addsuffix .$(1),$(patsubst %.tex,%,$(TEXFILES)))
endef
SUFFIXES = aux log lof out bbl blg toc nav snm vrb bibtex.log
AUXFILES = $(foreach suffix,$(SUFFIXES),$(call AUXFILE_names,$(suffix)))
TO_STOP_SUFFIXES = aux bcf fls idx ind lof lot out toc
TO_CLEAN_SUFFIXES = $(TO_STOP_SUFFIXES) log bbl blg nav snm vrb
TO_CLEAN_FILES = $(foreach t,$(TARGETS),$(foreach s,$(TO_CLEAN_SUFFIXES),$(BUILDDIR)/$(t).$(s) $(BUILDDIR)/$(t).$(s).1))
# Generated files
GENERATED = $(XFIGPDFS) $(XFIGPDFTS) $(DOTPDFS) $(DIAEPSS) $(DIAPDFS) $(GNUPLOTPDFS) $(INKSCAPEPDFS)
# Figures build files
FIGURES = $(XFIGPDFS) $(XFIGPDFTS) $(DOTPDFS) $(EPSPDFS) $(DIAEPSS) $(DIAPDFS) $(GNUPLOTPDFS) $(SVGPDFS)
.PRECIOUS: $(GENERATED)
.PRECIOUS: $(FIGURES)
define HELP_message
make (help) print this help
make foo (foo.pdf) build the foo.pdf document
make all build all documents
make clean delete non-essential generated files and logs
make ultraclean delete all generated files, logs, etc.
Main goals:
help print this help (default goal)
foo (or BUILDDIR/foo.pdf) build the BUILDDIR/foo.pdf document
all build all documents
clean delete generated files except PDFs of documents
ultraclean delete all generated files (but not the build directory)
Main make variables (current value):
SHELL must be bash ($(SHELL))
MAXPASSES max number of compilations ($(MAXPASSES))
FIGDIR figures source directory ($(FIGDIR))
BUILDDIR build directory ($(BUILDDIR))
V verbosity - 0...$(MAXV) ($(V))
Please see mli.mk for other customizable variables.
Buildable documents:
$(sort $(TARGETS))
Please report bugs or suggestions of improvements to:
Renaud Pacalet <renaud.pacalet@telecom-paristech.fr>
endef
export HELP_message
define MAXPASSES_message
Sorry, $(MAXPASSES) passes were not sufficient to build the document. Please
check the log files or increase the number of passes:
Sorry, $(MAXPASSES) passes were not sufficient to build the document. Keeping
two last versions of each generated files. Comparing them may help
understanding the problem:
diff $(BUILDDIR)/foo.aux $(BUILDDIR)/foo.aux.1
Alternately, you can also try to increase the maximum number of passes:
make MAXPASSES=5 foo
or the verbosity level:
make V=0...$(MAXV) foo
endef
export MAXPASSES_message
......@@ -109,172 +134,264 @@ debug:
all: $(PDFTARGETS)
$(TARGETS): %: %.pdf
$(TARGETS): %: $(BUILDDIR)/%.pdf
$(PDFTARGETS) $(FIGURES): | $(BUILDDIR)
##################
# Xfig to PDFTEX #
# xfig to PDFTEX #
##################
define FIG2DEVNOTFOUND_message
Could not find fig2dev. Cannot produce the PDF from fig sources. Please install
Could not find fig2dev. Cannot produce the pdf from fig sources. Please install
fig2dev and point your PATH to the fig2dev executable. Alternately you can also
pass the fig2dev variable wen invoking make:
make FIG2DEV=/opt/bin/fig2dev foo
endef
export FIG2DEVNOTFOUND_message
# Xfig to PDF (figure without text)
$(XFIGPDFS): %.pdf: %.fig
# xfig to PDF (figure without text) and LaTeX (text and included PDF)
define XFIGTOPDF_rule
$(BUILDDIR)/$(2)-fig.pdf: $(1)/$(2).fig
ifeq ($(FIG2DEV),)
@echo "$$FIG2DEVNOTFOUND_message"
else
@echo " [FIG2DEV] $< -> $@"; \
$(FIG2DEV) $(FIG2DEVFLAGS) -L pdftex $< $@ >> $(GENERATEDLOG) 2>&1
$(ECHO) "[FIG2DEV] $$< -> $$@"
$(Q)$(FIG2DEV) $(FIG2DEVFLAGS) -L pdftex $$< $$@ $(P)
endif
# Xfig to LaTeX (text and included PDF)
$(XFIGPDFTS): %.pdf_t: %.fig %.pdf
$(BUILDDIR)/$(2)-fig.pdf_t: $(1)/$(2).fig $(BUILDDIR)/$(2)-fig.pdf
ifeq ($(FIG2DEV),)
@echo "$$FIG2DEVNOTFOUND_message"
else
@echo " [FIG2DEV] $< -> $@"; \
$(FIG2DEV) $(FIG2DEVFLAGS) -L pdftex_t -p $(patsubst %.pdf_t,%.pdf,$@) $< $@ >> $(GENERATEDLOG) 2>&1
$(ECHO) "[FIG2DEV] $$< -> $$@"
$(Q)$(FIG2DEV) $(FIG2DEVFLAGS) -L pdftex_t -p $(BUILDDIR)/$(2)-fig.pdf $$< $$@ $(P)
endif
########################
# dot (graphviz to PDF #
########################
XFIGPDFS += $(BUILDDIR)/$(2)-fig.pdf
XFIGPDFTS += $(BUILDDIR)/$(2)-fig.pdf_t
endef
$(foreach d,$(FIGDIR),$(foreach f,$(patsubst $(d)/%.fig,%,$(wildcard $(d)/*.fig)),$(eval $(call XFIGTOPDF_rule,$(d),$(f)))))
#########################
# dot (graphviz) to PDF #
#########################
define DOTNOTFOUND_message
Could not find dot. Cannot produce the PDF from svg sources. Please install dot
Could not find dot. Cannot produce the PDF from dot sources. Please install dot
and point your PATH to the dot executable. Alternately you can also pass the dot
variable wen invoking make:
make DOT=/opt/bin/dot foo
endef
export DOTNOTFOUND_message
$(DOTPDFS): %.pdf: %.dot
define DOTTOPDF_rule
$(BUILDDIR)/$(2)-dot.pdf: $(1)/$(2).dot
ifeq ($(DOT),)
@echo "$$DOTNOTFOUND_message"
else
@echo " [DOT] $< -> $@"; \
$(DOT) $(DOTFLAGS) -o$@ $< >> $(GENERATEDLOG) 2>&1
$(ECHO) '[DOT] $$< -> $$@'
$(Q)$(DOT) $(DOTFLAGS) -o$$@ $$< $(P)
endif
########################
# dia to EPS, then PDF #
########################
DOTPDFS += $(BUILDDIR)/$(2)-dot.pdf
endef
$(foreach d,$(FIGDIR),$(foreach f,$(patsubst $(d)/%.dot,%,$(wildcard $(d)/*.dot)),$(eval $(call DOTTOPDF_rule,$(d),$(f)))))
##############
# EPS to PDF #
##############
define EPSTOPDFNOTFOUND_message
Could not find epstopdf. Cannot produce the PDF from eps sources. Please install epstopdf
and point your PATH to the epstopdf executable. Alternately you can also pass the epstopdf
variable wen invoking make:
make EPSTOPDF=/opt/bin/epstopdf foo
endef
export EPSTOPDFNOTFOUND_message
define EPSTOPDF_rule
$(BUILDDIR)/$(2).eps.pdf: $(1)/$(2).eps
ifeq ($(EPSTOPDF),)
@echo "$$EPSTOPDFNOTFOUND_message"
else
$(ECHO) '[EPSTOPDF] $$< -> $$@'
$(Q)$(EPSTOPDF) $(EPSTOPDFFLAGS) --outfile=$$@ $$< $(P)
endif
EPSPDFS += $(BUILDDIR)/$(2)-eps.pdf
endef
$(foreach d,$(FIGDIR),$(foreach f,$(patsubst $(d)/%.eps,%,$(filter-out $(DIAEPSS),$(wildcard $(d)/*.eps))),$(eval $(call EPSTOPDF_rule,$(d),$(f)))))
######################
# dia to EPS and PDF #
######################
define DIANOTFOUND_message
Could not find dia. Cannot produce the PDF from svg sources. Please install dia
Could not find dia. Cannot produce the PDF from dia sources. Please install dia
and point your PATH to the dia executable. Alternately you can also pass the dia
variable wen invoking make:
make DIA=/opt/bin/dia foo
endef
export DIANOTFOUND_message
# dia to EPS
$(DIAEPSS): %.eps: %.dia
# dia to EPS and then to PDF
define DIATOPDF_rule
$(BUILDDIR)/$(2)-dia.eps: $(1)/$(2).dia
ifeq ($(DIA),)
@echo "$$DIANOTFOUND_message"
else
@echo " [DIA] $< -> $@"; \
$(DIA) $(DIAFLAGS) -e $@ $< >> $(GENERATEDLOG) 2>&1
$(ECHO) '[DIA] $$< -> $$@'
$(Q)$(DIA) $(DIAFLAGS) -e $$@ $$< $(P)
endif
#########################################
# EPS to PDF (used also for dia to PDF) #
#########################################
define EPSTOPDFNOTFOUND_message
Could not find epstopdf. Cannot produce the PDF from svg sources. Please install epstopdf
and point your PATH to the epstopdf executable. Alternately you can also pass the epstopdf
variable wen invoking make:
make EPSTOPDF=/opt/bin/epstopdf foo
endef
export EPSTOPDFNOTFOUND_message
$(DIAPDFS) $(EPSPDFS): %.pdf: %.eps
$(BUILDDIR)/$(2)-dia.pdf: $(BUILDDIR)/$(2)-dia.eps
ifeq ($(EPSTOPDF),)
@echo "$$EPSTOPDFNOTFOUND_message"
else
@echo " [EPSTOPDF] $< -> $@"; \
$(EPSTOPDF) $(EPSTOPDFFLAGS) --outfile=$@ $< >> $(GENERATEDLOG) 2>&1
$(ECHO) '[DIAEPSTOPDF] $$< -> $$@'
$(Q)$(EPSTOPDF) $(EPSTOPDFFLAGS) --outfile=$$@ $$< $(P)
endif
DIAEPSS += $(BUILDDIR)/$(2)-dia.eps
DIAPDFS += $(BUILDDIR)/$(2)-dia.pdf
endef
$(foreach d,$(FIGDIR),$(foreach f,$(patsubst $(d)/%.dia,%,$(wildcard $(d)/*.dia)),$(eval $(call DIATOPDF_rule,$(d),$(f)))))
##################
# gnuplot to PDF #
##################
define GNUPLOTNOTFOUND_message
Could not find gnuplot. Cannot produce the PDF from SVG sources. Please install
Could not find gnuplot. Cannot produce the PDF from gnuplot sources. Please install
gnuplot and point your PATH to the gnuplot executable. Alternately you can
also pass the GNUPLOT variable wen invoking make:
make GNUPLOT=/opt/bin/gnuplot foo
endef
export GNUPLOTNOTFOUND_message
$(GNUPLOTPDFS): %.pdf: %.gnuplot
define GNUPLOTTOPDF_rule
$(BUILDDIR)/$(2)-gnuplot.pdf: $(1)/$(2).gnuplot
ifeq ($(GNUPLOT),)
@echo "$$GNUPLOTNOTFOUND_message"
else
@echo " [GNUPLOT] $< -> $@"; \
$(GNUPLOT) $(GNUPLOTFLAGS) $< >> $(GENERATEDLOG) 2>&1
$(ECHO) '[GNUPLOT] $$< -> $$@'
$(Q)$(GNUPLOT) $(GNUPLOTFLAGS) -e "set output '| ps2pdf - $$@'" $$< $(P)
endif
#########################
# inkscape (SVG) to PDF #
#########################
GNUPLOTPDFS += $(BUILDDIR)/$(2)-gnuplot.pdf
endef
$(foreach d,$(FIGDIR),$(foreach f,$(patsubst $(d)/%.gnuplot,%,$(wildcard $(d)/*.gnuplot)),$(eval $(call GNUPLOTTOPDF_rule,$(d),$(f)))))
define INKSCAPENOTFOUND_message
Could not find inkscape. Cannot produce the PDF from SVG sources. Please install
inkscape and point your PATH to the inkscape executable. Alternately you can
also pass the INKSCAPE variable wen invoking make:
make INKSCAPE=/opt/bin/inkscape foo
##############
# SVG to PDF #
##############
define SVGTOPDFNOTFOUND_message
Could not find $(SVGTOPDF). Cannot produce the PDF from svg sources. Please install
$(SVGTOPDF) and point your PATH to the $(SVGTOPDF) executable. Alternately you can
also pass the SVGTOPDF variable wen invoking make:
make SVGTOPDF=/opt/bin/inkscape foo
endef
export INKSCAPENOTFOUND_message
export SVGTOPDFNOTFOUND_message
define SVGTOPDF_rule
$(INKSCAPEPDFS): %.pdf: %.svg
ifeq ($(INKSCAPE),)
@echo "$$INKSCAPENOTFOUND_message"
$(BUILDDIR)/$(2)-svg.pdf: $(1)/$(2).svg
ifeq ($(SVGTOPDF),)
@echo "$$SVGTOPDFNOTFOUND_message"
else
@echo " [INKSCAPE] $< -> $@"; \
$(INKSCAPE) $(INKSCAPEFLAGS) $< --export-pdf=$@ >> $(GENERATEDLOG) 2>&1
$(ECHO) '[SVGTOPDF] $$< -> $$@'
$(Q)$(SVGTOPDF) $(SVGTOPDFFLAGS) $$< --export-pdf=$$@ $(P)
endif
clean:
@rm -f $(GENERATED) $(AUXFILES) $(GENERATEDLOG)
$(PDFTARGETS): %.pdf: %.tex
@echo " [PDFLATEX] $< -> $@"; \
f=$(patsubst %.pdf,%,$@); \
$(PDFLATEX) $(PDFLATEXFLAGS) $$f > $$f.previous.log 2>&1; \
if [ -f $$f.aux ]; then \
if egrep -q '(\\citation)|(\\bibdata)|(\\bibstyle)' $$f.aux; then \
echo " [BIBTEX] $$f"; \
$(BIBTEX) $$f > $$f.bibtex.log 2>&1; \
fi; \
fi; \
SVGPDFS += $(BUILDDIR)/$(2)-svg.pdf
endef
$(foreach d,$(FIGDIR),$(foreach f,$(patsubst $(d)/%.svg,%,$(wildcard $(d)/*.svg)),$(eval $(call SVGTOPDF_rule,$(d),$(f)))))
define LATEX_run
.PHONY: $(1)_latex
$(1)_latex:
$(ECHO) '[LATEX #$$(N)] $(1).tex -> $(BUILDDIR)/$(1).pdf'
$(Q)$(LATEX) $(LATEXFLAGS) $(1) $(P)
endef
$(foreach doc,$(TARGETS),$(eval $(call LATEX_run,$(doc))))
define BIBTEX_run
.PHONY: $(1)_bibtex
$(1)_bibtex:
$(ECHO) '[BIBTEX] $(BUILDDIR)/$(1).aux -> $(BUILDDIR)/$(1).bbl'
-$(Q)$(BIBTEX) $(BUILDDIR)/$(1) $(P)
endef
$(foreach doc,$(TARGETS),$(eval $(call BIBTEX_run,$(doc))))
$(PDFTARGETS): $(BUILDDIR)/%.pdf: %.tex
@f=$(patsubst %.tex,%,$<) && \
for (( i = 1; i <= $(MAXPASSES); i += 1 )); do \
echo " [PASS #$$i]"; \
$(PDFLATEX) $(PDFLATEXFLAGS) $$f > $$f.log 2>&1; \
if diff --brief $$f.log $$f.previous.log &> /dev/null; then \
stop=1 && \
for e in $(TO_STOP_SUFFIXES); do \
if [ -f $(BUILDDIR)/$$f.$$e ]; then \
cp -f $(BUILDDIR)/$$f.$$e $(BUILDDIR)/$$f.$$e.1; \
fi; \
done && \
$(MAKE) --no-print-directory N=$$i $*_latex && \
if [ $$i -eq 1 -a -f $(BUILDDIR)/$$f.aux ] && egrep -q '(\\citation)|(\\bibdata)|(\\bibstyle)' $(BUILDDIR)/$$f.aux; then \
stop=0 && \
$(MAKE) --no-print-directory $*_bibtex; \
fi && \
for e in $(TO_STOP_SUFFIXES); do \
if [ -f $(BUILDDIR)/$$f.$$e ]; then \
if [ ! -f $(BUILDDIR)/$$f.$$e.1 ]; then \
stop=0; \
elif ! diff --brief $(BUILDDIR)/$$f.$$e $(BUILDDIR)/$$f.$$e.1 &> /dev/null; then \
stop=0; \
fi; \
fi; \
done && \
if [ $$stop -eq 1 ]; then \
break; \
fi && \
if [ $$i -lt $(MAXPASSES) ]; then \
for e in $(TO_STOP_SUFFIXES); do \
if [ -f $(BUILDDIR)/$$f.$$e ]; then \
cp -f $(BUILDDIR)/$$f.$$e $(BUILDDIR)/$$f.$$e.1; \
fi; \
done; \
fi; \
mv $$f.log $$f.previous.log; \
done; \
if (( i > $(MAXPASSES) )); then \
echo "$$MAXPASSES_message"; \
echo "Keeping last two log messages: $$f.previous.log and $$f.log"; \
echo "comparing them may help understanding the problem."; \
done && \
if [ $$i -gt $(MAXPASSES) ]; then \
echo "$$MAXPASSES_message" && \
exit -1; \
fi; \
rm $$f.previous.log; \
grep -v 'Package: infwarerr .* Providing info/warning/error messages' $$f.log | \
grep -iE 'warning|error' || rm $$f.log; \
if [ -f $(GENERATEDLOG) ]; then \
grep -iE 'warning|error' $(GENERATEDLOG) || rm $(GENERATEDLOG); \
fi
fi && \
rm -f $(BUILDDIR)/*.1
$(BUILDDIR):
$(ECHO) '[MKDIR] $(BUILDDIR)'
$(Q)mkdir -p $(BUILDDIR)
clean:
$(ECHO) '[RM] figures and temporary files'
$(Q)rm -f $(FIGURES) $(TO_CLEAN_FILES)
ultraclean: clean
@rm -f $(PDFTARGETS)
$(ECHO) '[RM] $(PDFTARGETS)'
$(Q)rm -f $(PDFTARGETS)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment