checks if the target exists. if not, then create a Rule and add it to the last node
Rule *create_target(Rule *rule, char *target_name) {
    Rule *curr = rule;
    // iterate over the rule node to check if the target already exists
    while (curr != NULL) {
        if (curr->target == target_name) {

            return curr;
    // if target does not exist, then create a new rule with the target
    // and add it to next to the last rule
        } else if (curr->next_rule == NULL) {
            Rule *new_rule;
            new_rule = malloc(sizeof(Rule));
            if (new_rule == NULL) {
	            perror("malloc");
	            exit(1);
            }
            int target_size = strlen(target_name) + 1;
            new_rule->target = malloc(target_size * sizeof(char *));
            if (new_rule->target == NULL) {
	            perror("malloc new target");
	            exit(1);
            }
            strcpy(new_rule->target, target_name);
            // new_rule->target[-1] = '\0';
            new_rule->next_rule = NULL;
            curr->next_rule = new_rule;
            curr = curr->next_rule;
            return new_rule;
        }
        curr = curr->next_rule;
    }
    return curr;
} 