The makefiles for a Latex document can get pretty ugly and complicated especially if your document depends on various data or graphics files. SCons is a new and improved build-tool that implements its configuration files as Python scripts, the file is called SConstruct now instead of Makefile. The great thing from my point of view is that it has built-in support for Latex. Making a pdf from my Latex source file is simple:
env = Environment()
env.PDF('main.tex')
The PDF builder is smart enough to know it needs to run
pdflatex
and then based on the output possibly run bibtex
and then pdflatex
again to track down undefined references (or not). All in two lines of Python. The really neat thing is how easy it is to extend the built-in build environments.
env = Environment()
plot_bld = Builder(action = 'gnuplot < $SOURCE > $TARGET,
suffix = '.png'
src_suffix = '.gp')
env.Append(BUILDERS = {'Plot' : plot_bld})
env.PDF('main.tex')
Now my SCons can automatically update my png graphics files based on gnuplot commands in any files ending with .gp.
Practical Development Environments has a nice little write-up in Chapter 5 about SCons.
There's a built-in builder for software distro packages too:
ReplyDelete----------------
env = Environment(tools=['default', 'packaging'])
env.Install('/bin/', 'my_program')
env.Package( NAME = 'foo',
VERSION = '1.2.3',
PACKAGEVERSION = 0,
PACKAGETYPE = 'rpm',
LICENSE = 'gpl',
SUMMARY = 'balalalalal',
DESCRIPTION = 'this should be really really long',
X_RPM_GROUP = 'Application/fu',
SOURCE_URL = 'http://foo.org/foo-1.2.3.tar.gz'
)
---------------
Making it really easy to make your own RPMs or other installers; Awesome!