+#include <algorithm>
#include <msp/fs/stat.h>
#include <msp/fs/utils.h>
#include <msp/strings/format.h>
void Target::add_side_effect(Target &se)
{
side_effects.push_back(&se);
- se.add_dependency(*this);
if(tool)
se.set_tool(*tool);
se.primary_target = this;
bool self_ok = state!=BUILDING;
for(Dependencies::iterator i=depends.begin(); i!=depends.end(); ++i)
{
+ // Avoid infinite recursion if a target repends on its own side effect
+ if(find(side_effects.begin(), side_effects.end(), *i)!=side_effects.end())
+ continue;
+
Target *tgt = (*i)->get_buildable_target();
if(tgt)
return tgt;