Description: upstream -- autotoolization -- guides
 Attempt to bring in autotools material to compose the Guides;
 meant to be submitted to the upstream maintainer team.
Origin: debian
Author: Jerome Benoit <calculus@rezozer.net>
Last-Update: 2015-05-20

--- /dev/null
+++ b/doc/myguide.mk
@@ -0,0 +1,30 @@
+export TEXINPUTS = $(top_srcdir)/doc:$(srcdir):$(top_srcdir)/examples:
+
+
+PDFLATEX = pdflatex
+MAKEINDEX = makeindex
+
+PDFLATEXCOMPOSEDIR = _compose
+
+PDFLATEXFLAGS = \
+	-no-shell-escape \
+	-interaction=batchmode \
+	-output-directory $(PDFLATEXCOMPOSEDIR)
+
+pdf-local: $(doc_PDF)
+
+install-pdf-local: pdf-local
+	$(INSTALL) -d $(DESTDIR)$(docdir)
+	$(INSTALL_DATA) $(doc_PDF) $(DESTDIR)$(docdir)
+
+clean-local:
+	rm -rf $(PDFLATEXCOMPOSEDIR)
+
+%.pdf: %.tex
+	$(MKDIR_P) $(PDFLATEXCOMPOSEDIR)
+	$(PDFLATEX) $(PDFLATEXFLAGS) $<
+	if test -f $(PDFLATEXCOMPOSEDIR)/$(patsubst %.tex,%.idx,$(<F)) ; then \
+		$(MAKEINDEX) $(PDFLATEXCOMPOSEDIR)/$(patsubst %.tex,%.idx,$(<F)) ; fi
+	$(PDFLATEX) $(PDFLATEXFLAGS) $<
+	$(PDFLATEX) $(PDFLATEXFLAGS) $<
+	mv $(PDFLATEXCOMPOSEDIR)/$(@F) $@
--- a/testu01/Makefile.am
+++ b/testu01/Makefile.am
@@ -1,3 +1,4 @@
+include $(top_srcdir)/doc/myguide.mk
 include $(top_srcdir)/include/Makefile.def
 
 include_HEADERS = TestU01.h
@@ -10,3 +11,28 @@
 EXTRA_DIST = guidetestu01.tex intro.tex title.tex scatfig.tex bintro.tex copyright.tex fintro.tex sintro.tex uintro.tex guidetestu01.bbl
 
 doc_PDF = guideshorttestu01.pdf guidelongtestu01.pdf
+
+DISTCLEANFILES = guideshorttestu01.bbl
+guideshorttestu01.bbl: guidetestu01.bbl
+	$(LN_S) $< $@
+
+DISTCLEANFILES += guideshorttestu01.tex
+guideshorttestu01.tex: guidetestu01.tex
+	$(LN_S) $< $@
+
+DISTCLEANFILES += guidelongtestu01.bbl
+guidelongtestu01.bbl: guidetestu01.bbl
+	$(LN_S) $< $@
+
+DISTCLEANFILES += guidelongtestu01.tex
+guidelongtestu01.tex: guidetestu01.tex
+	$(SED) 's|^% \\detailedtrue|\\detailedtrue|' $< > $@
+
+
+guideshorttestu01.pdf: guideshorttestu01.tex guideshorttestu01.bbl
+
+guidelongtestu01.pdf: guidelongtestu01.tex guidelongtestu01.bbl
+
+
+EXTRA_DIST += $(doc_PDF)
+MAINTAINERCLEANFILES = $(doc_PDF)
--- a/configure.ac
+++ b/configure.ac
@@ -23,6 +23,7 @@
 AC_PROG_CC_C99
 AC_PROG_INSTALL
 AC_PROG_LN_S
+AC_PROG_SED
 AC_PROG_MAKE_SET
 LT_INIT
 
--- a/mylib/Makefile.am
+++ b/mylib/Makefile.am
@@ -1,3 +1,4 @@
+include $(top_srcdir)/doc/myguide.mk
 include $(top_srcdir)/include/Makefile.def
 
 lib_LTLIBRARIES = libmylib.la
@@ -8,3 +9,6 @@
 EXTRA_DIST = guidemylib.tex tcode.tex titre.tex guidemylib.bbl
 
 doc_PDF = guidemylib.pdf
+
+EXTRA_DIST += $(doc_PDF)
+MAINTAINERCLEANFILES = $(doc_PDF)
--- a/probdist/Makefile.am
+++ b/probdist/Makefile.am
@@ -1,3 +1,4 @@
+include $(top_srcdir)/doc/myguide.mk
 include $(top_srcdir)/include/Makefile.def
 
 lib_LTLIBRARIES = libprobdist.la
