go through target_rule's nodes of dependencies and save the last modified time present in any dependency
struct stat st;
    st.st_mtim.tv_sec = 0;
    struct stat last_mod_time;
    last_mod_time.st_mtim.tv_sec = 0;
    while (target_rule->dependencies != NULL){
        if(stat(dep->rule->target, &st) == 0){
            if(last_mod_time.st_mtim.tv_sec == 0){
                last_mod_time = st;
            } else {
                if(difftime(st, last_mod_time) > 0){
                    last_mod_time = st;
                }
            }
          }
    }
