VirtualBox

Changeset 1408 in kBuild for trunk/src/kmk


Ignore:
Timestamp:
Mar 17, 2008 10:21:36 PM (17 years ago)
Author:
bird
Message:

Implemented local variable definitions - CONFIG_WITH_LOCAL_VARIABLES.

Location:
trunk/src/kmk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kmk/Makefile.am

    r1340 r1408  
    100100        -DCONFIG_WITH_EXPLICIT_MULTITARGET \
    101101        -DCONFIG_WITH_PREPEND_ASSIGNMENT \
     102        -DCONFIG_WITH_LOCAL_VARIABLES \
    102103        \
    103104        -DKMK \
  • trunk/src/kmk/Makefile.kmk

    r1340 r1408  
    100100        CONFIG_WITH_EXPLICIT_MULTITARGET \
    101101        CONFIG_WITH_PREPEND_ASSIGNMENT \
     102        CONFIG_WITH_LOCAL_VARIABLES \
    102103        \
    103104        KMK \
     
    430431        $(MAKE) -f testcase-if1of.kmk
    431432
    432 test_all:       test_math test_stack test_shell test_if1of
    433 
     433test_local:
     434        $(MAKE) -f testcase-local.kmk
     435
     436test_all:       test_math test_stack test_shell test_if1of test_local
     437
  • trunk/src/kmk/function.c

    r1387 r1408  
    6262#ifdef __OS2__
    6363# define CONFIG_WITH_OS2_LIBPATH 1
    64 #endif 
     64#endif
    6565#ifdef CONFIG_WITH_OS2_LIBPATH
    6666# define INCL_BASE
     
    571571        o = variable_buffer_output (o, "automatic", 9);
    572572        break;
     573#ifdef CONFIG_WITH_LOCAL_VARIABLES
     574      case o_local:
     575        o = variable_buffer_output (o, "local", 5);
     576        break;
     577#endif
    573578      }
    574579
     
    33383343/* Sets or gets the OS/2 libpath variables.
    33393344
    3340    The first argument indicates which variable - BEGINLIBPATH, 
    3341    ENDLIBPATH, LIBPATHSTRICT or LIBPATH. 
    3342 
    3343    The second indicates whether this is a get (not present) or 
     3345   The first argument indicates which variable - BEGINLIBPATH,
     3346   ENDLIBPATH, LIBPATHSTRICT or LIBPATH.
     3347
     3348   The second indicates whether this is a get (not present) or
    33443349   set (present) operation. When present it is the new value for
    33453350   the variable. */
     
    34083413      if (len >= len_max)
    34093414        {
    3410           error (NILF, _("$(libpath): The new `%s' value is too long (%d bytes, max %d)"), 
     3415          error (NILF, _("$(libpath): The new `%s' value is too long (%d bytes, max %d)"),
    34113416                 argv[0], len, len_max);
    34123417          return variable_buffer_output (o, "", 0);
     
    35413546#ifdef CONFIG_WITH_OS2_LIBPATH
    35423547  { STRING_SIZE_TUPLE("libpath"),       1,  2,  1,  func_os2_libpath},
    3543 #endif 
     3548#endif
    35443549#ifdef KMK_HELPERS
    35453550  { STRING_SIZE_TUPLE("kb-src-tool"),   1,  1,  0,  func_kbuild_source_tool},
  • trunk/src/kmk/read.c

    r1181 r1408  
    11681168          continue;
    11691169        }
     1170#ifdef CONFIG_WITH_LOCAL_VARIABLES
     1171
     1172      if (word1eq ("local"))
     1173        {
     1174          if (*p2 == '\0')
     1175            error (fstart, _("empty `local' directive"));
     1176
     1177          if (strneq (p2, "define", 6)
     1178              && (isblank ((unsigned char)p2[6]) || p2[6] == '\0'))
     1179            {
     1180              if (ignoring)
     1181                in_ignored_define = 1;
     1182              else
     1183                {
     1184                  p2 = next_token (p2 + 6);
     1185                  if (*p2 == '\0')
     1186                    fatal (fstart, _("empty variable name"));
     1187
     1188                  /* Let the variable name be the whole rest of the line,
     1189                     with trailing blanks stripped (comments have already been
     1190                     removed), so it could be a complex variable/function
     1191                     reference that might contain blanks.  */
     1192                  p = strchr (p2, '\0');
     1193                  while (isblank ((unsigned char)p[-1]))
     1194                    --p;
     1195                  do_define (p2, p - p2, o_local, ebuf);
     1196                }
     1197            }
     1198          else if (!ignoring
     1199                   && !try_variable_definition (fstart, p2, o_local, 0))
     1200            error (fstart, _("invalid `local' directive"));
     1201
     1202          continue;
     1203        }
     1204#endif /* CONFIG_WITH_LOCAL_VARIABLES */
    11701205
    11711206      if (ignoring)
  • trunk/src/kmk/variable.c

    r1334 r1408  
    15361536#endif
    15371537
     1538#ifdef CONFIG_WITH_LOCAL_VARIABLES
     1539          /* If we have += but we're in a target or local variable context,
     1540             we want to append only with other variables in the context of
     1541             this target.  */
     1542        if (target_var || origin == o_local)
     1543#else
    15381544        /* If we have += but we're in a target variable context, we want to
    15391545           append only with other variables in the context of this target.  */
    15401546        if (target_var)
     1547#endif
    15411548          {
    15421549            append = 1;
     
    17341741#endif
    17351742                              origin, flavor == f_recursive,
     1743#ifdef CONFIG_WITH_LOCAL_VARIABLES
     1744                              (target_var || origin == o_local
     1745#else
    17361746                              (target_var
     1747#endif
    17371748                               ? current_variable_set_list->set : NULL),
    17381749                              flocp);
     
    18681879/* Try to interpret LINE (a null-terminated string) as a variable definition.
    18691880
    1870    ORIGIN may be o_file, o_override, o_env, o_env_override,
     1881   ORIGIN may be o_file, o_override, o_env, o_env_override, o_local,
    18711882   or o_command specifying that the variable definition comes
    18721883   from a makefile, an override directive, the environment with
     
    19351946      origin = _("automatic");
    19361947      break;
     1948#ifdef CONFIG_WITH_LOCAL_VARIABLES
     1949    case o_local:
     1950      origin = _("`local' directive");
     1951      break;
     1952#endif
    19371953    case o_invalid:
    19381954    default:
  • trunk/src/kmk/variable.h

    r937 r1408  
    2525    o_default,          /* Variable from the default set.  */
    2626    o_env,              /* Variable from environment.  */
     27#ifdef CONFIG_WITH_LOCAL_VARIABLES /** @todo Correct priority? */
     28    o_local,            /* Variable from an 'local' directive.  */
     29#endif
    2730    o_file,             /* Variable given in a makefile.  */
    2831    o_env_override,     /* Variable from environment, if -e.  */
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette