[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Large Debiandoc SGML and PS/PDF problem



Hi,
On Wed, Feb 20, 2002 at 04:53:31PM -0800, C.M. Connelly wrote:
> "OA" == Osamu Aoki <debian@aokiconsulting.com> writes:
> 
>     OA> Adam Di Carlo, (boot-floppies mainatiner) responded back
> 
> I have a Perl script that I use to TeX documents.  As part of the
> process, it copies the .aux file, and compares the .aux file from
> the next run to the backup (.bux).  If the files are identical, it
> stops TeXing (and goes on to the next step, if any).  If not, it
> runs TeX again.

That exactly Adam does and I do with Makefile.  make $@ is your friend.
See below for the key part.

Since debiandoc is shell script, it may be best having "while-loop" or 
"for-loop" with error handling.

Osamu
------ [ Interesting part of Makefile ] ----
#
# Interesting part of Makefile dor Debiandoc2foo short cominngs
#
# maximum times we're willing to run TeX to get cross-references right, 
# if you subtract by 3
#MAX_TEX_RECURSION	:= 6 # Adam uses 6, I just bumped numbrer bigger
MAX_TEX_RECURSION	:= 9

$(MANUAL).%.texinfo: $(MANUAL).%.sgml date.ent dynamic.%.ent 
	debiandoc2texinfo -l $* $<

# Buggy, Top must be moved manually to higher position

$(MANUAL).%.info: $(MANUAL).%.texinfo
	@#makeinfo -v -o $(MANUAL).$*.info $(MANUAL).$*.texinfo
	makeinfo --force -v -o $(MANUAL).$*.info $(MANUAL).$*.texinfo


#----[ generating teTeX ]------------------------------------------------------
$(MANUAL).%.tex: $(MANUAL).%.sgml date.ent dynamic.%.ent 
	debiandoc2latex -l $* $<
#$(MANUAL).%.ps: $(MANUAL).%.sgml date.ent dynamic.%.ent 
#	debiandoc2latexps -l $* $<
# debiandoc2latexps is broken. Imitate Makefile in boot-floppies
$(MANUAL).%.ps:	$(MANUAL).%.tex
#	 note that I have seen bi-stable .aux files, thus we check two levels deep
	@-cp -pf prior.aux pprior.aux 2>/dev/null
	@-cp -pf $(basename $<).aux prior.aux 2>/dev/null
#	 fail if we don't have pdflatex correctly installed
	@kpsewhich latex.fmt >/dev/null
#	 due to a bug in debiandoc2latex2e output, this might fail
	@-latex '\nonstopmode\input{$<}' >/dev/null 
	# see $(@:.ps=.log) for details
	dvips -t `cat /etc/papersize` -o $(MANUAL).$*.ps $(MANUAL).$*
	@set -e								;\
	if ! cmp $(basename $<).aux prior.aux 2>/dev/null &&		\
	   ! cmp $(basename $<).aux pprior.aux 2>/dev/null; then	\
		if expr $(MAKELEVEL) '<' $(MAX_TEX_RECURSION) >/dev/null;\
		then							\
		   echo ">>> remaking $@ (take $(MAKELEVEL))"		;\
		   rm -f $@						;\
		   $(MAKE) $@						;\
		else							\
		   echo "E: $@ needs remaking, but we have reached max. level, $(MAX_TEX_RECURSION)" ;\
		fi							\
	fi
	@rm -f prior.aux pprior.aux

# PDF created has starting page with error report. (I will try fixing it
# soon.)

#$(MANUAL).%.pdf: $(MANUAL).%.sgml date.ent dynamic.%.ent 
#	debiandoc2latexpdf -l $* $<

# debiandoc2latexpdf is broken. Imitate Makefile in boot-floppies
$(MANUAL).%.pdf:	$(MANUAL).%.tex
#	 note that I have seen bi-stable .aux files, thus we check two levels deep
	@-cp -pf prior.aux pprior.aux 2>/dev/null
	@-cp -pf $(basename $<).aux prior.aux 2>/dev/null
#	 fail if we don't have pdflatex correctly installed
	@kpsewhich pdflatex.fmt >/dev/null
#	 due to a bug in debiandoc2latex2e output, this might fail
	@-pdflatex '\nonstopmode\input{$<}' >/dev/null 
	# see $(@:.pdf=.log) for details
	@set -e								;\
	if ! cmp $(basename $<).aux prior.aux 2>/dev/null &&		\
	   ! cmp $(basename $<).aux pprior.aux 2>/dev/null; then	\
		if expr $(MAKELEVEL) '<' $(MAX_TEX_RECURSION) >/dev/null;\
		then							\
		   echo ">>> remaking $@ (take $(MAKELEVEL))"		;\
		   rm -f $@						;\
		   $(MAKE) $@						;\
		else							\
		   echo "E: $@ needs remaking, but we have reached max. level, $(MAX_TEX_RECURSION)" ;\
		fi							\
	fi
	@rm -f prior.aux pprior.aux



-- 
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+  Osamu Aoki <debian@aokiconsulting.com> @ Cupertino, CA USA         +



Reply to: