VirtualBox

Changeset 2594 in kBuild


Ignore:
Timestamp:
Jun 17, 2012 11:29:07 PM (13 years ago)
Author:
bird
Message:

Fixed the broken $(deps*).

Location:
trunk/src/kmk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kmk/commands.c

    r2591 r2594  
    116116
    117117#endif /* CONFIG_WITH_STRCACHE2 */
     118
     119#ifdef CONFIG_WITH_LAZY_DEPS_VARS
     120/* Create as copy of DEPS without duplicates, similar to what
     121   set_file_variables does.  Used by func_deps.  */
     122
     123struct dep *create_uniqute_deps_chain (struct dep *deps)
     124{
     125  struct dep *d;
     126  struct dep *head = NULL;
     127  struct dep **ppnext= &head;
     128  struct hash_table dep_hash;
     129  void **slot;
     130
     131  hash_init (&dep_hash, 500, dep_hash_1, dep_hash_2, dep_hash_cmp);
     132
     133  for (d = deps; d != 0; d = d->next)
     134    {
     135      if (d->need_2nd_expansion)
     136        continue;
     137
     138      slot = hash_find_slot (&dep_hash, d);
     139      if (HASH_VACANT (*slot))
     140        {
     141          struct dep *n = alloc_dep();
     142          *n = *d;
     143          n->next = NULL;
     144          *ppnext = n;
     145          ppnext = &n->next;
     146          hash_insert_at (&dep_hash, n, slot);
     147        }
     148      else
     149        {
     150          /* Upgrade order only if a normal dep exists.
     151             Note! Elected not to upgrade the original, only the sanitized
     152                   list, need to check that out later. FIXME TODO */
     153          struct dep *d2 = (struct dep *)*slot;
     154          if (d->ignore_mtime != d2->ignore_mtime)
     155            d->ignore_mtime = d2->ignore_mtime = 0;
     156        }
     157    }
     158
     159  return head;
     160}
     161#endif /* CONFIG_WITH_LAZY_DEPS_VARS */
    118162
    119163/* Set FILE's automatic variables up.  */
     
    451495    DEFINE_VARIABLE ("|", 1, bar_value);
    452496  }
    453 #ifdef CONFIG_WITH_LAZY_DEPS_VARS
    454   else
    455     {
    456       /* Make a copy of the current dependency chain for later use in
    457          potential $(dep-pluss $@) calls.  Then drop duplicate deps.  */
    458 
    459       /* assert (file->org_deps == NULL); - FIXME? */
    460       free_dep_chain (file->org_deps);
    461       file->org_deps = copy_dep_chain (file->deps);
    462 
    463       /** @todo do uniquize_deps (file->deps); in the $(dep-* ) functions, it'll
    464        *        save even more space that way. */
    465    }
    466 #endif /* CONFIG_WITH_LAZY_DEPS_VARS */
    467497#undef  DEFINE_VARIABLE
    468498}
  • trunk/src/kmk/commands.h

    r2591 r2594  
    6262void set_file_variables (struct file *file);
    6363#endif
     64#ifdef CONFIG_WITH_LAZY_DEPS_VARS
     65struct dep *create_uniqute_deps_chain (struct dep *deps);
     66#endif
     67
  • trunk/src/kmk/filedef.h

    r2591 r2594  
    3131    struct dep *deps;           /* all dependencies, including duplicates */
    3232#ifdef CONFIG_WITH_LAZY_DEPS_VARS
    33     struct dep *org_deps;       /* original dependencies before
    34                                    duplicates were dropped. */
     33    struct dep *deps_no_dupes;  /* dependencies without duplicates, created on
     34                                   demaned by func_deps. */
    3535#endif
    3636    struct commands *cmds;      /* Commands to execute for this target.  */
  • trunk/src/kmk/function.c

    r2592 r2594  
    30043004/* Implements $^ and $+.
    30053005
    3006    The first is somes with with FUNCNAME 'deps', the second as 'deps-all'.
     3006   The first comes with FUNCNAME 'deps', the second as 'deps-all'.
    30073007
    30083008   If no second argument is given, or if it's empty, or if it's zero,
     
    30403040  if (file)
    30413041    {
    3042       struct dep *deps = funcname[4] != '\0' && file->org_deps
    3043                        ? file->org_deps : file->deps;
     3042      struct dep *deps;
    30443043      struct dep *d;
     3044      if (funcname[4] == '\0')
     3045        {
     3046          deps = file->deps_no_dupes;
     3047          if (!deps && file->deps)
     3048            deps = file->deps = create_uniqute_deps_chain (file->deps);
     3049        }
     3050      else
     3051        deps = file->deps;
    30453052
    30463053      if (   file->double_colon
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