def expand_makefile_vars(s, vars):
 while 1:
  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

def expand_makefile_vars ( s , vars ) : while 1 : 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
expand makefile-style variables -- "${foo}" or "$" -- in string according to vars .