#!/usr/bin/env python

top = '../..'

def build(ctx):
	objs = []
	obj = lambda src: objs.append(src)

	if ctx.env.SOSC_NO_ZEROCONF:
		obj('zeroconf/dummy.c')
	else:
		obj('zeroconf/common.c')

		if ctx.env.DEST_OS[:3] == "win":
			obj('zeroconf/windows.c')
		elif ctx.env.DEST_OS == 'linux':
			obj('zeroconf/not_darwin.c')
		elif ctx.env.DEST_OS == 'darwin':
			obj('zeroconf/darwin.c')

	if ctx.env.DEST_OS[:3] == "win":
		obj('event_loop/windows.c')
	elif ctx.is_defined("HAVE_WORKING_POLL"):
		obj('event_loop/poll.c')
	else:
		obj('event_loop/select.c')

	obj('osc/mext_methods.c')
	obj('osc/sys_methods.c')
	obj('osc/util.c')

	obj('server.c')
	obj('config.c')

	obj('main.c')

	ctx.program(
		source=objs,
		target='../../bin/serialosc-device',

		use='serialosc-common LO LIBMONOME DNSSD_INC DL LIBUV confuse')
