import os
import glob

# MyBuilder
bld = Builder(
    action = 'CL.exe /nologo /TP /E /I include00 /I include01 /I include02 /FI script_header_common01.h /FI script_header_common02.h /D=XXX /D=YYY $SOURCE > $TARGET',
    suffix = '.script.i',
    src_suffix = '.script',
)

# Regist MyBuilder
env = Environment(
    ENV = os.environ,
    BUILDERS = {'MyBuilder' : bld},
    #NG...
    #CPP = 'CL.exe',
    #CPPSUFFIXES = [ '.script' ],
    #CPPFLAGS = '/nologo /TP /E /I include00 /I include01 /I include02 /FI script_header_common01.h /FI script_header_common02.h /D=XXX /D=YYY $SOURCE',
    #CPPPATH = [ '.', 'include00', 'include01', 'include02' ],
    #CPPDEFINES = [ "XXX", "YYY" ],
)

# Source files
input_files = [
    'src/test00.script',
    'src/test01/test01.script',
    'src/test02/test02a.script',
    'src/test02/test02b.script',
]

# Run
#for input_file in [ glob.glob('src/*.script'), glob.glob('src/*/*.script') ]: #NG
#for input_file in glob.iglob('src/*.script'): #NG
for input_file in input_files:
    #print '\t', input_file
    env.MyBuilder(input_file)
    #env.Program(input_file)
