простейший рекурсивный пример для scons

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
import os, fnmatch
def locate(pattern, root=os.curdir):
'''Locate all files matching supplied filename pattern in and below
supplied root directory.'''
for path, dirs, files in os.walk(os.path.abspath(root)):
for filename in fnmatch.filter(files, pattern):
yield os.path.join(path, filename)
files = []
for file in locate('*.cpp') :
print file
files.append(file)
print files
Program('program', files, LIBS=['log4cpp'])