461 |
|
|
462 |
struct file *default_goal_file; |
struct file *default_goal_file; |
463 |
|
|
464 |
|
/* Pointer to the value of the .DEFAULT_TARGET special |
465 |
|
variable. */ |
466 |
|
char ** default_target_name; |
467 |
|
|
468 |
/* Pointer to structure for the file .DEFAULT |
/* Pointer to structure for the file .DEFAULT |
469 |
whose commands are used for any file that has none of its own. |
whose commands are used for any file that has none of its own. |
470 |
This is zero if the makefiles do not define .DEFAULT. */ |
This is zero if the makefiles do not define .DEFAULT. */ |
1541 |
/* Define the default variables. */ |
/* Define the default variables. */ |
1542 |
define_default_variables (); |
define_default_variables (); |
1543 |
|
|
|
/* Read all the makefiles. */ |
|
|
|
|
1544 |
default_file = enter_file (".DEFAULT"); |
default_file = enter_file (".DEFAULT"); |
1545 |
|
|
1546 |
|
{ |
1547 |
|
struct variable *v = define_variable ( |
1548 |
|
".DEFAULT_TARGET", 15, "", o_default, 0); |
1549 |
|
|
1550 |
|
default_target_name = &v->value; |
1551 |
|
} |
1552 |
|
|
1553 |
|
/* Read all the makefiles. */ |
1554 |
|
|
1555 |
read_makefiles |
read_makefiles |
1556 |
= read_all_makefiles (makefiles == 0 ? (char **) 0 : makefiles->list); |
= read_all_makefiles (makefiles == 0 ? (char **) 0 : makefiles->list); |
1557 |
|
|
2069 |
/* If there were no command-line goals, use the default. */ |
/* If there were no command-line goals, use the default. */ |
2070 |
if (goals == 0) |
if (goals == 0) |
2071 |
{ |
{ |
2072 |
if (default_goal_file != 0) |
if (**default_target_name != '\0') |
2073 |
{ |
{ |
2074 |
goals = (struct dep *) xmalloc (sizeof (struct dep)); |
if (default_goal_file == 0 || |
2075 |
goals->next = 0; |
strcmp (*default_target_name, default_goal_file->name) != 0) |
2076 |
goals->name = 0; |
{ |
2077 |
|
default_goal_file = lookup_file (*default_target_name); |
2078 |
|
|
2079 |
|
/* In case user set .DEFAULT_TARGET to a non-existent target |
2080 |
|
name let's just enter this name into the table and let |
2081 |
|
the standard logic sort it out. */ |
2082 |
|
if (default_goal_file == 0) |
2083 |
|
{ |
2084 |
|
struct nameseq *ns; |
2085 |
|
char *p = *default_target_name; |
2086 |
|
|
2087 |
|
ns = multi_glob ( |
2088 |
|
parse_file_seq (&p, '\0', sizeof (struct nameseq), 1), |
2089 |
|
sizeof (struct nameseq)); |
2090 |
|
|
2091 |
|
/* .DEFAULT_TARGET should contain one target. */ |
2092 |
|
if (ns->next != 0) |
2093 |
|
fatal (NILF, _(".DEFAULT_TARGET contains more than one target")); |
2094 |
|
|
2095 |
|
default_goal_file = enter_file (ns->name); |
2096 |
|
|
2097 |
|
ns->name = 0; /* It was reused by enter_file(). */ |
2098 |
|
free_ns_chain (ns); |
2099 |
|
} |
2100 |
|
} |
2101 |
|
|
2102 |
|
goals = (struct dep *) xmalloc (sizeof (struct dep)); |
2103 |
|
goals->next = 0; |
2104 |
|
goals->name = 0; |
2105 |
goals->ignore_mtime = 0; |
goals->ignore_mtime = 0; |
2106 |
goals->file = default_goal_file; |
goals->file = default_goal_file; |
2107 |
} |
} |
2108 |
} |
} |
2109 |
else |
else |
2110 |
lastgoal->next = 0; |
lastgoal->next = 0; |
2111 |
|
|
2112 |
|
|
2113 |
if (!goals) |
if (!goals) |
2114 |
{ |
{ |
2115 |
if (read_makefiles == 0) |
if (read_makefiles == 0) |