Changeset 1989 for vendor/gnumake/current/variable.c
- Timestamp:
- Oct 29, 2008, 12:02:45 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/gnumake/current/variable.c
r900 r1989 1 1 /* Internals of variables for GNU Make. 2 2 Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software 4 4 Foundation, Inc. 5 5 This file is part of GNU Make. … … 7 7 GNU Make is free software; you can redistribute it and/or modify it under the 8 8 terms of the GNU General Public License as published by the Free Software 9 Foundation; either version 2, or (at your option) any later version. 9 Foundation; either version 3 of the License, or (at your option) any later 10 version. 10 11 11 12 GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY … … 14 15 15 16 You should have received a copy of the GNU General Public License along with 16 GNU Make; see the file COPYING. If not, write to the Free Software 17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. */ 17 this program. If not, see <http://www.gnu.org/licenses/>. */ 18 18 19 19 #include "make.h" … … 256 256 257 257 static struct variable * 258 handle_special_var (struct variable *var)258 lookup_special_var (struct variable *var) 259 259 { 260 260 static unsigned long last_var_count = 0; … … 357 357 v = (struct variable *) hash_find_item ((struct hash_table *) &set->table, &var_key); 358 358 if (v) 359 return v->special ? handle_special_var (v) : v;359 return v->special ? lookup_special_var (v) : v; 360 360 } 361 361 … … 804 804 isn't one there. */ 805 805 v = define_variable ("SHELL", 5, default_shell, o_default, 0); 806 #ifdef __MSDOS__ 807 v->export = v_export; /* Export always SHELL. */ 808 #endif 806 809 807 810 /* On MSDOS we do use SHELL from environment, since it isn't a standard … … 926 929 927 930 case v_noexport: 928 /* If this is the SHELL variable and it's not exported, then 929 add the value from our original environment. */ 930 if (streq (v->name, "SHELL")) 931 { 932 extern struct variable shell_var; 933 v = &shell_var; 934 break; 935 } 936 continue; 931 { 932 /* If this is the SHELL variable and it's not exported, 933 then add the value from our original environment, if 934 the original environment defined a value for SHELL. */ 935 extern struct variable shell_var; 936 if (streq (v->name, "SHELL") && shell_var.value) 937 { 938 v = &shell_var; 939 break; 940 } 941 continue; 942 } 937 943 938 944 case v_ifset: … … 997 1003 998 1004 1005 static struct variable * 1006 set_special_var (struct variable *var) 1007 { 1008 if (streq (var->name, RECIPEPREFIX_NAME)) 1009 { 1010 /* The user is resetting the command introduction prefix. This has to 1011 happen immediately, so that subsequent rules are interpreted 1012 properly. */ 1013 cmd_prefix = var->value[0]=='\0' ? RECIPEPREFIX_DEFAULT : var->value[0]; 1014 } 1015 1016 return var; 1017 } 1018 1019 999 1020 /* Given a variable, a value, and a flavor, define the variable. 1000 1021 See the try_variable_definition() function for details on the parameters. */ … … 1031 1052 v = lookup_variable (varname, strlen (varname)); 1032 1053 if (v) 1033 return v ;1054 return v->special ? set_special_var (v) : v; 1034 1055 1035 1056 conditional = 1; … … 1200 1221 } 1201 1222 else 1202 v = lookup_variable (varname, strlen (varname)); 1223 { 1224 if (alloc_value) 1225 free (alloc_value); 1226 1227 alloc_value = allocated_variable_expand (p); 1228 if (find_and_set_default_shell (alloc_value)) 1229 { 1230 v = define_variable_in_set (varname, strlen (varname), p, 1231 origin, flavor == f_recursive, 1232 (target_var 1233 ? current_variable_set_list->set 1234 : NULL), 1235 flocp); 1236 no_default_sh_exe = 0; 1237 } 1238 else 1239 v = lookup_variable (varname, strlen (varname)); 1240 } 1203 1241 } 1204 1242 else … … 1222 1260 free (alloc_value); 1223 1261 1224 return v ;1262 return v->special ? set_special_var (v) : v; 1225 1263 } 1226 1264
Note:
See TracChangeset
for help on using the changeset viewer.