void run_make(char* target, Rule* rules, int pflag) {
    Rule* target_rule = NULL;

    target_rule = rules;
}
else {
    int check_target = 0;
    Rule* curr_rule = rules;
    while (curr_rule != NULL) {
        if (strcmp(curr_rule->target, target) == 0) {
            target_rule = curr_rule;
            check_target = 1;
            break;
        }
        curr_rule = curr_rule->next_rule;
    }
    if (check_target == 0 && target != NULL) {
        fprintf(stderr, "Error: no rule found for target '%s'\n", target);
        exit(1);
    }
}

int check_update;
if (target_rule->dependencies != NULL) {
    Dependency* curr_dep = target_rule->dependencies;
    while (curr_dep != NULL) {
        Rule* curr_rule2 = rules;
        int dependency_is_target = 0;
        if (strcmp(curr_dep->rule->target, curr_rule2->target) == 0) {
            dependency_is_target = 1;
            break;
        }
        curr_rule2 = curr_rule2->next_rule;
    }
    if (dependency_is_target == 0) {
        curr_dep = curr_dep->next_dep;
        continue;
    }
    if (pflag == 0) {
        run_make(curr_dep->rule->target, rules, pflag);
    } else {
        int rp = fork();
        if (rp == 0) {
            run_make(curr_dep->rule->target, rules, pflag);
            exit(0);
        } else if (rp < 0) {
            perror("fork");
            exit(1);
        }
    }
    curr_dep = curr_dep->next_dep;
}
if (pflag == 1) {
    int p_status;
    while (wait(&p_status) > 0) {
        if (!WIFEXITED(p_status) || WEXITSTATUS(p_status) != 0) {
            exit(1);
        }
    }
}