Does scons outperforms autoconf and makefiles?

May 28th, 2009 mysurface Posted in python | Hits: 195008 | 3 Comments »

SCons is a software construction tool (build tool, or make tool) implemented in Python, that uses Python scripts as “configuration files” for software builds. Based on the design that won the Software Carpentry build tool competition, SCons solves a number of problems associated with other build tools, especially including the classic and ubiquitous Make itself.

In its evolution, SCons will be more general than a make replacement, it will be a Gnu Build System replacement. The Gnu Build System (GBS) is also known as the set of Autotools (autoconf, automake, autoheader, etc…).

Quote From

So scons is just a makefile replacement? Which claims to be simple and feature rich? Let me construct a simple but sufficient scons configuration file (SConstruct), and show you how you can compile your c++ projects. Then you make the judgement whether to go for it or not.

#filename: SConstruct
env = Environment(
CXX = 'g++34',
LIBS = ['pthread', 'c','nsl','rt' ,'lbestd'],
LIBPATH = ['lib'],
CPPPATH = ['.','lib/inc'],
LINKFLAGS = ['-mt']

['', '','',

To compile the source codes, simply do this:


To clear the objects and binaries, simply do this:

scons -c

Let me briefly explain the items in the SConstruct file.

By default, scons does define a simple compilation environment for you, if you write, you just need to write a line in SConstruct.


But the case above, I overwrite some environment variable’s value for my needs to build a complex application.

CXX is the variable defines you c++ compiler. My case, I change it to g++34.

You can check the default value by just insert a python print statement in your SConstruct file.

env = Environment()
print "CXX = ", env['CXX']

CCFLAGS defines compilation flags.
LIBS defines library to link.
LIBPATH defines additional library paths besides the system default.
CPPPATH defines include file paths.
LINKFLAGS defines compiler linker flags

After constructed the environment, just compile your binary by calling Program function.

scons have more features compiles java codes too and importantly it is cross platform. To know more? Check out the scons man pages ans well as user manual.

3 Responses to “Does scons outperforms autoconf and makefiles?”

  1. How exactly does this work with Linux, though?

  2. Hello webmaster I like your post ….

  3. It sounds like you’re creating problems yourself by trying to solve this issue instead of looking at why their is a problem in the first place

Leave a Reply