- for(list<Target *>::iterator i=dep_libs.begin(); i!=dep_libs.end(); ++i)
- {
- bool last=true;
- for(list<Target *>::iterator j=i; (last && j!=dep_libs.end()); ++j)
- last=(j==i || *j!=*i);
- if(last)
- add_depend(*i);
- }
-
- deps_ready=true;
-}
-
-Action *Binary::create_action()
-{
- return new Link(builder, *this);
-}
-
-FS::Path Binary::generate_target_path(const Component &c)
-{
- const SourcePackage &pkg=c.get_package();
- string prefix, suffix;
- const string &arch=pkg.get_builder().get_current_arch().get_name();
-
- if(c.get_type()==Component::LIBRARY)
- {
- prefix="lib";
- if(arch=="win32")
- suffix=".dll";
- else
- suffix=".so";
- }
- else if(c.get_type()==Component::MODULE)
- suffix=".m";
- else if(c.get_type()==Component::PROGRAM)
- {
- if(arch=="win32")
- suffix=".exe";
- }
-
- return pkg.get_out_dir()/(prefix+c.get_name()+suffix);
+ for(auto i=dep_libs.begin(); i!=dep_libs.end(); ++i)
+ if(!any_of(next(i), dep_libs.end(), [i](Target *d){ return d==*i; }))
+ add_dependency(**i);