Ignore:
Timestamp:
Oct 29, 2008, 12:02:45 AM (17 years ago)
Author:
bird
Message:

Load gnumake-2008-10-28-CVS into vendor/gnumake/current.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vendor/gnumake/current/variable.c

    r900 r1989  
    11/* Internals of variables for GNU Make.
    22Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
    3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software
     31998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software
    44Foundation, Inc.
    55This file is part of GNU Make.
     
    77GNU Make is free software; you can redistribute it and/or modify it under the
    88terms of the GNU General Public License as published by the Free Software
    9 Foundation; either version 2, or (at your option) any later version.
     9Foundation; either version 3 of the License, or (at your option) any later
     10version.
    1011
    1112GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY
     
    1415
    1516You 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.  */
     17this program.  If not, see <http://www.gnu.org/licenses/>.  */
    1818
    1919#include "make.h"
     
    256256
    257257static struct variable *
    258 handle_special_var (struct variable *var)
     258lookup_special_var (struct variable *var)
    259259{
    260260  static unsigned long last_var_count = 0;
     
    357357      v = (struct variable *) hash_find_item ((struct hash_table *) &set->table, &var_key);
    358358      if (v)
    359         return v->special ? handle_special_var (v) : v;
     359        return v->special ? lookup_special_var (v) : v;
    360360    }
    361361
     
    804804     isn't one there.  */
    805805  v = define_variable ("SHELL", 5, default_shell, o_default, 0);
     806#ifdef __MSDOS__
     807  v->export = v_export;  /*  Export always SHELL.  */
     808#endif
    806809
    807810  /* On MSDOS we do use SHELL from environment, since it isn't a standard
     
    926929
    927930              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                }
    937943
    938944              case v_ifset:
     
    9971003
    9981004
     1005static struct variable *
     1006set_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
    9991020/* Given a variable, a value, and a flavor, define the variable.
    10001021   See the try_variable_definition() function for details on the parameters. */
     
    10311052      v = lookup_variable (varname, strlen (varname));
    10321053      if (v)
    1033         return v;
     1054        return v->special ? set_special_var (v) : v;
    10341055
    10351056      conditional = 1;
     
    12001221        }
    12011222      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        }
    12031241    }
    12041242  else
     
    12221260    free (alloc_value);
    12231261
    1224   return v;
     1262  return v->special ? set_special_var (v) : v;
    12251263}
    12261264
Note: See TracChangeset for help on using the changeset viewer.