Add Makefile/macro support for producing the Sapling version of the spec.

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
This commit is contained in:
Daira Hopwood 2017-07-11 07:58:57 +01:00
parent fc73e03c12
commit 2608958c59
2 changed files with 37 additions and 3 deletions

View File

@ -1,6 +1,9 @@
protocol.pdf: protocol.tex zcash.bib incremental_merkle.pdf key_components.pdf
$(MAKE) pdf
sapling.pdf: protocol.tex zcash.bib incremental_merkle.pdf key_components.pdf
$(MAKE) sapling
LATEX=pdflatex
.PHONY: pdf
@ -14,6 +17,20 @@ pdf:
$(LATEX) protocol.tex || { touch incremental_merkle.pdf; exit 1; }
$(LATEX) protocol.tex || { touch incremental_merkle.pdf; exit 1; }
.PHONY: sapling
sapling:
printf '\\toggletrue{issapling}\n\\renewcommand{\\docversion}{Version %s [Sapling]}' "$$(git describe --tags --abbrev=6)" |tee protocol.ver
# If $(LATEX) fails, touch an input so that 'make' won't think it is up-to-date next time.
rm -f sapling.aux sapling.bbl sapling.blg sapling.brf sapling.bcf
$(LATEX) -jobname=sapling protocol.tex || { touch incremental_merkle.pdf; exit 1; }
biber sapling
$(LATEX) -jobname=sapling protocol.tex || { touch incremental_merkle.pdf; exit 1; }
$(LATEX) -jobname=sapling protocol.tex || { touch incremental_merkle.pdf; exit 1; }
$(LATEX) -jobname=sapling protocol.tex || { touch incremental_merkle.pdf; exit 1; }
.PHONY: clean
clean:
rm -f protocol.dvi protocol.pdf protocol.bbl protocol.blg protocol.brf protocol.toc protocol.aux protocol.out protocol.log protocol.bcf protocol.run.xml protocol.ver
rm -f protocol.dvi protocol.pdf protocol.bbl protocol.blg protocol.brf protocol.toc \
protocol.aux protocol.out protocol.log protocol.bcf protocol.run.xml protocol.ver \
sapling.dvi sapling.pdf sapling.bbl sapling.blg sapling.brf sapling.toc \
sapling.aux sapling.out sapling.log sapling.bcf sapling.run.xml

View File

@ -19,6 +19,7 @@
\RequirePackage[unicode,bookmarksnumbered,bookmarksopen,pdfview=Fit]{hyperref}
\RequirePackage{cleveref}
\RequirePackage{nameref}
\RequirePackage{etoolbox}
\RequirePackage[style=alphabetic,maxbibnames=99,dateabbrev=false,urldate=iso8601,backref=true,backrefstyle=none,backend=biber]{biblatex}
\addbibresource{zcash.bib}
@ -81,6 +82,8 @@
\setlist[formulae]{itemsep=0.2ex,topsep=0ex,leftmargin=1.5em,label=,after=\vspace{1.5ex}}
\newcommand{\docversion}{Version unavailable (check protocol.ver)}
\newtoggle{issapling}
\togglefalse{issapling}
\InputIfFileExists{protocol.ver}{}{}
\newcommand{\doctitle}{Zcash Protocol Specification}
@ -159,6 +162,16 @@ electronic commerce and payment, financial privacy, proof of work, zero knowledg
\newcommand{\changedcolor}{magenta}
\newcommand{\setchanged}{\color{\changedcolor}}
\newcommand{\changed}[1]{\texorpdfstring{{\setchanged{#1}}}{#1}}
\newcommand{\saplingcolor}{ForestGreen}
\iftoggle{issapling}{
\newcommand{\sprout}[1]{}
\newcommand{\setsapling}{\color{\saplingcolor}}
\newcommand{\sapling}[1]{\texorpdfstring{{\setsapling{#1}}}{#1}}
} {
\newcommand{\sprout}[1]{#1}
\newcommand{\setsapling}{}
\newcommand{\sapling}[1]{}
}
% terminology
@ -761,8 +774,12 @@ address the problem of mining centralization by use of the Equihash
memory-hard proof-of-work algorithm.
\vspace{1.5ex}
\noindent This specification defines the \Zcash consensus protocol and explains
its differences from \Zerocash and \Bitcoin.
\sprout{\noindent This specification defines the \Zcash consensus protocol and explains
its differences from \Zerocash and \Bitcoin.}
\sapling{\noindent This \em{draft} specification defines the next major
version of the \Zcash consensus protocol, codenamed Sapling. It is
a work in progress and should not be used as a reference for the current
protocol.}
\vspace{2.5ex}
\noindent \textbf{Keywords:}~ \StrSubstitute[0]{\keywords}{,}{, }.