"""Build crt_launch"""

CRT_LAUNCH = 'crt_launch.c'


def scons():
    """scons function"""
    Import('env')

    tenv = env.Clone()

    libs = ['dpar', 'cart', 'gurt', 'pthread', 'm']

    tenv.AppendUnique(LIBS=libs)
    tenv.require('mercury')
    tenv.AppendUnique(FLAGS='-pthread')

    crt_launch = tenv.d_program(CRT_LAUNCH, LIBS=libs)

    tenv.Install('$PREFIX/bin', crt_launch)


if __name__ == "SCons.Script":
    scons()
