importglob#assumes project name is the build directory name is the executable name...project='myprogram'#holds project namebuildroot='../debug'#holds root of the build directory treecflags=['-W1','-GX']#some additional compile flags#-------#From here on will be common to all projectsbuilddir=buildroot+'/'+project#holds build directory nametargetpath=builddir+'/'+project#holds path to executable in the build directoryenv=Environment()#if cflags is defined, don't anything, otherwise append #the user's compile flags to the current compile flagstry:cflagsexceptNameError:passelse:env.Append(CCFLAGS=cflags)#set up the build directoryBuildDir('#'+builddir,"#.",duplicate=0)env.Program(targetpath,source=map(lambdax:'#'+builddir+'/'+x,glob.glob('*.cpp')))