Changeset 922


Ignore:
Timestamp:
May 25, 2007, 6:44:01 AM (18 years ago)
Author:
bird
Message:

working on the maybe (+|) part.

Location:
trunk/src/gmakenew
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gmakenew/filedef.h

    r921 r922  
    104104                                   considered on current scan of goal chain */
    105105#ifdef CONFIG_WITH_EXPLICIT_MULTITARGET
    106     unsigned int multi_maybe:1; /* Nonzero if this file may not always be
    107                                    touched/created by the multi target rule. */
     106    unsigned int multi_maybe:1; /* Nonzero if this file isn't always updated
     107                                   by the explicit multi target rule. */
    108108#endif
    109109
  • trunk/src/gmakenew/read.c

    r921 r922  
    20622062         the operator is only required to switch between maybe and non-maybe
    20632063         mode:
    2064          `primary + 2nd 3rd +| 4th-maybe + 5th-for-sure: deps; cmds' */
     2064         `primary + 2nd 3rd +| 4th-maybe + 5th-for-sure: deps; cmds'
     2065
     2066         The whole idea of the maybe-updated files is this:
     2067            timestamp +| maybe.h: src1.c src2.c
     2068                grep goes-into-maybe.h $* > timestamp
     2069                cmp timestamp maybe.h || cp -f timestamp maybe.h
     2070
     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. */
    20652074      if (multi_mode != m_no && name[0] == '+'
    20662075        && (name[1] == '\0' || (name[1] == '|' && name[2] == '\0')))
     
    21332142            f->cmds = cmds;
    21342143
     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
     2177
    21352178          /* Defining .SUFFIXES with no dependencies clears out the list of
    21362179             suffixes.  */
     
    21942237                f->updating = 1;
    21952238            }
    2196 
    2197 #ifdef CONFIG_WITH_EXPLICIT_MULTITARGET
    2198           /* If this is an explicit multi target rule, add it to the
    2199              target chain and set the multi_maybe flag according to
    2200              the current mode. */
    2201 
    2202           if (multi_mode >= m_yes)
    2203             {
    2204               f->multi_maybe = multi_mode == m_yes_maybe;
    2205               prev_file->multi_next = f;
    2206               assert (prev_file->multi_head != 0);
    2207               f->multi_head = prev_file->multi_head;
    2208             }
    2209           prev_file = f;
    2210 #endif
    22112239        }
    22122240      else
Note: See TracChangeset for help on using the changeset viewer.