218 |
|
|
219 |
unsigned int job_slots = 1; |
unsigned int job_slots = 1; |
220 |
unsigned int default_job_slots = 1; |
unsigned int default_job_slots = 1; |
221 |
|
static unsigned int master_job_slots = 0; |
222 |
|
|
223 |
/* Value of job_slots that means no limit. */ |
/* Value of job_slots that means no limit. */ |
224 |
|
|
470 |
|
|
471 |
struct file *default_goal_file; |
struct file *default_goal_file; |
472 |
|
|
473 |
/* Pointer to the value of the .DEFAULT_TARGET special |
/* Pointer to the value of the .DEFAULT_GOAL special |
474 |
variable. */ |
variable. */ |
475 |
char ** default_target_name; |
char ** default_goal_name; |
476 |
|
|
477 |
/* Pointer to structure for the file .DEFAULT |
/* Pointer to structure for the file .DEFAULT |
478 |
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. |
1117 |
int do_not_define = 0; |
int do_not_define = 0; |
1118 |
char *ep = envp[i]; |
char *ep = envp[i]; |
1119 |
|
|
1120 |
while (*ep != '=') |
while (*ep != '\0' && *ep != '=') |
1121 |
++ep; |
++ep; |
1122 |
#ifdef WINDOWS32 |
#ifdef WINDOWS32 |
1123 |
if (!unix_path && strneq(envp[i], "PATH=", 5)) |
if (!unix_path && strneq(envp[i], "PATH=", 5)) |
1559 |
default_file = enter_file (".DEFAULT"); |
default_file = enter_file (".DEFAULT"); |
1560 |
|
|
1561 |
{ |
{ |
1562 |
struct variable *v = define_variable ( |
struct variable *v = define_variable (".DEFAULT_GOAL", 13, "", o_file, 0); |
1563 |
".DEFAULT_TARGET", 15, "", o_file, 0); |
default_goal_name = &v->value; |
|
|
|
|
default_target_name = &v->value; |
|
1564 |
} |
} |
1565 |
|
|
1566 |
/* Read all the makefiles. */ |
/* Read all the makefiles. */ |
1693 |
top make, we just subtract one from the number the user wants. We |
top make, we just subtract one from the number the user wants. We |
1694 |
want job_slots to be 0 to indicate we're using the jobserver. */ |
want job_slots to be 0 to indicate we're using the jobserver. */ |
1695 |
|
|
1696 |
|
master_job_slots = job_slots; |
1697 |
|
|
1698 |
while (--job_slots) |
while (--job_slots) |
1699 |
{ |
{ |
1700 |
int r; |
int r; |
2092 |
/* If there were no command-line goals, use the default. */ |
/* If there were no command-line goals, use the default. */ |
2093 |
if (goals == 0) |
if (goals == 0) |
2094 |
{ |
{ |
2095 |
if (**default_target_name != '\0') |
if (**default_goal_name != '\0') |
2096 |
{ |
{ |
2097 |
if (default_goal_file == 0 || |
if (default_goal_file == 0 || |
2098 |
strcmp (*default_target_name, default_goal_file->name) != 0) |
strcmp (*default_goal_name, default_goal_file->name) != 0) |
2099 |
{ |
{ |
2100 |
default_goal_file = lookup_file (*default_target_name); |
default_goal_file = lookup_file (*default_goal_name); |
2101 |
|
|
2102 |
/* In case user set .DEFAULT_TARGET to a non-existent target |
/* In case user set .DEFAULT_GOAL to a non-existent target |
2103 |
name let's just enter this name into the table and let |
name let's just enter this name into the table and let |
2104 |
the standard logic sort it out. */ |
the standard logic sort it out. */ |
2105 |
if (default_goal_file == 0) |
if (default_goal_file == 0) |
2106 |
{ |
{ |
2107 |
struct nameseq *ns; |
struct nameseq *ns; |
2108 |
char *p = *default_target_name; |
char *p = *default_goal_name; |
2109 |
|
|
2110 |
ns = multi_glob ( |
ns = multi_glob ( |
2111 |
parse_file_seq (&p, '\0', sizeof (struct nameseq), 1), |
parse_file_seq (&p, '\0', sizeof (struct nameseq), 1), |
2112 |
sizeof (struct nameseq)); |
sizeof (struct nameseq)); |
2113 |
|
|
2114 |
/* .DEFAULT_TARGET should contain one target. */ |
/* .DEFAULT_GOAL should contain one target. */ |
2115 |
if (ns->next != 0) |
if (ns->next != 0) |
2116 |
fatal (NILF, _(".DEFAULT_TARGET contains more than one target")); |
fatal (NILF, _(".DEFAULT_GOAL contains more than one target")); |
2117 |
|
|
2118 |
default_goal_file = enter_file (ns->name); |
default_goal_file = enter_file (ns->name); |
2119 |
|
|
2958 |
if (print_data_base_flag) |
if (print_data_base_flag) |
2959 |
print_data_base (); |
print_data_base (); |
2960 |
|
|
2961 |
|
/* Sanity: have we written all our jobserver tokens back? */ |
2962 |
|
|
2963 |
|
if (jobserver_tokens) |
2964 |
|
error (NILF, |
2965 |
|
"INTERNAL: Exiting with %u jobserver tokens (should be 0)!", |
2966 |
|
jobserver_tokens); |
2967 |
|
|
2968 |
|
/* Sanity: If we're the master, were all the tokens written back? */ |
2969 |
|
|
2970 |
|
if (master_job_slots) |
2971 |
|
{ |
2972 |
|
char token; |
2973 |
|
/* We didn't write one for ourself, so start at 1. */ |
2974 |
|
unsigned int tcnt = 1; |
2975 |
|
|
2976 |
|
/* Close the write side, so the read() won't hang. */ |
2977 |
|
close (job_fds[1]); |
2978 |
|
|
2979 |
|
while ((err = read (job_fds[0], &token, 1)) == 1) |
2980 |
|
++tcnt; |
2981 |
|
|
2982 |
|
if (tcnt != master_job_slots) |
2983 |
|
error (NILF, |
2984 |
|
"INTERNAL: Exiting with %u jobserver tokens available; should be %u!", |
2985 |
|
tcnt, master_job_slots); |
2986 |
|
} |
2987 |
|
|
2988 |
/* Try to move back to the original directory. This is essential on |
/* Try to move back to the original directory. This is essential on |
2989 |
MS-DOS (where there is really only one process), and on Unix it |
MS-DOS (where there is really only one process), and on Unix it |
2990 |
puts core files in the original directory instead of the -C |
puts core files in the original directory instead of the -C |