- argv.push_back(exe.get_name());
- const list<Target *> &deps=exe.get_depends();
- for(list<Target *>::const_iterator i=deps.begin(); i!=deps.end(); ++i)
- if(dynamic_cast<ObjectFile *>(*i))
+ argv.push_back(relative(exe.get_name(), work_dir).str());
+ const TargetList &deps=exe.get_depends();
+ for(TargetList::const_iterator i=deps.begin(); i!=deps.end(); ++i)
+ {
+ Target *tgt=*i;
+ if(dynamic_cast<Install *>(tgt))
+ tgt=tgt->get_depends().front();
+
+ if(dynamic_cast<ObjectFile *>(tgt))
+ argv.push_back(relative((*i)->get_name(), work_dir).str());
+ else if(SharedLibrary *shlib=dynamic_cast<SharedLibrary *>(tgt))
+ argv.push_back("-l"+shlib->get_libname());
+ else if(dynamic_cast<StaticLibrary *>(tgt))