#! /usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2010 (ita)

"""
Define build commands for several variants at once
Try executing
$ waf clean_debug build_debug clean_release build_release
"""

VERSION='0.0.1'
APPNAME='cc_test'

top = '.'
out = 'build'

def options(opt):
	opt.load('compiler_c')

def configure(conf):
	conf.setenv('debug')
	conf.load('compiler_c')
	conf.env.CFLAGS = ['-g']

	conf.setenv('release')
	conf.load('compiler_c')
	conf.env.CFLAGS = ['-O2']

def build(bld):
	if not bld.variant:
		bld.fatal('call "waf build_debug" or "waf build_release", and try "waf --help"')
	bld.program(source='main.c', target='app', includes='.')

from waflib.Build import BuildContext, CleanContext, \
	InstallContext, UninstallContext

for x in 'debug release'.split():
	for y in (BuildContext, CleanContext, InstallContext, UninstallContext):
		name = y.__name__.replace('Context','').lower()
		class tmp(y):
			cmd = name + '_' + x
			variant = x

