From: Paul Brossier Date: Thu, 5 Nov 2009 23:08:21 +0000 (+0100) Subject: wscript: factorise build of extra source files X-Git-Tag: bzr2git~21 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=2359cbd4974a3e9ff99496d647ba12c232ad91bf;p=aubio.git wscript: factorise build of extra source files --- diff --git a/examples/wscript_build b/examples/wscript_build index 33b601a7..5215672f 100644 --- a/examples/wscript_build +++ b/examples/wscript_build @@ -1,25 +1,12 @@ # build examples -defines = ['AUBIO_PREFIX="' + bld.env['AUBIO_PREFIX'] + '"'] -defines += ['PACKAGE="' + bld.env['PACKAGE'] + '"'] - -extra_source = ['utils.c', 'sndfileio.c', 'jackio.c'] - -bld.new_task_gen(features = 'cc', - includes = '../src', - source = extra_source, - uselib = ['LASH'], - defines = defines, - target = 'utils_io') - # loop over all *.c filenames in examples to build them all for target_name in bld.path.ant_glob('*.c').split(): # ignore utils.c - if target_name in extra_source: continue + if target_name in ['utils.c', 'jackio.c', 'sndfileio.c']: continue bld.new_task_gen(features = 'cc cprogram', - add_objects = 'utils_io', + add_objects = 'utilsio', includes = '../src', - defines = defines, uselib = ['LASH', 'JACK', 'SNDFILE'], uselib_local = ['aubio'], source = target_name, diff --git a/python/aubio/wscript_build b/python/aubio/wscript_build index 34943f15..8ec4cc0e 100644 --- a/python/aubio/wscript_build +++ b/python/aubio/wscript_build @@ -1,9 +1,3 @@ -bld.new_task_gen(features = 'cc', - includes = '../../examples ../../src', - source = ['../../examples/sndfileio.c'], - uselib = ['JACK'], - target = 'sndfileio') - pyaubio = bld.new_task_gen(name = 'python-aubio', features = 'cc cshlib pyext', source = '../../swig/aubio.i', diff --git a/wscript b/wscript index 1b675457..b823b059 100644 --- a/wscript +++ b/wscript @@ -125,6 +125,8 @@ def build(bld): bld.env['VERSION'] = VERSION bld.env['LIB_VERSION'] = LIB_VERSION + build_extras(bld) + # add sub directories bld.add_subdirs('src examples') if bld.env['SWIG']: @@ -180,3 +182,20 @@ def build_tests(bld): this_target.uselib_local = ['aubio'] this_target.uselib = ['JACK'] this_target.source += ' examples/jackio.c' + +def build_extras(bld): + # corner cases to build these ones only once + sndfileio = bld.new_task_gen(features = 'cc', + includes = 'examples src', + source = ['examples/sndfileio.c'], + target = 'sndfileio') + + defines = ['AUBIO_PREFIX="' + bld.env['AUBIO_PREFIX'] + '"'] + defines += ['PACKAGE="' + bld.env['PACKAGE'] + '"'] + + utilsio = bld.new_task_gen(features = 'cc', + includes = 'examples src', + add_objects = 'sndfileio', + source = ['examples/utils.c', 'examples/jackio.c'], + defines = defines, + target = 'utilsio')