X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fbinarycomponent.cpp;h=49c4897ce69d7d25492ebe1521257dca04c77062;hb=9dd42116ce72f8b2288ab535f89242f87a44337a;hp=09a47fc8a5cb19ed61af9947f36df9f69bc6e8e5;hpb=d0ad2256a21b9e83ad408564a1521b98617f20ba;p=builder.git diff --git a/source/binarycomponent.cpp b/source/binarycomponent.cpp index 09a47fc..49c4897 100644 --- a/source/binarycomponent.cpp +++ b/source/binarycomponent.cpp @@ -32,7 +32,7 @@ void BinaryComponent::create_build_info() if(!(*i)->get_install()) { build_info.libmodes[(*i)->get_name()] = BuildInfo::STATIC; - build_info.libpath.push_back((*i)->get_package().get_source_directory()); + build_info.libpath.push_back((*i)->get_package().get_output_directory()); } } @@ -56,7 +56,7 @@ void BinaryComponent::create_targets() const list objs; SourceList source_filenames = collect_source_files(); - for(SourceList::const_iterator i=source_filenames.begin(); i!=source_filenames.end(); ++i) + for(SourceList::iterator i=source_filenames.begin(); i!=source_filenames.end(); ++i) { string ext = FS::extpart(FS::basename(*i)); Target *src = 0; @@ -64,12 +64,30 @@ void BinaryComponent::create_targets() const Tool *gen = pkg_tools.get_tool_for_suffix(ext); if(gen) { - Target *tmpl = gen->create_source(*this, *i); - if(tmpl) + list templates; + templates.push_back(gen->create_source(*this, *i)); + + Tool::ProcessingUnit processing_unit = gen->get_processing_unit(); + if(processing_unit!=Tool::ONE_FILE) { - src = gen->create_target(*tmpl); - ext = FS::extpart(FS::basename(dynamic_cast(*src).get_path())); + FS::Path source_dir = FS::dirname(*i); + SourceList::iterator j = i; + for(++j; j!=source_filenames.end(); ) + { + if((processing_unit!=Tool::DIRECTORY || FS::dirname(*j)==source_dir) && + pkg_tools.get_tool_for_suffix(FS::extpart(FS::basename(*j)))==gen) + { + templates.push_back(gen->create_source(*this, *j)); + // Remove additional files so they won't get processed again + source_filenames.erase(j++); + } + else + ++j; + } } + + src = gen->create_target(templates); + ext = FS::extpart(FS::basename(dynamic_cast(*src).get_path())); } Tool *tool = toolchain.get_tool_for_suffix(ext, true);