the problem is this is how the Makefile prints:
main : linked_list.o main.o
 : 
        gcc -Wall -g -std=gnu99 -o main linked_list.o main.o
as you can see, there is a line below the target line with a colon that is not supposed to be there. What is causing this in my code? 
/* Read from the open file fp, and create the linked data structure
   that represents the Makefile contained in the file.
   See the top of pmake.h for the specification of Makefile contents.
 */
Rule *parse_file(FILE *fp) {
     char line[MAXLINE];
    Rule *head = NULL, *current = NULL;

    while (fgets(line, MAXLINE, fp)) {
        if (strlen(line) == MAXLINE - 1 && line[MAXLINE - 2] != '\n') {
            fprintf(stderr, "ERROR: Line too long\n");
            exit(1);
        }

        // Ignore empty lines and comments
        if (line[0] == '\n' || line[0] == '#') {
            continue;
        }

        // If the line starts with a tab, it's an action line
        if (line[0] == '\t') {
            if (current == NULL) {
                fprintf(stderr, "ERROR: Action line without target\n");
                exit(1);
            }
            Action *act = (Action *) malloc(sizeof(Action));
            act->args = (char **) malloc(sizeof(char *) * MAXLINE);

            // Parse the command into an array of strings
            char *arg = strtok(line, " \t\n");
            int i = 0;
            while (arg != NULL) {
                act->args[i] = strdup(arg);
                i++;
                if (i >= MAXLINE - 1) {
                    fprintf(stderr, "ERROR: Too many arguments in action line\n");
                    exit(1);
                }
                arg = strtok(NULL, " \t\n");
            }
            act->args[i] = NULL;
            act->next_act = NULL;

            // Attach the action to the current rule
            if (current->actions == NULL) {
                current->actions = act;
            } else {
                Action *act_curr = current->actions;
                while (act_curr->next_act != NULL) {
                    act_curr = act_curr->next_act;
                }
                act_curr->next_act = act;
            }

        } else {  // It's a target line
            if (current != NULL && current->target == NULL) {
                fprintf(stderr, "ERROR: Empty target\n");
                exit(1);
            }
            else {
                // Parse the target name and create a new Rule node for this target
                Rule *rule = (Rule *) malloc(sizeof(Rule));
                rule->target = strdup(&line[strspn(line, " \t")]);
              
                // Initialize the list of dependencies for this rule
                rule->dependencies = NULL;

                // Process the dependencies
                char *dep_str = strtok(NULL, " \t\n");
                while (dep_str != NULL) {
                    // Skip the target name if it's the first token returned by strtok
                    if (strcmp(dep_str, rule->target) == 0) {
                        dep_str = strtok(NULL, " \t\n");
                        continue;
                    }

                    // Create a new dependency node
                    Dependency *dep = (Dependency *) malloc(sizeof(Dependency));
                    dep->rule = (Rule *) malloc(sizeof(Rule));
                    dep->rule->target = strdup(dep_str);
                    dep->next_dep = NULL;

                    // Attach the dependency to the current rule
                    if (rule->dependencies == NULL) {
                        rule->dependencies = dep;
                     } else {
                        Dependency *dep_curr = rule->dependencies;
                        while (dep_curr->next_dep != NULL) {
                            dep_curr = dep_curr->next_dep;
                        }
                        dep_curr->next_dep = dep;
                    }

                    // Read the next token from the current line
                    dep_str = strtok(NULL, " \t\n");
                }

            // Attach the rule to the list of rules
            rule->actions = NULL;
            rule->next_rule = NULL;
            if (head == NULL) {
                head = rule;
            } else {
                current->next_rule = rule;
            }
            current = rule;
            }
        }
    }

    return head;
}
