From: Martin Mares Date: Sun, 27 Jul 2008 15:11:36 +0000 (+0200) Subject: Build: Let genconf expand variables recursively. X-Git-Tag: holmes-import~363 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=339659a4e0557e1c06d22f6acba6ec1abd57bab6;p=libucw.git Build: Let genconf expand variables recursively. This is useful for example when filling in installation paths in configuration files. --- diff --git a/build/genconf b/build/genconf index eaf2d1c7..30e8896c 100755 --- a/build/genconf +++ b/build/genconf @@ -66,10 +66,13 @@ while () { die "Piped command '$cmd' failed" if $?; print OUT `$1`; } else { - sub repl ($) { + sub repl($); + sub repl($) { my $v = shift @_; exists $vars{$v} or die "Cannot substitute $v: variable not set"; - return $vars{$v}; + my $x = $vars{$v}; + while ($x =~ s/\$\((\w+)\)/repl($1)/ge) { } + return $x; } s/@(\w+)@/repl($1)/ge; print OUT;