Ignore:
Timestamp:
Jun 18, 2012, 1:29:07 AM (13 years ago)
Author:
bird
Message:

Fixed the broken $(deps*).

File:
1 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}
Note: See TracChangeset for help on using the changeset viewer.