diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/stex/make')
11 files changed, 230 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/latex/stex/make/Makefile b/Master/texmf-dist/source/latex/stex/make/Makefile new file mode 100644 index 00000000000..0aaad6a8d8d --- /dev/null +++ b/Master/texmf-dist/source/latex/stex/make/Makefile @@ -0,0 +1,3 @@ +all: +clean: +distclean: diff --git a/Master/texmf-dist/source/latex/stex/make/Makefile.base.in b/Master/texmf-dist/source/latex/stex/make/Makefile.base.in new file mode 100644 index 00000000000..35834efbb00 --- /dev/null +++ b/Master/texmf-dist/source/latex/stex/make/Makefile.base.in @@ -0,0 +1,28 @@ +sms: $(MODS.sms) + +####################### sTeX utilities ############################## + +$(MODS.sms): %.sms: %.tex $(STEXBINDIR)/sms + $(SMSPROG) $< + +graph: + $(GRAPHPROG) -o graph -f pdf $(SNIPPATHS) all.tex + +idtest: $(TARGET) + $(STEXBINDIR)/idcheck -q slides.tex + +struct: $(TARGET) + $(STEXBINDIR)/modstr < slides.tex + +ccheck: $(TARGET) + latex slides.tex + $(STEXBINDIR)/idcheck slides.tex + $(STEXBINDIR)/modstr -s < slides.tex > sstruct + cat sstruct + +############################# cleaning ################################# +clean: + rm -Rf $(CLEAN) + +distclean: clean + rm -Rf $(DISTCLEAN) diff --git a/Master/texmf-dist/source/latex/stex/make/Makefile.base.vars b/Master/texmf-dist/source/latex/stex/make/Makefile.base.vars new file mode 100644 index 00000000000..bc112e3f55c --- /dev/null +++ b/Master/texmf-dist/source/latex/stex/make/Makefile.base.vars @@ -0,0 +1,26 @@ +#################################### PATHS ############################### +# the paths can be customized by setting the shell variable STEXDIR appropriately +STEXSTYDIR = $(STEXDIR)/sty +STEXBINDIR = $(STEXDIR)/bin + +################################# Programs ############################### +SMSPROG = PERL5LIB=$(STEXDIR)/bin $(STEXDIR)/bin/sms +GRAPHPROG = PERL5LIB=$(STEXDIR)/bin $(STEXDIR)/bin/sgraph + +########################## Conversion and Formatting Targets ########### +# the TARGET is the set of top-level TeX files that should be formatted or converted. +# TARGET.parts are separate parts of the target (e.g. included via \input). The TARGET +# files usually depend on them and they are not Modules (see below). +# Modules (MODS) are sTeX files without head and tail, so that they can be included +# into other sTeX files. TARGET can be set by the including Makefile, MODS are +# computed as as the remaining *.tex files. + +MODS ?= $(filter-out $(BUTFILES) $(TARGET.parts) $(TARGET), $(shell ls *.tex)) $(MODS.extra) +MODS.sms ?= $(MODS:%.tex=%.sms) $(MODS.sms.extra) + +# the prefix files or the MODSLIBDIR variable must be specified by the calling Makefile +MODS.pre ?= $(MODSLIBDIR)/pre.tex +MODS.post ?= $(MODSLIBDIR)/post.tex + +########################### for cleaning ###################################### +DISTCLEAN += $(MODS.sms) diff --git a/Master/texmf-dist/source/latex/stex/make/Makefile.in b/Master/texmf-dist/source/latex/stex/make/Makefile.in new file mode 100644 index 00000000000..1d7f1fb368d --- /dev/null +++ b/Master/texmf-dist/source/latex/stex/make/Makefile.in @@ -0,0 +1,3 @@ +include $(STEXDIR)/make/Makefile.base.in +include $(STEXDIR)/make/Makefile.latex.in +include $(STEXDIR)/make/Makefile.latexml.in diff --git a/Master/texmf-dist/source/latex/stex/make/Makefile.latex.in b/Master/texmf-dist/source/latex/stex/make/Makefile.latex.in new file mode 100644 index 00000000000..65bf6227b87 --- /dev/null +++ b/Master/texmf-dist/source/latex/stex/make/Makefile.latex.in @@ -0,0 +1,31 @@ +pdf: sms $(TARGET.pdf) +mpdf: sms $(MODS.pdf) +# LaTeX build rules: +# +# use non-interactive PDFLATEX (see above) +# +# _always_ delete pdf on error (otherwise, we end up with a corrupt +# pdf file and make saying "nothing to do" on the next run ) +# +# make will delete temporary files (toc,sms,aux) afterwards +# (FIXME: why? should this be disabled or kept like that?) +# +# make pdf depend on its own .toc and .aux and global aux/sms files +$(TARGET.pdf): %.pdf: %.tex $(MODS) $(TARGET.parts) $(IMG) + $(PDFLATEX) $< || $(RM) $@ + @echo + @if (test -e $(patsubst %.tex, %.idx, $<));\ + then makeindex $(patsubst %.tex, %.idx, $<); fi + @echo + @if (grep "No file$(patsubst %.tex, %.bbl, $<)" $(patsubst %.tex, %.log, $<)> /dev/null);\ + then bibtex $(patsubst %.tex, %, $<); fi + @echo + $(PDFLATEX) $< || $(RM) $@ + @echo + @if (grep Rerun $(patsubst %.tex, %.log, $<) > /dev/null);\ + then $(PDFLATEX) $< || $(RM) $@; fi + @if (grep Rerun $(patsubst %.tex, %.log, $<) > /dev/null);\ + then $(PDFLATEX) $< || $(RM) $@; fi + +$(MODS.pdf): %.pdf: %.tex + $(PDFLATEX) -jobname=$(basename $<) "\nonstopmode\input{$(MODS.pre)}\begin{document}\input{$<}\end{document}" || $(RM) $@ diff --git a/Master/texmf-dist/source/latex/stex/make/Makefile.latex.vars b/Master/texmf-dist/source/latex/stex/make/Makefile.latex.vars new file mode 100644 index 00000000000..f894cf7262b --- /dev/null +++ b/Master/texmf-dist/source/latex/stex/make/Makefile.latex.vars @@ -0,0 +1,16 @@ +TARGET.pdf = $(TARGET:%.tex=%.pdf) +MODS.pdf = $(MODS:%.tex=%.pdf) + +####################### Programs ####################### +# pdflatex: use non-interactive switches + +PDFLATEX = pdflatex -interaction batchmode -file-line-error +#PDFLATEX = pdflatex + +########################### environment ############################# +TEXINPUTS := $(TEXINPUTS)$(STEXSTYDIR)//: + +########################### cleaning ############################# + +CLEAN += *~ *.log *.blg *.idx *.ilg *.out +DISTCLEAN += *.dvi *.aux *.toc *.bbl *.ind $(TARGET.pdf) diff --git a/Master/texmf-dist/source/latex/stex/make/Makefile.latexml.in b/Master/texmf-dist/source/latex/stex/make/Makefile.latexml.in new file mode 100644 index 00000000000..f0e1731df4c --- /dev/null +++ b/Master/texmf-dist/source/latex/stex/make/Makefile.latexml.in @@ -0,0 +1,43 @@ +omdoc: sms $(filter-out all.omdoc,$(TARGET.omdoc)) +mods: sms $(MODS.omdoc) + +############################ Running LaTeXML ############################# +$(TARGET.tex.xml): %.tex.xml: %.tex $(TARGET.parts) + latexmlc $< $(LTXPATHS) --mode=standard --local --destination=$@ --log=$@.log\ + +$(TARGET.xml): %.xml: %.tex.xml + $(LATEXMLPOST) --destination=$@ $< >& $@.log\ + || echo "FATAL: latexmlpost crashed with fatal error on $<" > $@.log + +$(TARGET.sdomdoc): %.sdomdoc: %.xml $(STEXOXSL) + $(STEXXSLT) -o $@ $(STEXOXSL) $< + +$(TARGET.omdoc): %.omdoc: %.tex $(TARGET.parts) $(LTSTY) $(STEXOXSL) + latexmlc $< $(LTXPATHS) --local --mode=standard\ + --postdest=$(basename $<).omdoc\ + --log=$(basename $<).ltxlog --includestyles\ + --stylesheet=$(STEXOXSL) --nodefaultcss\ + --stylesheetparam=math-format:$(MATHFORMAT)\ + --post --openmath --pmml --summary + +$(MODS.tex.xml): %.tex.xml: %.tex $(LTSTY) + latexmlc --preamble=$(MODS.pre) $< $(LTXPATHS) --local --mode=fragment --destination=$@ --log=$@.log --includestyles + +$(MODS.xml): %.xml: %.tex.xml + $(LATEXMLPOST) --destination=$@ $< >& $@.log + +$(MODS.sdomdoc): %.sdomdoc: %.xml $(STEXOXSL) + xsltproc -o $@ $(STEXOXSL) $< >& $@.log + +$(MODS.omdoc): %.omdoc: %.tex $(LTSTY) $(STEXOXSL) + latexmlc --preamble=$(MODS.pre) $< $(LTXPATHS)\ + --local --mode=fragment\ + --postdest=$(basename $<).omdoc\ + --log=$(basename $<).ltxlog --includestyles\ + --stylesheet=$(STEXOXSL) --nodefaultcss\ + --post --openmath --pmml --summary + +errlog: latexml.errlog + +latexml.errlog: $(MODS.log) + grep -i -e error -e Fatal $(MODS.log) > $@ || echo "No errors found" > $@ diff --git a/Master/texmf-dist/source/latex/stex/make/Makefile.latexml.vars b/Master/texmf-dist/source/latex/stex/make/Makefile.latexml.vars new file mode 100644 index 00000000000..4dfb6848ce2 --- /dev/null +++ b/Master/texmf-dist/source/latex/stex/make/Makefile.latexml.vars @@ -0,0 +1,48 @@ +#################################### PATHS ############################### +# the paths can be customized by setting the shell variable STEXDIR appropriately +STEXXSLDIR = $(STEXDIR)/xsl +STEXRNCDIR = $(STEXDIR)/rnc + +###################### Conversion Programs ############################### +STEXLTXDIRS = modules statements sproof omtext omdoc sref presentation dcm reqdoc metakeys\ + mikoslides problem hwexam cmath etc + +LTXPATHS = --path=$(STEXSTYDIR) --path=$(STEXDIR)/schema/rng \ + $(STEXLTXDIRS:%=--path=$(STEXSTYDIR)/%) + +LATEXML = latexmlc $(LTXPATHS) +LATEXMLPOST = latexmlpost --openmath --pmml --nocrossref --noscan --novalidate + +MATHFORMAT = om +STEXXSLT = xsltproc --stringparam math-format $(MATHFORMAT) + +STEXOXSL = $(STEXXSLDIR)/omdocpost.xsl + +STEXRNG = $(shell ls $(STEXDIR)/rnc/*.rng) + +########################## Conversion and Formatting Targets ########### +# the TARGET is the set of top-level TeX files that should be formatted or converted +# Modules (MODS) are sTeX files without head and tail, so that they can be included +# into other sTeX files. TARGET can be set by the including Makefile, MODS are +# computed as as the remaining *.tex files. + +TARGET.tex.xml = $(TARGET:%.tex=%.tex.xml) +TARGET.xml = $(TARGET:%.tex=%.xml) +TARGET.omdoc = $(TARGET:%.tex=%.omdoc) +TARGET.sdomdoc = $(TARGET:%.tex=%.sdomdoc) + +MODS.tex.xml = $(MODS:%.tex=%.tex.xml) +MODS.xml = $(MODS:%.tex=%.xml) +MODS.omdoc = $(MODS:%.tex=%.omdoc) +MODS.sdomdoc = $(MODS:%.tex=%.sdomdoc) +MODS.log = $(shell ls *.ltxlog) + +# the prefix files or the MODSLIBDIR variable must be specified by the calling Makefile +MODS.pre ?= $(MODSLIBDIR)/pre.tex +MODS.post ?= $(MODSLIBDIR)/post.tex + +########################### environment ############################# +TEXINPUTS := $(TEXINPUTS)$(STEXSTYDIR)//: + +CLEAN += $(TARGET.xml) $(TARGET.tex.xml) $(MODS.tex.xml) $(MODS.xml) +DISTCLEAN += $(TARGET.omdoc) $(MODS.omdoc) diff --git a/Master/texmf-dist/source/latex/stex/make/Makefile.subdirs b/Master/texmf-dist/source/latex/stex/make/Makefile.subdirs new file mode 100644 index 00000000000..ccbf95cd3ba --- /dev/null +++ b/Master/texmf-dist/source/latex/stex/make/Makefile.subdirs @@ -0,0 +1,6 @@ +all errlog:: + @for d in $(MAKEDIRS); do (cd $$d && $(MAKE) -$(MAKEFLAGS) $@) done + +clean distclean:: + @for d in $(CLEANDIRS); do (cd $$d && $(MAKE) -$(MAKEFLAGS) $@) done + diff --git a/Master/texmf-dist/source/latex/stex/make/Makefile.vars b/Master/texmf-dist/source/latex/stex/make/Makefile.vars new file mode 100644 index 00000000000..d59db56a4f7 --- /dev/null +++ b/Master/texmf-dist/source/latex/stex/make/Makefile.vars @@ -0,0 +1,3 @@ +include $(STEXDIR)/make/Makefile.base.vars +include $(STEXDIR)/make/Makefile.latex.vars +include $(STEXDIR)/make/Makefile.latexml.vars diff --git a/Master/texmf-dist/source/latex/stex/make/README b/Master/texmf-dist/source/latex/stex/make/README new file mode 100644 index 00000000000..78419320a69 --- /dev/null +++ b/Master/texmf-dist/source/latex/stex/make/README @@ -0,0 +1,23 @@ +This directory contains two Makefiles for inclusion into Makefile-based build systems. + +file contains +-------------------------------------------------------------------------------------- +Makefile.base.vars general variable declarations (include before all others) +Makefile.base.in general rules (include before all others) +Makefile.latexml.vars variable declarations for the LaTeXML conversion +Makefile.latexml.in rules for producing OMDoc via LaTeXML +Makefile.latex.vars variable declarations for LaTeX formatting +Makefile.latex.in rules for LaTeX formatting +Makefile.vars combines all *.vars above +Makefile.in combines all *.in above + +The usual setup for this will be to create SVN externals +- the deployed instance of sTeX (i.e. https://svn.kwarc.info/repos/sTeX/trunk or /latest) +- to this directory +and use the lines + +STEXDIR = <the sTeX external> +include $(STEXDIR)/make/Makefile.vars +include $(STEXDIR)/make/Makefile.in + +at appropriate places in the calling Makefile. It is crucial to set STEXDIR variable to make this setup work. |