9 open IN
, '<', 'Makefile' or die $!;
11 my ($var, $val) = /^(\w+)=(.+)/;
12 next unless defined $val;
13 $val =~ s/\$\{(\w+)\}/$subs{$1}/ while $val =~ /\$\{/;
15 last if $var eq 'libdir';
20 # We only need to use "\&'" or "\&." at the start of a line.
21 s/(?<=.)\\\&(['.])/$1/g;
23 # Some quotes turn into open/close quotes.
24 s/'(.)'/\\(oq$1\\(cq/g;
25 s/(^|[ (])"(?!( |$))/$1\\(lq/gm;
26 s/(?<! )"([.,:;! )]|$)/\\(rq$1/gm;
27 s/(\\\(lq[^(]*) "( |$)/$1 \\(rq$2/gm;
28 s/(^| )" ([^(]*\\\(rq)/$1\\(lq $2/gm;
31 s/^([. ])(.*)/ $1 . realquotes($2) /egm;
32 s/(\\f(B|\(CW).*?\\fP)/ realquotes($1) /egs;
34 s/^\\\&(\\\(oq)/$1/gm;
36 s/\@libdir\@/$subs{libdir}/g;
41 $txt =~ s/\\\([lr]q/"/g;
42 $txt =~ s/\\\([oc]q/'/g;