import os
from waflib import Options, Errors
from waflib.Build import BuildContext, CleanContext

CONFIGS = [
    'COUNT4_LONG',
    'COUNT64_LONG',
    'COUNT4_SHORT',
    'COUNT64_SHORT',
]

def create_waf_contexts(configs):
    for test_name in configs:
        for ctx in (BuildContext, CleanContext):
            raw_context = ctx.__name__.replace('Context', '').lower()

            class tmp(ctx):
                cmd = raw_context + '_' + test_name
                variant = test_name
                variant = os.path.split(os.getcwd())[1] + '_' + variant 

create_waf_contexts(CONFIGS)

def options(opt):
    opt.load('xwaf.xcommon')


def configure(conf):
    conf.load('xwaf.xcommon')


def configure(conf):
    conf.load('xwaf.compiler_xcc')


def build(bld):
    bld.do_xcommon()


def dist(dst):
    dst.load('xwaf.xcommon')


def distcheck(dst):
    dst.load('xwaf.xcommon')
