X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=senfscons%2FSENFSCons.py;h=c676f3476d404f70748a4f6b56c6a7863b0e77b0;hb=9357448dc66bc9acfd3bd8db423deb75bcd6a2c4;hp=d87f229e944c7f0b53d9d90749693c0cca20dd4b;hpb=ad1b2f1e3dc6efcf38b37201bfa7424295ef9582;p=senf.git diff --git a/senfscons/SENFSCons.py b/senfscons/SENFSCons.py index d87f229..c676f34 100644 --- a/senfscons/SENFSCons.py +++ b/senfscons/SENFSCons.py @@ -292,7 +292,7 @@ def LibPath(lib): return '$LOCALLIBDIR/lib%s.a' % lib # provide both \a sources and \a testSources. # # \ingroup target -def Objects(env, sources, testSources = None, LIBS = []): +def Objects(env, sources, testSources = None, LIBS = [], OBJECTS = []): if type(sources) == type(()): testSources = sources[1] sources = sources[0] @@ -307,6 +307,7 @@ def Objects(env, sources, testSources = None, LIBS = []): source = sources, test_source = testSources, LIBS = LIBS, + OBJECTS = OBJECTS, DEPENDS = [ env.File(LibPath(x)) for x in LIBS ]) env.Alias('all_tests', test) # Hmm ... here I'd like to use an Alias instead of a file @@ -493,8 +494,8 @@ def DoxyXRef(env, docs=None, # The library is added to the list of default targets. # #\ingroup target -def Lib(env, library, sources, testSources = None, LIBS = []): - objects = Objects(env,sources,testSources,LIBS=LIBS) +def Lib(env, library, sources, testSources = None, LIBS = [], OBJECTS = []): + objects = Objects(env,sources,testSources,LIBS=LIBS,OBJECTS=OBJECTS) lib = None if objects: lib = env.Library(env.File(LibPath(library)),objects) @@ -502,6 +503,15 @@ def Lib(env, library, sources, testSources = None, LIBS = []): env.Append(ALLLIBS = library) return lib +## \brief Build Object from multiple sources +def Object(env, target, sources, testSources = None, LIBS = [], OBJECTS = []): + objects = Objects(env,sources,testSources,LIBS=LIBS,OBJECTS=OBJECTS) + ob = None + if objects: + ob = env.Command(target+".o", objects, "ld -r -o $TARGET $SOURCES") + env.Default(ob) + return ob + ## \brief Build executable # # This target helper will build the given binary. The \a sources, \a @@ -512,13 +522,13 @@ def Lib(env, library, sources, testSources = None, LIBS = []): # construction environment parameters or the framework helpers. # # \ingroup target -def Binary(env, binary, sources, testSources = None, LIBS = []): - objects = Objects(env,sources,testSources,LIBS=LIBS) +def Binary(env, binary, sources, testSources = None, LIBS = [], OBJECTS = []): + objects = Objects(env,sources,testSources,LIBS=LIBS,OBJECTS=OBJECTS) program = None if objects: progEnv = env.Copy() progEnv.Prepend(LIBS = LIBS) - program = progEnv.Program(target=binary,source=objects) + program = progEnv.Program(target=binary,source=objects+OBJECTS) env.Default(program) env.Depends(program, [ env.File(LibPath(x)) for x in LIBS ]) return program