summaryrefslogtreecommitdiff
path: root/source4/script/mkproto.pl
diff options
context:
space:
mode:
authorAlexander Bokovoy <ab@samba.org>2006-04-11 11:37:52 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:04:03 -0500
commit9cf41988ff6cf0647ec4850f25415ba66845fd70 (patch)
treeb0af5ecca5db64b45b2ab3bf4a83b4050efa18ee /source4/script/mkproto.pl
parent970f7122d9095aa95e0513793f69994e235cb1e0 (diff)
downloadsamba-9cf41988ff6cf0647ec4850f25415ba66845fd70.tar.gz
samba-9cf41988ff6cf0647ec4850f25415ba66845fd70.tar.bz2
samba-9cf41988ff6cf0647ec4850f25415ba66845fd70.zip
r15036: Add out of tree build support and see how buildfarm will respond to make constructs
(This used to be commit 9329854489e2c231ffb7986d39009e0936873c11)
Diffstat (limited to 'source4/script/mkproto.pl')
-rwxr-xr-xsource4/script/mkproto.pl15
1 files changed, 13 insertions, 2 deletions
diff --git a/source4/script/mkproto.pl b/source4/script/mkproto.pl
index 097a5cb18f..c2dc547c12 100755
--- a/source4/script/mkproto.pl
+++ b/source4/script/mkproto.pl
@@ -9,6 +9,8 @@ use strict;
# use warnings;
use Getopt::Long;
+use File::Basename;
+use File::Path;
#####################################################################
# read a file into a string
@@ -21,6 +23,8 @@ my $_public = "";
my $_private = "";
my $public_data = \$_public;
my $private_data = \$_private;
+my $builddir = undef;
+my $srcdir = undef;
sub public($)
{
@@ -57,7 +61,9 @@ GetOptions(
},
'public-define=s' => \$public_define,
'private-define=s' => \$private_define,
- 'help' => \&usage
+ 'help' => \&usage,
+ 'builddir=s' => sub { my ($f,$v) = @_; $builddir = $v; },
+ 'srcdir=s' => sub { my ($f,$v) = @_; $srcdir = $v; }
) or exit(1);
if (not defined($public_define) and defined($public_file)) {
@@ -143,7 +149,9 @@ sub process_file($$$)
$filename =~ s/\.o$/\.c/g;
- open(FH, "< $filename") || die "Failed to open $filename";
+ if (!open(FH, "< $builddir/$filename")) {
+ open(FH, "< $srcdir/$filename") || die "Failed to open $filename";
+ }
$private_file->("\n/* The following definitions come from $filename */\n\n");
@@ -198,6 +206,7 @@ sub process_file($$$)
close(FH);
}
+
print_header(\&public, $public_define);
if ($public_file ne $private_file) {
print_header(\&private, $private_define);
@@ -232,6 +241,7 @@ my $old_private_data = file_load($private_file);
if (not defined($old_public_data) or ($old_public_data ne $$public_data))
{
+ mkpath(dirname($public_file), 0, 0755);
open(PUBLIC, ">$public_file") or die("Can't open `$public_file': $!");
print PUBLIC "$$public_data";
close(PUBLIC);
@@ -240,6 +250,7 @@ if (not defined($old_public_data) or ($old_public_data ne $$public_data))
if (($public_file ne $private_file) and (
not defined($old_private_data) or ($old_private_data ne $$private_data))) {
+ mkpath(dirname($private_file), 0, 0755);
open(PRIVATE, ">$private_file") or die("Can't open `$private_file': $!");
print PRIVATE "$$private_data";
close(PRIVATE);