VirtualBox

Changeset 2462 in kBuild


Ignore:
Timestamp:
Jul 8, 2011 8:42:53 AM (14 years ago)
Author:
bird
Message:

kmk: Implemented . Fixes #81.

Location:
trunk/src/kmk
Files:
1 added
2 edited

Legend:

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

    r2450 r2462  
    585585        $(MAKE) -f $(kmk_DEFPATH)/testcase-includedep.kmk
    586586
     587test_root:
     588        $(MAKE) -f $(kmk_DEFPATH)/testcase-root.kmk
     589
    587590test_2ndtargetexp:
    588591        $(MAKE) -f $(kmk_DEFPATH)/testcase-2ndtargetexp.kmk
     
    606609
    607610
    608 test_all:       test_math test_stack test_shell test_if1of test_local test_includedep test_2ndtargetexp test_30_continued_on_failure test_lazy_deps_vars
    609 
    610 
     611test_all: \
     612        test_math \
     613        test_stack \
     614        test_shell \
     615        test_if1of \
     616        test_local \
     617        test_root \
     618        test_includedep \
     619        test_2ndtargetexp \
     620        test_30_continued_on_failure \
     621        test_lazy_deps_vars
     622
     623
  • trunk/src/kmk/function.c

    r2276 r2462  
    809809
    810810#ifdef CONFIG_WITH_ROOT_FUNC
     811
    811812/*
    812813 $(root path)
     
    882883      if (p2 != NULL)
    883884        {
    884           /* Include all subsequent path seperators. */
     885          /* Include all subsequent path separators. */
    885886
    886887          while (len > 0 && IS_PATHSEP(*p2))
     
    898899  return o;
    899900}
     901
     902/*
     903 $(notroot path)
     904
     905 This is mainly for dealing with drive letters and UNC paths on Windows
     906 and OS/2.
     907 */
     908static char *
     909func_notroot (char *o, char **argv, const char *funcname UNUSED)
     910{
     911  const char  *paths = argv[0] ? argv[0] : "";
     912  int          doneany = 0;
     913  const char  *p;
     914  unsigned int len;
     915
     916  while ((p = find_next_token (&paths, &len)) != 0)
     917    {
     918      const char *p2 = p;
     919
     920#ifdef HAVE_DOS_PATHS
     921      if (   len >= 2
     922          && p2[1] == ':'
     923          && (   (p2[0] >= 'A' && p2[0] <= 'Z')
     924              || (p2[0] >= 'a' && p2[0] <= 'z')))
     925        {
     926          p2 += 2;
     927          len -= 2;
     928        }
     929      else if (len >= 4 && IS_PATHSEP(p2[0]) && IS_PATHSEP(p2[1])
     930               && !IS_PATHSEP(p2[2]))
     931        {
     932          /* Min recognized UNC: "//./" - find the next slash
     933             Typical root: "//srv/shr/" */
     934          /* XXX: Check if //./ needs special handling. */
     935          unsigned int saved_len = len;
     936
     937          p2 += 3;
     938          len -= 3;
     939          while (len > 0 && !IS_PATHSEP(*p2))
     940            p2++, len--;
     941
     942          if (len && IS_PATHSEP(p2[0]) && (len == 1 || !IS_PATHSEP(p2[1])))
     943            {
     944              p2++;
     945              len--;
     946
     947              if (len) /* optional share */
     948                while (len > 0 && !IS_PATHSEP(*p2))
     949                  p2++, len--;
     950            }
     951          else
     952            {
     953              p2 = p;
     954              len = saved_len;
     955            }
     956        }
     957
     958#elif defined (VMS) || defined (AMGIA)
     959      /* XXX: VMS and AMGIA */
     960      fatal (NILF, _("$(root ) is not implemented on this platform"));
     961#endif
     962
     963      /* Exclude all subsequent / leading path separators. */
     964
     965      while (len > 0 && IS_PATHSEP(*p2))
     966        p2++, len--;
     967      if (len > 0)
     968        o = variable_buffer_output (o, p2, len);
     969      else
     970        o = variable_buffer_output (o, ".", 1);
     971      o = variable_buffer_output (o, " ", 1);
     972      doneany = 1;
     973    }
     974
     975  if (doneany)
     976    /* Kill last space.  */
     977    --o;
     978
     979  return o;
     980}
     981
    900982#endif /* CONFIG_WITH_ROOT_FUNC */
    901983
     
    50655147#ifdef CONFIG_WITH_ROOT_FUNC
    50665148  { STRING_SIZE_TUPLE("root"),          0,  1,  1,  func_root},
     5149  { STRING_SIZE_TUPLE("notroot"),       0,  1,  1,  func_notroot},
    50675150#endif
    50685151  { STRING_SIZE_TUPLE("subst"),         3,  3,  1,  func_subst},
Note: See TracChangeset for help on using the changeset viewer.

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