shithub: aubio

Download patch

ref: 2359cbd4974a3e9ff99496d647ba12c232ad91bf
parent: 3e17aed37ad2b2c7b1d5b7e4e0900b183416e058
author: Paul Brossier <piem@piem.org>
date: Thu Nov 5 19:08:21 EST 2009

wscript: factorise build of extra source files

--- 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,
--- 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',
--- a/wscript
+++ b/wscript
@@ -125,6 +125,8 @@
   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 @@
       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')