This code recursively evaluates rules by comparing the most recent modification time.
void evaluate_rule(Rule *rule, struct stat *parent_stat){
  // given some conditions, execute action of the rule (compares dependencies)
  struct stat rule_stat;
  stat(rule->target, &rule_stat);

  Dependency *cur_dep = rule->dependencies;
  if(cur_dep != NULL){
    // recursively call on dependency rules
    while(cur_dep != NULL){
      evaluate_rule(cur_dep->rule, &rule_stat);
      cur_dep = cur_dep->next_dep;
    }
  }
  printf("%s %s", "Cur rule: ", rule->target);
  if(rule->dependencies == NULL){
    execute_action(rule->target, rule->actions);
  }
  // retrieve modified time
  if(&rule_stat.st_mtim == NULL){
    printf("%s\n", " has null mod time");
  } else {
    printf("%s %ld\n", ", mod_time: ", rule_stat.st_mtim.tv_sec);
  }
  if(parent_stat != NULL){
    if(rule_stat.st_mtim.tv_sec > parent_stat->st_mtim.tv_sec){
      execute_action(rule->target, rule->actions);
    } else if(rule_stat.st_mtim.tv_sec == parent_stat->st_mtim.tv_sec){
      if(rule_stat.st_mtim.tv_nsec > parent_stat->st_mtim.tv_nsec){
        execute_action(rule->target, rule->actions);
      }
    }
  } else {
    execute_action(rule->target, rule->actions);
  }
}