for some reason, when I find the matching targets, the action list is null but the other attributes are not.

void execute_actions(Rule *rule);
Rule *find_rule_make(char *target, Rule *rules);

void run_make(char *target, Rule *rules, int pflag) {
    Rule *rule = NULL;
    if (target == NULL) {
        rule = rules;
    } else {
        rule = find_rule_make(target, rules);
    }
    printf("%s\n", rule->target);

    Dependency *dep = rule->dependencies;
    while (dep != NULL) {
        if (pflag) {
            int pid = fork();
            if (pid == -1) {
                perror("fork");
                exit(1);
            } else if (pid == 0) {
                run_make(dep->rule->target, rules, 0);
                exit(0);
            }
        } else {
            run_make(dep->rule->target, rules, 0);
        }
        dep = dep->next_dep;
    }

    while (pflag && wait(NULL) != -1)
        ;

    struct stat target_stat;
    struct stat dep_stat;
    if (stat(rule->target, &target_stat) == -1) {
        execute_actions(rule);
        return;
    }

    dep = rule->dependencies;
    while (dep != NULL) {
        if (stat(dep->rule->target, &dep_stat) == -1 || target_stat.st_mtim.tv_sec < dep_stat.st_mtim.tv_sec ||
            (target_stat.st_mtim.tv_sec == dep_stat.st_mtim.tv_sec && target_stat.st_mtim.tv_nsec < dep_stat.st_mtim.tv_nsec)) {
            execute_actions(rule);
            return;
        }
        dep = dep->next_dep;
    }

    execute_actions(rule);
}

Rule *find_rule_make(char *target, Rule *rules) {
    Rule *cur_rule = rules;
    while (cur_rule != NULL) {
        if (strcmp(cur_rule->target, target) == 0) {
            return cur_rule;
        }
        cur_rule = cur_rule->next_rule;
    }
    return NULL;
}
