summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/unicode-math/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/unicode-math/Makefile')
-rw-r--r--Master/texmf-dist/source/latex/unicode-math/Makefile145
1 files changed, 71 insertions, 74 deletions
diff --git a/Master/texmf-dist/source/latex/unicode-math/Makefile b/Master/texmf-dist/source/latex/unicode-math/Makefile
index c85ecdb407b..f713a001f76 100644
--- a/Master/texmf-dist/source/latex/unicode-math/Makefile
+++ b/Master/texmf-dist/source/latex/unicode-math/Makefile
@@ -14,27 +14,28 @@ help:
echo ' ctan - generate archive for CTAN'
echo ' doc - compile documentation inside build/'
echo ' clean - remove build directory and compiled files'
+ echo ' all - clean & doc & ctan'
echo ' '
echo ' install - install the package into your home texmf tree'
echo ' install-sys - install the package into the system-wide texmf tree'
echo ' (may require administration privileges)'
echo ' install TEXMF=<texmf> - install the package into the path <texmf>'
echo ' '
- echo ' test - run the test suite'
+ echo ' check - run the test suite'
echo ' initest - initialise any new tests'
echo ' '
echo ' xfile F=<abc> - compile file <abc> with XeLaTeX'
echo ' lfile F=<abc> - compile file <abc> with LuaLaTeX'
echo ' '
- echo 'To add a new test, add a file called umtest****.ltx to'
+ echo 'To add a new test, add a file called X****.ltx to'
echo 'directory testfiles/, run `make initest` and ensure'
- echo 'that the output umtest****.safe.png is correct.'
+ echo 'that the output X****.safe.pdf is correct.'
echo ' '
echo '`make test` will then compare future compilations of the'
echo 'test file against this original and warn against any changes.'
- echo '`make build/umtest****.diff.png` will check a single test.'
+ echo '`make build/X****.diff.pdf` will check a single test.'
echo ' '
- echo 'I recommend `make -j4 test` or thereabouts to parallelise'
+ echo 'I recommend `make -j4 check` or thereabouts to parallelise'
echo 'the testing.'
@@ -49,6 +50,8 @@ SUITE = $(PKG)-testsuite
XMPL = unimath-example.ltx
SYM = unimath-symbols
+COPY = cp -a
+
testdir=testfiles
builddir=build
tds=$(builddir)/$(PKG).tds
@@ -56,9 +59,10 @@ tds=$(builddir)/$(PKG).tds
UPDATE = `which dtx-update` || true # TODO: generalise
# these files end up in the CTAN directory:
+
PKGSOURCE = $(PKG).dtx $(TBL) Makefile
DOC = $(PKG).pdf $(SUITE).pdf README $(XMPL) $(SYM).pdf
-CTANFILES = $(PKGSOURCE) $(DOC) ../$(testdir)
+CTANFILES = $(PKGSOURCE) $(DOC) $(testdir)
BUILDCTAN = $(addprefix $(builddir)/,$(CTANFILES))
BUILDDOC = $(addprefix $(builddir)/,$(DOC))
@@ -67,17 +71,16 @@ BUILDDOC = $(addprefix $(builddir)/,$(DOC))
LTXSOURCE = $(PKG).sty $(TBL)
SUITESOURCE = \
- $(testdir)/umtest-preamble.tex \
- $(testdir)/umtest-suite.tex
+ umtest-preamble.tex \
+ umtest-suite-X.tex \
+ umtest-suite-L.tex
-SWEETSAUCE = ginger and chilli
-
-TESTOUT = $(shell ls $(testdir)/umtest*.safe.png)
-BUILDTESTSRC = $(subst $(testdir)/,$(builddir)/,$(subst .safe.png,.ltx,$(TESTOUT)))
-BUILDTESTTARGET = $(subst $(testdir)/,$(builddir)/,$(subst .safe.png,.diff.png,$(TESTOUT)))
+TESTOUT = $(shell ls $(testdir)/*.safe.pdf)
+BUILDTESTSRC = $(subst $(testdir)/,$(builddir)/,$(subst .safe.pdf,.ltx,$(TESTOUT)))
+BUILDTESTTARGET = $(subst $(testdir)/,$(builddir)/,$(subst .safe.pdf,.diff.pdf,$(TESTOUT)))
BUILDSOURCE = $(addprefix $(builddir)/,$(LTXSOURCE))
-BUILDSUITE = $(subst $(testdir)/,$(builddir)/,$(SUITESOURCE))
+BUILDSUITE = $(addprefix $(builddir)/,$(SUITESOURCE))
BUILDFILES = $(BUILDSOURCE) $(BUILDSUITE) $(BUILDTESTSRC)
# and this is how the TDS zip file is produced:
@@ -110,29 +113,20 @@ clean:
rm -rf $(builddir)
rm -f $(PKG).zip $(PKG).pdf $(SUITE).pdf
-$(PKG).pdf: $(builddir)/$(PKG).pdf
- cp $< $@
-
-$(SUITE).pdf: $(builddir)/$(SUITE).pdf
- cp $< $@
-
+all: clean doc ctan
#### BUILD FILES
$(builddir)/$(PKG).dtx: $(PKG).dtx
mkdir -p $(builddir)
$(UPDATE)
- cp -f $< $@
+ $(COPY) $< $@
$(builddir)/$(PKG).sty: $(builddir)/$(PKG).dtx
echo "Updating $@"
cd $(builddir); \
tex $(PKG).dtx > /dev/null ;
-$(builddir)/unicode-math-table.tex: unicode-math-table.tex
- echo "Updating $@"
- cp -f $< $@
-
$(builddir)/$(PKG).pdf: $(builddir)/$(PKG).dtx $(BUILDSOURCE)
cd $(builddir); \
xelatex $(PKG).dtx && \
@@ -144,56 +138,56 @@ $(builddir)/$(SYM).pdf: $(builddir)/$(SYM).ltx
xelatex $(SYM).ltx && \
xelatex $(SYM).ltx;
-$(builddir)/$(SUITE).pdf: $(SUITE).ltx $(BUILDSUITE)
- xelatex -output-directory=$(builddir) $<
+$(builddir)/%.ltx: $(testdir)/%.ltx
+ $(COPY) $< $@
-$(builddir)/umtest-preamble.tex: $(testdir)/umtest-preamble.tex
- cp -f $< $@
+$(builddir)/%.tex: $(testdir)/%.tex
+ $(COPY) $< $@
-$(builddir)/umtest-suite.tex: $(testdir)/umtest-suite.tex
- cp -f $< $@
+$(builddir)/$(testdir): $(testdir)
+ $(COPY) $< $@
-$(builddir)/%.ltx: $(testdir)/%.ltx
- cp -f $< $@
+$(builddir)/%: %
+ $(COPY) $< $@
-$(builddir)/README: README.markdown
- cp -f $< $@
+$(builddir)/README: $(builddir)/README.markdown
+ mv -f $< $@
-$(builddir)/Makefile: Makefile
- cp -f $< $@
-$(builddir)/$(SUITE).ltx: $(SUITE).ltx
- cp -f $< $@
+# Test suite PDF
+
+$(builddir)/$(SUITE).pdf: $(builddir)/$(SUITE).ltx $(BUILDSUITE) $(builddir)/$(testdir)
+ cd $(builddir); \
+ xelatex $(SUITE).ltx
-$(builddir)/$(XMPL): $(XMPL)
- cp -f $< $@
-$(builddir)/$(SYM).ltx: $(SYM).ltx
- cp -f $< $@
##### CTAN INSTALLATION #####
-../$(testdir):
+tds: $(builddir)/$(PKG).tds.zip
-tds: $(TDSFILES)
- cd $(builddir); \
- zip -r $(PKG).tds.zip $(PKG).tds -x *.DS_Store -x *.safe.png
+$(builddir)/$(PKG).tds.zip: $(tds)/$(PKG).tds.zip
+ $(COPY) $< $@
+
+$(tds)/$(PKG).tds.zip: $(TDSFILES)
+ cd $(tds); \
+ zip -r $(PKG).tds.zip ./* -x *.DS_Store -x *.safe.pdf
ctan: $(BUILDCTAN) tds
cd $(builddir); \
zip -r \
../$(PKG).zip $(CTANFILES) $(PKG).tds.zip \
- -x *.DS_Store -x *.safe.png
+ -x *.DS_Store -x *.safe.pdf
$(tds)/doc/latex/$(PKG)/% \
$(tds)/tex/latex/$(PKG)/% \
$(tds)/source/latex/$(PKG)/% : $(builddir)/%
mkdir -p $(shell dirname $@)
- cp -f $< $@
+ $(COPY) $< $@
$(tds)/source/latex/$(PKG)/$(testdir):
- cp -rf $(testdir) $(tds)/source/latex/$(PKG)/$(testdir)
+ $(COPY) $(testdir) $(tds)/source/latex/$(PKG)/
##### LOCAL TEXMF INSTALLATION #####
@@ -203,7 +197,7 @@ TEXMFLOCAL=$(shell kpsewhich --var-value TEXMFLOCAL)
install: $(TDSFILES)
if test -n "$(TEXMFHOME)" ; then \
echo "Installing in '$(TEXMFHOME)'."; \
- cp -rf $(tds)/ $(TEXMFHOME); \
+ $(COPY) $(tds)/ $(TEXMFHOME); \
else \
echo "Cannot locate your home texmf tree. Specify manually with\n\n make install TEXMFHOME=/path/to/texmf\n" ; \
false ; \
@@ -212,7 +206,7 @@ install: $(TDSFILES)
install-sys: $(TDSFILES)
if test -n "$(TEXMFLOCAL)" ; then \
echo "Installing in '$(TEXMFLOCAL)'."; \
- cp -rf $(tds)/ $(TEXMFLOCAL); \
+ $(COPY) $(tds)/ $(TEXMFLOCAL); \
else \
echo "Cannot locate your system-wide local texmf tree. Specify manually with\n\n make install TEXMFLOCAL=/path/to/texmf\n" ; \
false ; \
@@ -223,21 +217,21 @@ install-sys: $(TDSFILES)
##### USEFUL FOR TEST FILES #####
xfile: $(F) $(BUILDSOURCE)
- if [ "$(F)" = "" ] ; then \
+ if test -z "$(F)" ; then \
echo "Need a filename!\nE.g. \`make xfile F=test.ltx\`" ; \
false ; \
fi
echo Typesetting $(F):
- cp -f $(F) $(builddir)/$(F)
+ $(COPY) $(F) $(builddir)/$(F)
cd $(builddir); xelatex $(F)
lfile: $(F) $(BUILDSOURCE)
- if [ "$(F)" = "" ] ; then \
+ if test -z "$(F)" ; then \
echo "Need a filename!\nE.g. \`make lfile F=test.ltx\`" ; \
false ; \
fi
echo Typesetting $(F):
- cp -f $(F) $(builddir)/$(F)
+ $(COPY) $(F) $(builddir)/$(F)
cd $(builddir); lualatex $(F)
@@ -248,40 +242,43 @@ lfile: $(F) $(BUILDSOURCE)
#### All tests ####
-test: $(BUILDFILES) $(BUILDTESTTARGET)
+check: $(BUILDFILES) $(BUILDTESTTARGET)
cd $(testdir); \
- ls umtest*.ltx | sed -e 's/umtest\(.*\).ltx/\\inserttest{\1}/g' > umtest-suite.tex
+ ls X*.ltx | sed -e 's/\(.*\).ltx/\\inserttest{\1}/g' > umtest-suite-X.tex; \
+ ls L*.ltx | sed -e 's/\(.*\).ltx/\\inserttest{\1}/g' > umtest-suite-L.tex;
#### Each step of the process ####
-$(builddir)/%.diff.png: $(builddir)/%.test.png
- echo '$*: Comparing with good PNG.'
- if [ "${shell compare -metric RMSE $(builddir)/$*.test.png $(testdir)/$*.safe.png $(builddir)/$*.diff.png | grep 'dB'}" = "0 dB" ] ; then \
+COMPARE_OPTS = -metric AE -density 300x300
+PIXEL_TOLERANCE = 1
+
+$(builddir)/%.diff.pdf: $(builddir)/%.pdf
+ echo '$*: Comparing with reference PDF.'
+ if [ ${shell compare $(COMPARE_OPTS) $(builddir)/$*.pdf $(testdir)/$*.safe.pdf $(builddir)/$*.diff.pdf 2>&1} -le $(PIXEL_TOLERANCE) ] ; then \
echo '$*: Test passed.' ; \
else \
echo '$*: Test failed.' ; \
false ; \
fi
-$(builddir)/%.test.png: $(builddir)/%.pdf
- echo '$*: Converting PDF to PNG.'
- convert -density 300x300 $< $(builddir)/$*.test.png
+$(builddir)/X%.pdf: $(BUILDSOURCE) $(BUILDSUITE) $(builddir)/X%.ltx
+ echo 'X$*: Generating PDF output from XeLaTeX.'
+ cd $(builddir); xelatex -interaction=batchmode X$*.ltx > /dev/null
-$(builddir)/umtest%.pdf: $(BUILDSOURCE) $(BUILDSUITE) $(builddir)/umtest%.ltx
- echo 'umtest$*: Generating PDF output.'
- cd $(builddir); xelatex -interaction=batchmode umtest$*.ltx > /dev/null
+$(builddir)/L%.pdf: $(BUILDSOURCE) $(BUILDSUITE) $(builddir)/L%.ltx
+ echo 'L$*: Generating PDF output from LuaLaTeX.'
+ cd $(builddir); lualatex -interaction=batchmode L$*.ltx > /dev/null
#### Generating new tests ####
-lonelystub = $(shell cd $(testdir); ls | egrep 'umtest(.*\.ltx)|(.*\.safe.png)' | cut -d . -f 1 | uniq -u)
-lonelyfile = $(addsuffix .safe.png,$(lonelystub))
-lonelypath = $(addprefix $(testdir)/,$(lonelyfile))
-lonelytest = $(addprefix $(builddir)/,$(addsuffix .test.png,$(lonelystub)))
+lonelystub = $(shell cd $(testdir); ls | egrep '(.*\.ltx)|(.*\.safe.pdf)' | cut -d . -f 1 | uniq -u)
+lonelytest = $(addprefix $(testdir)/,$(addsuffix .safe.pdf,$(lonelystub)))
+lonelytesttarget = $(addprefix $(builddir)/,$(addsuffix .pdf,$(lonelystub)))
-initest: $(lonelypath)
+initest: $(lonelytest)
-$(lonelypath): $(lonelytest)
- cp `echo $@ | sed -e s/$(testdir)/$(builddir)/ -e s/.safe.png/.test.png/` $@
+$(lonelytest): $(lonelytesttarget)
+ $(COPY) `echo $@ | sed -e s/$(testdir)/$(builddir)/ -e s/.safe.pdf/.pdf/` $@