Skip to content

Commit 67e1f23

Browse files
committed
Add recipe for building tex zip to makefile
1 parent b23d868 commit 67e1f23

File tree

2 files changed

+22
-7
lines changed

2 files changed

+22
-7
lines changed

Makefile

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,7 @@ test: html
5050

5151
book.pdf: tex/book/book.tex $(foreach CHAP,$(CHAPTERS),tex/$(CHAP).tex) tex/solutions.tex \
5252
$(patsubst img/%.svg,img/generated/%.pdf,$(SVGS))
53-
cd tex/book && xelatex book.tex
54-
cd tex/book && xelatex book.tex
55-
makeindex -s tex/book/nostarch.ist -o tex/book/book.ind tex/book/book.idx
56-
makeindex -s tex/book/nostarch.ist -o tex/book/book.ind tex/book/book.idx
57-
cd tex/book && xelatex book.tex
58-
while ( grep -q '^LaTeX Warning: Label(s) may have changed' tex/book/book.log) \
59-
do cd tex/book && xelatex book.tex; done
53+
cd tex/book && sh build.sh
6054
mv tex/book/book.pdf .
6155

6256
pdfonce:
@@ -65,3 +59,17 @@ pdfonce:
6559

6660
texclean:
6761
rm -f tex/book/book.aux tex/book/book.idx tex/book/book.log tex/book/book.out tex/book/book.tbc tex/book/book.toc
62+
63+
TMPDIR=/tmp/ejs_tex
64+
65+
ejs_tex.zip: tex/book/book.tex $(foreach CHAP,$(CHAPTERS),tex/$(CHAP).tex) tex/solutions.tex \
66+
$(patsubst img/%.svg,img/generated/%.pdf,$(SVGS))
67+
rm -rf $@ $(TMPDIR)
68+
mkdir -p $(TMPDIR)
69+
cp tex/*.tex $(TMPDIR)
70+
cat tex/book/book.tex | sed -e 's/\\input{\.\.\//\\input{/' > $(TMPDIR)/book.tex
71+
cp tex/book/build.sh tex/book/nostarch.cls tex/book/nshyper.sty $(TMPDIR)
72+
grep includegraphics tex/*.tex | sed -e 's/.*{\(.*\)}/\1/' | xargs -I{} cp --parents "{}" $(TMPDIR)
73+
cd /tmp; zip -r ejs_tex.zip ejs_tex
74+
mv /tmp/ejs_tex.zip $@
75+
rm -rf $(TMPDIR)

tex/book/build.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
xelatex book.tex
2+
xelatex book.tex
3+
makeindex -s nostarch.ist -o book.ind book.idx
4+
makeindex -s nostarch.ist -o book.ind book.idx
5+
xelatex book.tex
6+
while ( grep -q '^LaTeX Warning: Label(s) may have changed' book.log) \
7+
do xelatex book.tex; done

0 commit comments

Comments
 (0)