Building the compiler first

The example below demonstrates how to build a compiler which is used for building the remaining targets. The requirements are the following:

This scenario demonstrates the bld.add_group to segment the build into strictly sequential parts:

def build(bld):
	env = bld.env_of_name('default')

	import Task, ocaml
	ocaml.open_re = re.compile('open ([a-zA-Z]+)', re.M)

	Task.simple_task_type('ts2qm', '${QT_LRELEASE} ${SRC} -qm ${TGT} 2> /dev/null', color='RED')
	Task.task_type_from_func('py2rcc', vars=[], func=compile_py, color='BLUE')

	bld.new_task_gen(
		features='ocaml native', 1
		include = 'util',
		source = bld.path.ant_glob('util/*.ml'),
		target = 'util/ocaml+twt',
		are_deps_set = 1,
		uselib='PP')

	bld.add_group() 2

	bld.new_task-gen(
		features = 'ocaml c_object', 3
		source = 'src/armtlkto.c ' + bld.path.ant_glob('src/*.ml'),
		includes = '. src',
		target = 'camlprog',
		are_deps_set = 1,
		uselib = 'TWT',
		add_objects = [])
		

1

Create the compiler.

2

Create a new group

3

The rest of the build follows