code: def expand_makefile_vars(s, vars):
      """Expand Makefile-style variables -- "${foo}" or "$(foo)" -- in
      'string' according to 'vars' (a dictionary mapping variable names to
      values).  Variables not present in 'vars' are silently expanded to the
      empty string.  The variable values in 'vars' should not contain further
      variable expansions; if 'vars' is the output of 'parse_makefile()',
      you're fine.  Returns a variable-expanded version of 's'.
      """
  
      # This algorithm does multiple expansion, so if vars['foo'] contains
      # "${bar}", it will expand ${foo} to ${bar}, and then expand
      # ${bar}... and so forth.  This is fine as long as 'vars' comes from
      # 'parse_makefile()', which takes care of such expansions eagerly,
      # according to make's variable expansion semantics.
  
      while True:
          m = _findvar1_rx.search(s) or _findvar2_rx.search(s)
          if m:
              (beg, end) = m.span()
              s = s[0:beg] + vars.get(m.group(1)) + s[end:]
          else:
              break
      return s
  
imports: import os
  import re
  import sys
  import sysconfig
  import pathlib
  from .errors import DistutilsPlatformError
  from .None import py39compat
  from ._functools import pass_none
label_desc: Use image node_id 19 for calling a global function with example usage: expand_makefile_vars(s, vars) and returns: s