Ignore:
Timestamp:
May 25, 2007, 5:27:53 AM (18 years ago)
Author:
bird
Message:

multi target explicit rules. partly done.

File:
1 edited

Legend:

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

    r919 r921  
    19811981  const char **targets = 0, **target_percents = 0;
    19821982  struct commands *cmds;
     1983#ifdef CONFIG_WITH_EXPLICIT_MULTITARGET
     1984  struct file *prev_file = 0;
     1985  enum multitarget_mode { m_unsettled, m_no, m_yes, m_yes_maybe }
     1986    multi_mode = !two_colon && !pattern ? m_unsettled : m_no;
     1987#endif
    19831988
    19841989  /* If we've already snapped deps, that means we're in an eval being
     
    20492054        }
    20502055
     2056#ifdef CONFIG_WITH_EXPLICIT_MULTITARGET
     2057      /* Check for the explicit multitarget mode operators. For this to be
     2058         identified as an excplicit multiple target rule, the first + or +|
     2059         operator *must* appear between the first two files. If not found as
     2060         the 2nd file or if found as the 1st file, the rule will be rejected
     2061         as a potential multiple first target rule. For the subsequent files
     2062         the operator is only required to switch between maybe and non-maybe
     2063         mode:
     2064         `primary + 2nd 3rd +| 4th-maybe + 5th-for-sure: deps; cmds' */
     2065      if (multi_mode != m_no && name[0] == '+'
     2066        && (name[1] == '\0' || (name[1] == '|' && name[2] == '\0')))
     2067        {
     2068          if (!prev_file)
     2069            multi_mode = m_no; /* first */
     2070          else
     2071            {
     2072              if (multi_mode == m_unsettled)
     2073                prev_file->multi_head = prev_file;
     2074              multi_mode = name[1] == '\0' ? m_yes : m_yes_maybe;
     2075              continue;
     2076            }
     2077        }
     2078      else if (multi_mode == m_unsettled && prev_file)
     2079        multi_mode = m_no;
     2080#endif
     2081
    20512082      /* If this is a static pattern rule:
    20522083         `targets: target%pattern: dep%pattern; cmds',
     
    21632194                f->updating = 1;
    21642195            }
     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
    21652211        }
    21662212      else
Note: See TracChangeset for help on using the changeset viewer.