Changeset 1021 for trunk/src/kmk/read.c


Ignore:
Timestamp:
Jun 4, 2007, 2:58:37 AM (18 years ago)
Author:
bird
Message:

fixes to the multi target code. (should be correct now)

File:
1 edited

Legend:

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

    r940 r1021  
    20442044            {
    20452045              max_targets += 5;
    2046               targets = xrealloc (targets, max_targets * sizeof (char *));
    2047               target_percents = xrealloc (target_percents,
     2046              targets = xrealloc ((void *)targets, max_targets * sizeof (char *));
     2047              target_percents = xrealloc ((void *)target_percents,
    20482048                                          max_targets * sizeof (char *));
    20492049            }
     
    20562056#ifdef CONFIG_WITH_EXPLICIT_MULTITARGET
    20572057      /* Check for the explicit multitarget mode operators. For this to be
    2058          identified as an excplicit multiple target rule, the first + or +|
     2058         identified as an explicit multiple target rule, the first + or +|
    20592059         operator *must* appear between the first two files. If not found as
    20602060         the 2nd file or if found as the 1st file, the rule will be rejected
     
    20692069                cmp timestamp maybe.h || cp -f timestamp maybe.h
    20702070
    2071          This is handled below by adding replacing the prereqs of the
    2072          maybe-updated by an order only dependency on the primary target
    2073          (see below). This saves messing up remake.c. */
     2071        This is implemented in remake.c where we don't consider the mtime of
     2072        the maybe-updated targets. */
    20742073      if (multi_mode != m_no && name[0] == '+'
    20752074        && (name[1] == '\0' || (name[1] == '|' && name[2] == '\0')))
     
    20802079            {
    20812080              if (multi_mode == m_unsettled)
    2082                 prev_file->multi_head = prev_file;
     2081                {
     2082                  prev_file->multi_head = prev_file;
     2083
     2084                  /* Only the primary file needs the dependencies. */
     2085                  if (deps)
     2086                    {
     2087                      free_dep_chain (deps);
     2088                      deps = NULL;
     2089                    }
     2090                }
    20832091              multi_mode = name[1] == '\0' ? m_yes : m_yes_maybe;
    20842092              continue;
     
    21412149          if (cmds != 0)
    21422150            f->cmds = cmds;
    2143 
    2144 #ifdef CONFIG_WITH_EXPLICIT_MULTITARGET
    2145           /* If this is an explicit multi target rule, add it to the
    2146              target chain and set the multi_maybe flag according to
    2147              the current mode. This is also where we do the dependency
    2148              tricks for the 'maybe' targets (see above). */
    2149 
    2150           if (multi_mode >= m_yes)
    2151             {
    2152               f->multi_maybe = multi_mode == m_yes_maybe;
    2153               if (f->multi_maybe)
    2154                 {
    2155                   /* expand_deps needs the "| " bit.
    2156                      XXX leaking memory here? */
    2157                   size_t len = strlen (prev_file->multi_head->name) + 1;
    2158                   char *maybe_dep = xmalloc (len + 2);
    2159                   memcpy (maybe_dep, "| ", 2);
    2160                   memcpy (maybe_dep + 2, prev_file->multi_head->name, len);
    2161 
    2162                   free_dep_chain (this);
    2163                   this = alloc_dep ();
    2164                   this->name = maybe_dep;
    2165                   this->ignore_mtime = 1;
    2166                 }
    2167               prev_file->multi_next = f;
    2168               assert (prev_file->multi_head != 0);
    2169               f->multi_head = prev_file->multi_head;
    2170 
    2171               if (f == suffix_file)
    2172                 error (flocp,
    2173                        _(".SUFFIXES encountered in an explicit multi target rule"));
    2174             }
    2175           prev_file = f;
    2176 #endif
    21772151
    21782152          /* Defining .SUFFIXES with no dependencies clears out the list of
Note: See TracChangeset for help on using the changeset viewer.