@@ -8,3 +9,6 @@
 EXTRA_DIST = guideprobdist.tex titre.tex copyright.tex guideprobdist.bbl
 
 doc_PDF = guideprobdist.pdf
+
+EXTRA_DIST += $(doc_PDF)
+MAINTAINERCLEANFILES = $(doc_PDF)
--- a/testu01/guidetestu01.tex
+++ b/testu01/guidetestu01.tex
@@ -11,7 +11,7 @@
 \usepackage{amssymb}
 %% $\mathbb{C, R, N, Z, F}$
 
-\input ../doc/myarticle.sty
+\input myarticle.sty
 
 \def\myboxit#1{\vbox{\hrule height1pt
                    \hbox{\vrule width1pt\kern10pt
@@ -167,5 +167,5 @@
 \bibliography{random,ift,simul,stat,prob,math}
 \clearpage
 \addcontentsline{toc}{chapter}{INDEX}
-\input{guidetestu01.ind}
+\printindex
 \end {document}
--- a/mylib/guidemylib.tex
+++ b/mylib/guidemylib.tex
@@ -1,7 +1,7 @@
 \documentclass[12pt]{article}
 \usepackage{url}
 
-\input ../doc/myarticle.sty
+\input myarticle.sty
 
 \def\pierre#1 {\fbox {\footnote {\ }}\ \footnotetext { From Pierre: #1}}
 \def\richard#1 {\fbox {\footnote {\ }}\ \footnotetext { From Richard: #1}}
--- a/doc/myarticle.sty
+++ b/doc/myarticle.sty
@@ -39,6 +39,6 @@
 \def\inc#1{\@partswtrue\edef\@partlist{#1}}
 \catcode`\@=12
 
-\input ../doc/lmac.tex
+\input lmac.tex
 
 
--- a/probdist/guideprobdist.tex
+++ b/probdist/guideprobdist.tex
@@ -2,7 +2,7 @@
 \usepackage{url}
 \usepackage{amssymb}
 
-\input ../doc/myarticle.sty
+\input myarticle.sty
 
 \newcommand\cH{\mathcal{H}}
 \newcommand\guisec[1]{\vspace{20pt}
--- a/testu01/bintro.tex
+++ b/testu01/bintro.tex
@@ -36,7 +36,7 @@
 
 \setbox0=\vbox {\hsize = 6.0in
 \smallc
-\verbatiminput{../examples/bat1.c}
+\verbatiminput{bat1.c}
 }
 
 \begin{figure}[hbt] \centering \myboxit{\box0}
@@ -47,7 +47,7 @@
 
 \setbox1=\vbox {\hsize = 6.0in
 \smallc
-\verbatiminput{../examples/bat1.res}
+\verbatiminput{bat1.res}
 }
 
 \begin{figure}[ht] \centering \myboxit{\box1}
@@ -78,7 +78,7 @@
 
 \setbox0=\vbox {\hsize = 6.0in
 \smallc
-\verbatiminput{../examples/bat2.c}
+\verbatiminput{bat2.c}
 }
 
 \begin{figure} \centering \myboxit{\box0}
@@ -89,7 +89,7 @@
 
 \setbox1=\vbox {\hsize = 6.0in
 \smallc
-\verbatiminput{../examples/bat2.res}
+\verbatiminput{bat2.res}
 }
 
 \begin{figure} \centering \myboxit{\box1}
--- a/testu01/fintro.tex
+++ b/testu01/fintro.tex
@@ -131,7 +131,7 @@
 
 \setbox0=\vbox {\hsize = 6.1in
 \smallc
-\verbatiminput{../examples/fcoll.c}
+\verbatiminput{fcoll.c}
 }
 
 \begin{figure}
@@ -188,7 +188,7 @@
 for $j=1,2,3,4,5$. Finally, all the created structures are deleted to
 free the memory used by each of them.
 
-\input{../examples/fcoll.res1.tex}
+\input{fcoll.res1.tex}
 
 Tables~\ref{tab:coll1} and \ref{tab:coll11} give the results
 of this program.
@@ -211,7 +211,7 @@
 $n \approx 16 \sqrt{\rho}$.
 
 
-\input{../examples/fcoll.res2.tex}
+\input{fcoll.res2.tex}
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
@@ -246,7 +246,7 @@
 
 \setbox0=\vbox {\hsize = 6.1in
 \smallc
-\verbatiminput{../examples/fbirth.c}
+\verbatiminput{fbirth.c}
 }
 
 \begin{figure}
@@ -280,8 +280,8 @@
 with $m= 2^{30}$, the tests start to fail for $n$ as small as 4096.
 
 
-\input{../examples/fbirth.res1.tex}
-\input{../examples/fbirth.res2.tex}
+\input{fbirth.res1.tex}
+\input{fbirth.res2.tex}
 
 
 
--- a/testu01/scatter.tex
+++ b/testu01/scatter.tex
@@ -148,7 +148,7 @@
 
 \setbox1=\vbox {\hsize = 6.2in
 \smallc
-\verbatiminput{../examples/scat.c}
+\verbatiminput{scat.c}
 }
 
 \begin{figure}[ht] \centering \myboxit{\box1}
@@ -159,7 +159,7 @@
 
 \setbox2=\vbox {\hsize = 6.2in
 \smallc
-\verbatiminput{../examples/excel.dat}
+\verbatiminput{excel.dat}
 }
 
 \begin{figure}[ht] \centering \myboxit{\box2}
@@ -173,7 +173,7 @@
 
 \setbox3=\vbox {\hsize = 6.2in
 \smallc
-\verbatiminput{../examples/scat2.c}
+\verbatiminput{scat2.c}
 }
 
 \begin{figure}[ht] \centering \myboxit{\box3}
--- a/testu01/sintro.tex
+++ b/testu01/sintro.tex
@@ -319,7 +319,7 @@
 
 \setbox0=\vbox {\hsize = 6.0in
 \smallc
-\verbatiminput{../examples/birth1.c}
+\verbatiminput{birth1.c}
 }
 
 \begin{figure}[htb] \centering \myboxit{\box0}
@@ -354,7 +354,7 @@
 
 \setbox0=\vbox {\hsize = 6.0in
 \smallc
-\verbatiminput{../examples/birth2.c}
+\verbatiminput{birth2.c}
 }
 
 \begin{figure}[htb] \centering \myboxit{\box0}
@@ -366,7 +366,7 @@
 
 \setbox1=\vbox {\hsize = 6.0in
 \smallc
-\verbatiminput{../examples/birth1.res}
+\verbatiminput{birth1.res}
 }
 
 \begin{figure}[ht] \centering \myboxit{\box1}
--- a/testu01/uintro.tex
+++ b/testu01/uintro.tex
@@ -63,7 +63,7 @@
 
 \setbox0=\vbox {\hsize = 6.0in
 \smallc
-\verbatiminput{../examples/ex1.c}
+\verbatiminput{ex1.c}
 }
 
 \begin{figure}
--- a/testu01/unif01.tex
+++ b/testu01/unif01.tex
@@ -634,7 +634,7 @@
 
 \setbox0=\vbox {\hsize = 6.2in
 {\smallc
-\verbatiminput{../examples/ex7.c}}
+\verbatiminput{ex7.c}}
 }
 
 \begin{figure} \centering \myboxit{\box0}
@@ -645,7 +645,7 @@
 
 \setbox1=\vbox {\hsize = 6.2in
 {\smallc
-\verbatiminput{../examples/mrg32k3a.c}}
+\verbatiminput{mrg32k3a.c}}
 }
 
 \begin{figure} \centering \myboxit{\box1}
@@ -656,7 +656,7 @@
 
 \setbox1=\vbox {\hsize = 6.2in
 {\smallc
-\verbatiminput{../examples/xorshift.c}}
+\verbatiminput{xorshift.c}}
 }
 
 \begin{figure} \centering \myboxit{\box1}
@@ -773,7 +773,7 @@
 
 \setbox2=\vbox {\hsize = 6.2in
 {\smallc
-\verbatiminput{../examples/my16807.c}}
+\verbatiminput{my16807.c}}
 }
 
 \begin{figure} \centering \myboxit{\box2}
@@ -814,7 +814,7 @@
 
 \setbox0=\vbox {\hsize = 6.2in
 {\smallc
-\verbatiminput{../examples/ex3.c}}
+\verbatiminput{ex3.c}}
 }
 
 \begin{figure} \centering \myboxit{\box0}
@@ -825,7 +825,7 @@
 
 \setbox1=\vbox {\hsize = 6.2in
 {\smallc
-\verbatiminput{../examples/ex3.res}}
+\verbatiminput{ex3.res}}
 }
 
 \begin{figure} \centering \myboxit{\box1}
@@ -871,7 +871,7 @@
 
 \setbox10=\vbox {\hsize = 6.2in
 {\smallc
-\verbatiminput{../examples/ex4.c}}
+\verbatiminput{ex4.c}}
 }
 
 \begin{figure} \centering \myboxit{\box10}
