import os, glob

SetOption( 'num_jobs', 4 ) # Set this to the number of processors you have.  TODO: Automate this.

source_dir = './'
sources = glob.glob( os.path.join( source_dir, '*.cc' ) )
headers = glob.glob( os.path.join( source_dir, '*.h' ) )

DEBUG_FLAGS = [ '-g' ]
WARNING_FLAGS = [ '-Wall', '-W', '-Wshadow', '-Wpointer-arith', '-Wcast-qual', '-Wwrite-strings', '-Wconversion', '-Winline', '-Wredundant-decls', '-Wno-unused', '-Wno-deprecated', '-Wno-inline' ]
OPTIMIZATION_FLAGS = [ '-O3', '-march=athlon64', '-mfpmath=sse' ]

env = Environment()
env['ENV'] = {'PATH':os.environ['PATH'], 'TERM':os.environ['TERM'], 'HOME':os.environ['HOME']} # Environment variables required by colorgcc.
env['LIBPATH'] = [ './', '/usr/local/lib' ]
env['CCFLAGS'] = DEBUG_FLAGS + WARNING_FLAGS + OPTIMIZATION_FLAGS
env['CPPPATH'] = [ './' ]
env['LIBS'] = [ 'GLEW', 'm', 'ctemplate', 'boost_python', 'boost_thread', 'asound' ]
env['SHLIBPREFIX'] = ""

# For people compiling boost themselves:
#env['CPPPATH'] = [ './src', '/usr/local/include/boost-1_36' ]
#env['LIBS'] = [ 'GLEW', 'm', 'ctemplate', 'boost_python-gcc41-mt', 'boost_thread-gcc41-mt' ]

env.ParseConfig( 'python-config --includes' )
env.ParseConfig( 'python-config --ldflags' )

env.ParseConfig( 'pkg-config --cflags --libs jack' )

# Old python versions:
#env.ParseConfig( 'python2.4-config --includes' )
#env.ParseConfig( 'python2.4-config --ldflags' )

env.Program( source = sources, target = 'goodvibes' )

env.Command( 'tags', sources + headers, 'ctags -o $TARGET $SOURCES' )
