1 |
/* Argument parsing and main program of GNU Make. |
/* Argument parsing and main program of GNU Make. |
2 |
Copyright (C) 1988, 1989, 1990, 1991, 1994, 1995, 1996, 1997, 1998, 1999, |
Copyright (C) 1988, 1989, 1990, 1991, 1994, 1995, 1996, 1997, 1998, 1999, |
3 |
2002, 2003 Free Software Foundation, Inc. |
2002, 2003, 2005 Free Software Foundation, Inc. |
4 |
This file is part of GNU Make. |
This file is part of GNU Make. |
5 |
|
|
6 |
GNU Make is free software; you can redistribute it and/or modify |
GNU Make is free software; you can redistribute it and/or modify |
763 |
sh_found = 1; |
sh_found = 1; |
764 |
} else { |
} else { |
765 |
char *p; |
char *p; |
766 |
struct variable *v = lookup_variable ("Path", 4); |
struct variable *v = lookup_variable ("PATH", 4); |
767 |
|
|
768 |
/* |
/* Search Path for shell */ |
|
* Search Path for shell |
|
|
*/ |
|
769 |
if (v && v->value) { |
if (v && v->value) { |
770 |
char *ep; |
char *ep; |
771 |
|
|
1091 |
|
|
1092 |
/* Initialize the special variables. */ |
/* Initialize the special variables. */ |
1093 |
define_variable (".VARIABLES", 10, "", o_default, 0)->special = 1; |
define_variable (".VARIABLES", 10, "", o_default, 0)->special = 1; |
1094 |
/* define_variable (".TARGETS", 8, "", o_default, 0); */ |
/* define_variable (".TARGETS", 8, "", o_default, 0)->special = 1; */ |
1095 |
|
|
1096 |
|
/* Set up .FEATURES */ |
1097 |
|
define_variable (".FEATURES", 9, |
1098 |
|
"target-specific order-only second-expansion", |
1099 |
|
o_default, 0); |
1100 |
|
#ifdef MAKE_JOBSERVER |
1101 |
|
do_variable_definition (NILF, ".FEATURES", "jobserver", |
1102 |
|
o_default, f_append, 0); |
1103 |
|
#endif |
1104 |
|
#ifdef MAKE_SYMLINKS |
1105 |
|
do_variable_definition (NILF, ".FEATURES", "check-symlink", |
1106 |
|
o_default, f_append, 0); |
1107 |
|
#endif |
1108 |
|
|
1109 |
/* Read in variables from the environment. It is important that this be |
/* Read in variables from the environment. It is important that this be |
1110 |
done before $(MAKE) is figured out so its definitions will not be |
done before $(MAKE) is figured out so its definitions will not be |
1121 |
#ifdef WINDOWS32 |
#ifdef WINDOWS32 |
1122 |
if (!unix_path && strneq(envp[i], "PATH=", 5)) |
if (!unix_path && strneq(envp[i], "PATH=", 5)) |
1123 |
unix_path = ep+1; |
unix_path = ep+1; |
1124 |
else if (!windows32_path && !strnicmp(envp[i], "Path=", 5)) { |
else if (!strnicmp(envp[i], "Path=", 5)) { |
1125 |
do_not_define = 1; /* it gets defined after loop exits */ |
do_not_define = 1; /* it gets defined after loop exits */ |
1126 |
windows32_path = ep+1; |
if (!windows32_path) |
1127 |
|
windows32_path = ep+1; |
1128 |
} |
} |
1129 |
#endif |
#endif |
1130 |
/* The result of pointer arithmetic is cast to unsigned int for |
/* The result of pointer arithmetic is cast to unsigned int for |
1148 |
subprocesses, which seems silly to me but... */ |
subprocesses, which seems silly to me but... */ |
1149 |
if (strncmp (envp[i], "SHELL=", 6) == 0) |
if (strncmp (envp[i], "SHELL=", 6) == 0) |
1150 |
{ |
{ |
1151 |
|
#ifndef __MSDOS__ |
1152 |
v->export = v_noexport; |
v->export = v_noexport; |
1153 |
|
#endif |
1154 |
shell_var.name = "SHELL"; |
shell_var.name = "SHELL"; |
1155 |
shell_var.value = xstrdup (ep + 1); |
shell_var.value = xstrdup (ep + 1); |
1156 |
} |
} |
1157 |
} |
} |
1158 |
} |
} |
1159 |
#ifdef WINDOWS32 |
#ifdef WINDOWS32 |
1160 |
/* |
/* If we didn't find a correctly spelled PATH we define PATH as |
1161 |
* Make sure that this particular spelling of 'Path' is available |
* either the first mispelled value or an empty string |
|
*/ |
|
|
if (windows32_path) |
|
|
define_variable("Path", 4, windows32_path, o_env, 1)->export = v_export; |
|
|
else if (unix_path) |
|
|
define_variable("Path", 4, unix_path, o_env, 1)->export = v_export; |
|
|
else |
|
|
define_variable("Path", 4, "", o_env, 1)->export = v_export; |
|
|
|
|
|
/* |
|
|
* PATH defaults to Path iff PATH not found and Path is found. |
|
1162 |
*/ |
*/ |
1163 |
if (!unix_path && windows32_path) |
if (!unix_path) |
1164 |
define_variable("PATH", 4, windows32_path, o_env, 1)->export = v_export; |
define_variable("PATH", 4, |
1165 |
|
windows32_path ? windows32_path : "", |
1166 |
|
o_env, 1)->export = v_export; |
1167 |
#endif |
#endif |
1168 |
#else /* For Amiga, read the ENV: device, ignoring all dirs */ |
#else /* For Amiga, read the ENV: device, ignoring all dirs */ |
1169 |
{ |
{ |