import SCons import os root_env = Environment(ENV = {'PATH': os.environ['PATH']}) # Beautify output. if ARGUMENTS.get('V', '0') != '1': root_env['CCCOMSTR'] = ' CC $TARGET' root_env['RUSTCCOMSTR'] = ' RUSTC $TARGET' root_env['LINKCOMSTR'] = ' LINK $TARGET' root_env['ARCOMSTR'] = ' AR $TARGET' root_env['RANLIBCOMSTR'] = ' RANLIB $TARGET' root_env['OBJCOPYCOMSTR'] = ' OBJCOPY $TARGET' # Make colored output of e.g. gcc work. root_env['ENV']['TERM'] = os.environ.get('TERM') root_env.Append(CCFLAGS = [ '-std=gnu99', '-Wall', '-Wextra', '-Wwrite-strings', ]) root_env.Append(RUSTC = 'rustc') root_env.Append(BUILDERS = { 'Rustc': Builder( action=Action('$RUSTC $RUSTCFLAGS -o $TARGET $SOURCE', '$RUSTCCOMSTR'))}) root_env.Append(BUILDERS = { 'Objcopy': Builder( action=Action('$OBJCOPY -O binary $OBJCOPYFLAGS $SOURCES $TARGET', '$OBJCOPYCOMSTR'), suffix='.bin', src_suffix='.elf')}) env = root_env.Clone() env['variant_dir'] = 'build-target' env['LIBPATH'] = env['variant_dir'] SConscript('SConscript.target', exports='env', variant_dir=env['variant_dir'], duplicate=0) env = root_env.Clone() env['variant_dir'] = 'build-test' env['LIBPATH'] = env['variant_dir'] SConscript('SConscript.test', exports='env', variant_dir=env['variant_dir'], duplicate=0)