你跑 python waf configure 配置项目。之后,使用命令构建变体 build_a 和 build_b
python waf configure
build_a
build_b
def configure(ctx): load('compiler_c') def build(bld): if not bld.variant: bld.fatal('call "waf build_a" or "waf build_b", and try "waf --help"') if bld.variant == 'a': bld.program(source='a.c', target='app', includes='.') elif bld.variant == 'b': bld.program(source='b.c', target='app', includes='.') else: bld.fatal('"') # create build and clean commands for each build context from waflib.Build import BuildContext, CleanContext for x in 'a b'.split(): for y in (BuildContext, CleanContext): name = y.__name__.replace('Context','').lower() class tmp(y): __doc__ = '''executes the {} of {}'''.format(name, x) cmd = name + '_' + x variant = x