row.push_back("Rebuild");
table.push_back(row);
- const Target &cmdline = *builder.get_target("cmdline");
+ Target &cmdline = *builder.get_target("cmdline");
if(mode==RDEPS)
{
const TargetList &deps = cmdline.get_depends();
print_table();
}
-void Analyzer::build_depend_table(const Target &tgt, unsigned depth)
+void Analyzer::build_depend_table(Target &tgt, unsigned depth)
{
+ Target *real = tgt.get_real_target();
if(mode==DEPS)
{
// Skip trivial targets
+ if(real!=&tgt)
+ return build_depend_table(*real, depth);
if(const ObjectFile *obj = dynamic_cast<const ObjectFile *>(&tgt))
return build_depend_table(obj->get_source(), depth);
- else if(const Install *inst = dynamic_cast<const Install *>(&tgt))
- return build_depend_table(inst->get_source(), depth);
}
- else if(mode==REBUILD && !tgt.get_rebuild())
+ else if(mode==REBUILD && !tgt.get_rebuild() && !real->get_rebuild())
/* All targets that depend on to-be-built targets will be rebuilt
- themselves, so we cn stop here. */
+ themselves, so we can stop here. */
return;
TableRow row;
/**
Adds rows to the table for the given target and its dependencies.
*/
- void build_depend_table(const Target &, unsigned);
+ void build_depend_table(Target &, unsigned);
/**
Prints out the table that resulted from the analysis.
// Make the cmdline target depend on all targets mentioned on the command line
Target *cmdline = new VirtualTarget(*this, "cmdline");
- bool build_world = false;
for(list<string>::iterator i=cmdline_targets.begin(); i!=cmdline_targets.end(); ++i)
{
Target *tgt = get_target(*i);
IO::print("I don't know anything about %s\n", *i);
return -1;
}
- if(tgt==world)
- build_world = true;
+
cmdline->add_depend(tgt);
}
if(type==LIBRARY)
if(SharedLibrary *shlib = dynamic_cast<SharedLibrary *>(*i))
- inst_tgt->add_depend(new Symlink(builder, pkg, *inst, shlib->get_name()));
+ if(!shlib->get_soname().empty())
+ inst_tgt->add_depend(new Symlink(builder, pkg, *inst, shlib->get_name()));
}
}
mark_rebuild((*i)->get_name()+" has changed");
else if((*i)->get_rebuild())
mark_rebuild((*i)->get_name()+" needs rebuilding");
+ else
+ {
+ Target *real = ft->get_real_target();
+ if(real->get_rebuild())
+ mark_rebuild(real->get_name()+" needs rebuilding");
+ }
}
}
export_binfo.libpath.push_back((builder.get_prefix()/"lib").str());
string optimize = config.get_option("optimize").value;
- if(lexical_cast<unsigned>(optimize))
+ if(!optimize.empty() && optimize!="0")
{
build_info.cflags.push_back("-O"+optimize);
build_info.ldflags.push_back("-O"+optimize);
add_depend(&target);
}
+Target *Symlink::get_buildable_target()
+{
+ return target.get_buildable_target();
+}
+
Target *Symlink::get_real_target()
{
return target.get_real_target();
virtual const char *get_type() const { return "Symlink";}
FileTarget &get_target() const { return target; }
+ virtual Target *get_buildable_target();
virtual Target *get_real_target();
private:
virtual void check_rebuild();
dependencies are up-to-date, returns this target. If there are no targets
ready to be built (maybe because they are being built right now), returns 0.
*/
- Target *get_buildable_target();
+ virtual Target *get_buildable_target();
/**
If this target is a proxy for another (such as Install or Symlink), return