From ec442f970358dd67c2dbc20bba3f50d1a7197829 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Thu, 8 Feb 2007 22:13:27 +0000 Subject: build doesn't tollerate duplicates anymore. --- src/rule.cpp | 19 +++++++++++++++++++ src/targetfile.cpp | 20 ++++++++++++++++++++ 2 files changed, 39 insertions(+) (limited to 'src') diff --git a/src/rule.cpp b/src/rule.cpp index 2f87d85..7924ba4 100644 --- a/src/rule.cpp +++ b/src/rule.cpp @@ -3,6 +3,8 @@ #include "function.h" #include "perform.h" +#include + Rule::Rule() : pAggregate( NULL ) { @@ -46,6 +48,23 @@ StringList Rule::execute( Build &bld, StringList &lInput, PerformList &lPerf, bo lProduces.push_back( sTarget ); } + { + std::set sUsed; + for( StringList::iterator i = lInput.begin(); i != lInput.end(); i++ ) + { +isuck: if( i == lInput.end() ) break; + if( sUsed.find( *i ) != sUsed.end() ) + { + StringList::iterator j = i; + j++; + lInput.erase( i ); + i = j; + goto isuck; + } + sUsed.insert( *i ); + } + } + StringList lNewOut; if( pAggregate ) { diff --git a/src/targetfile.cpp b/src/targetfile.cpp index 4cf5361..73cd3ff 100644 --- a/src/targetfile.cpp +++ b/src/targetfile.cpp @@ -6,6 +6,8 @@ #include "function.h" #include "viewer.h" +#include + PluginInterface2(file, TargetFile, Target, "Mike Buland", 0, 1 ); TargetFile::TargetFile() @@ -23,6 +25,24 @@ void TargetFile::check( Build &bld ) pRule->setTarget( getName() ); StringList lFinal = pRule->execute( bld, getInput(), lPerf ); + { + std::set sUsed; + for( PerformList::iterator i = lPerf.begin(); i != lPerf.end(); i++ ) + { +isuck: if( i == lPerf.end() ) break; + if( sUsed.find( (*i)->getTarget() ) != sUsed.end() ) + { + PerformList::iterator j = i; + j++; + delete *i; + lPerf.erase( i ); + i = j; + goto isuck; + } + sUsed.insert( (*i)->getTarget() ); + } + } + bld.getView()->beginPerforms( lPerf.size() ); for( PerformList::iterator i = lPerf.begin(); i != lPerf.end(); i++ ) -- cgit v1.2.3