From 9cf41988ff6cf0647ec4850f25415ba66845fd70 Mon Sep 17 00:00:00 2001 From: Alexander Bokovoy Date: Tue, 11 Apr 2006 11:37:52 +0000 Subject: r15036: Add out of tree build support and see how buildfarm will respond to make constructs (This used to be commit 9329854489e2c231ffb7986d39009e0936873c11) --- source4/build/smb_build/config_mk.pm | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'source4/build/smb_build/config_mk.pm') diff --git a/source4/build/smb_build/config_mk.pm b/source4/build/smb_build/config_mk.pm index 587335ac3e..fa948f4bd9 100644 --- a/source4/build/smb_build/config_mk.pm +++ b/source4/build/smb_build/config_mk.pm @@ -109,19 +109,30 @@ use vars qw(@parsed_files); # # $filename - the path of the config.mk file # which should be parsed -sub run_config_mk($$$) +sub run_config_mk($$$$) { - sub run_config_mk($$$); - my ($input, $srcdir, $filename) = @_; + sub run_config_mk($$$$); + my ($input, $srcdir, $builddir, $filename) = @_; my $result; my $linenum = -1; my $infragment = 0; my $section = "GLOBAL"; my $makefile = ""; - push (@parsed_files, $srcdir."/".$filename); + my $parsing_file = $builddir."/".$filename; + + $ENV{samba_builddir} = $builddir; + $ENV{samba_srcdir} = $srcdir; + + if (!open(CONFIG_MK, $parsing_file)) { + $parsing_file = $srcdir."/".$filename; + open(CONFIG_MK, $parsing_file) or + die("Can't open neither `$builddir."/".$filename' nor `$srcdir/$filename'\n"); + } + + push (@parsed_files, $parsing_file); + - open(CONFIG_MK, $srcdir."/".$filename) or die("Can't open `$srcdir/$filename'\n"); my @lines = ; close(CONFIG_MK); @@ -151,7 +162,7 @@ sub run_config_mk($$$) # include if ($line =~ /^include (.*)$/) { - $makefile .= run_config_mk($input, $srcdir, dirname($filename)."/$1"); + $makefile .= run_config_mk($input, $srcdir, $builddir, dirname($filename)."/$1"); next; } -- cgit