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

Re: [GT] Makefile for TeX conversion



R P Herrold wrote:

Here is a Makefile, to add to at: /GT/Docs/ which will build a fresh PDF from the TeX. I added a License clause, which probably needs to make it into the .tex file as well.

<<big snip>>

russ

thanks for that work -- i tweaked it a bit to better suit my non-linux platform,
hopefully making it a bit more adaptable to other plats as well. also hopefully
added a bit of user-self protection by aborting before removing *.pdf if
there isn't a latex found.

added a help target the content of which is mostly your instructions

yelp if i did things badly, i don't have a (la)tex install to check
it against.

aloha

ras
#
#	Makefile for GT documentation (GT/Docs)
#
#	We support building an index in the future, although not yet 
#	in the early versions
#
#	Copyright (c) 2008 R P Herrold <info
AT
owlriver.com>
# Based on and for GeniusTrader (C) 2000-2002 Raphaël Hertzog, Fabien Fulhaber
# This file is distributed under the terms of the General Public License
# version 2 or (at your option) any later version.
#
# ras hacks adds help target, user protection and maybe some additional portability
# $Id: Makefile,v 1.12 2008/03/12 20:45:53 ras Exp ras $
#

TEXSRC   = Writing_an_Indicator_Cookbook

LATEX   = latex
MAKE    = gmake
RM      = rm
TOUCH   = touch
DEBUG   =
#	comment out the next line to debug errors
DEBUG   = > /dev/null 2>&1

#
# this target is the default target -- move below all if that is unacceptable
h help: ;
	@/bin/echo "GT/Docs/Makefile -- will re-generate $(TEXSRC).pdf from"
	@/bin/echo "$(TEXSRC).tex provided the latex package is available"
	@/bin/echo "TARGETS IN THIS MAKEFILE:"
	@/bin/echo ""
	@/bin/echo "h help   -- this target"
	@/bin/echo "vcs      -- cleans up suitably for version control software"
	@/bin/echo "            but keeps PDF output"
	@/bin/echo "docs     -- generates the output(s) and removes unneeded stuff"
	@/bin/echo "clean    -- removes everything generated"
	@/bin/echo "all      -- primary user target"
	@/bin/echo ""
	@/bin/echo "TYPICAL USAGE:"
	@/bin/echo "cd GT/Docs"
	@/bin/echo "make clean"
	@/bin/echo "make all"
	@/bin/echo ""
	@/bin/echo "The Makefile will clean up after itself to a VCS's satisfaction and not"
	@/bin/echo "'touch' content it should not (i.e., no gratutious alterations of"
	@/bin/echo "timestamps.)"
	@/bin/echo ""
	@/bin/echo "Then a person with repository commits may then 'ci' the new PDF."
	@/bin/echo ""
	@/bin/echo "DETAILED INSTRUCTIONS AND USAGE ADVICE -- thank you russ herrold"
	@/bin/echo ""
	@/bin/echo "When a $(TEXSRC).tex patch comes in:"
	@/bin/echo ""
	@/bin/echo "A local author can do a 'co, and edit a bit ... then they can 'test out'"
	@/bin/echo "their local .tex file changes along the way, and review the PDF to make"
	@/bin/echo "sure it is as intended."
	@/bin/echo ""
	@/bin/echo "Once happy, they can 'rm' the local test PDF, and send a 'diff' for just"
	@/bin/echo "the .tex file, and any side content like images."
	@/bin/echo ""
	@/bin/echo "The person with repository commits can review locally, and commit the"
	@/bin/echo "new .tex; after the upstream turn around, do a 'co' locally of the"
	@/bin/echo "newly committed .tex; rebuild the revised PDF locally using the typical"
	@/bin/echo "'make' sequence, and then commit the new PDF."
	@/bin/echo ""
	@/bin/echo "with some luck and work, maybe the last paragraph can be"
	@/bin/echo "automated at the VCS/server level."

#
# the $(LATEX) --version call self-protects ones pdf file
# in case it cannot be rebuilt by aborting
all:	;
	@$(LATEX) --version
	$(MAKE) clean ; $(MAKE) docs ; $(MAKE) vcs
	
clean:	;
	$(MAKE) vcs ;
	@echo "$(RM) -f *.pdf"

#
#	we have to build it twice to get page numbers right for an index
docs:	;
	@$(TOUCH) $(TEXSRC).ind $(TEXSRC).idx
	$(LATEX)     -interaction=batchmode $(TEXSRC) $(DEBUG)
	makeindex $(TEXSRC) 
	$(LATEX)     -interaction=batchmode $(TEXSRC) $(DEBUG)
	dvips     $(TEXSRC).dvi -o $(TEXSRC).ps
	ps2pdf    $(TEXSRC).ps     $(TEXSRC).pdf
	make vcs

#	comment out the 'make vcs' line above to see intermediate build files
#
#	we leave the .pdf in the VCS as a courtesy
vcs:	;
	@$(RM) -f *.aux *.dvi *.log *.out *.ps *.ind *.ilg *.idx

### EOF