summaryrefslogtreecommitdiff
path: root/source4/build
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2003-12-07 23:47:35 +0000
committerAndrew Tridgell <tridge@samba.org>2003-12-07 23:47:35 +0000
commitdaeffe3f11f4cf2eabb7ab101e0597de005aa165 (patch)
tree29e6e706b02bd0335445e9a14e7071e7e65b2988 /source4/build
parentdbf4b65d49f2ac0e99aa4ebf60bb062911012e43 (diff)
downloadsamba-daeffe3f11f4cf2eabb7ab101e0597de005aa165.tar.gz
samba-daeffe3f11f4cf2eabb7ab101e0597de005aa165.tar.bz2
samba-daeffe3f11f4cf2eabb7ab101e0597de005aa165.zip
don't save the intermediate form to disk unless we need to
(This used to be commit 4e1a5a21a4c8da0d2a23d5ba02168eac1987c260)
Diffstat (limited to 'source4/build')
-rwxr-xr-xsource4/build/pidl/pidl.pl33
1 files changed, 14 insertions, 19 deletions
diff --git a/source4/build/pidl/pidl.pl b/source4/build/pidl/pidl.pl
index 4e79eb92f6..30dcde929a 100755
--- a/source4/build/pidl/pidl.pl
+++ b/source4/build/pidl/pidl.pl
@@ -90,6 +90,7 @@ sub process_file($)
{
my $idl_file = shift;
my $output;
+ my $pidl;
my $basename = basename($idl_file, ".idl");
@@ -104,47 +105,41 @@ sub process_file($)
print "Compiling $idl_file\n";
if ($opt_parse) {
- my($idl) = IdlParse($idl_file);
- defined $idl || die "Failed to parse $idl_file";
- util::SaveStructure($pidl_file, $idl) || die "Failed to save $pidl_file";
-
- IdlValidator::Validate($idl);
+ $pidl = IdlParse($idl_file);
+ defined $pidl || die "Failed to parse $idl_file";
+ IdlValidator::Validate($pidl);
+ if ($opt_keep && !util::SaveStructure($pidl_file, $pidl)) {
+ die "Failed to save $pidl_file\n";
+ }
+ } else {
+ $pidl = util::LoadStructure($pidl_file);
}
if ($opt_dump) {
- my($idl) = util::LoadStructure($pidl_file);
- print IdlDump::Dump($idl);
+ print IdlDump::Dump($pidl);
}
if ($opt_header) {
- my($idl) = util::LoadStructure($pidl_file);
my($header) = util::ChangeExtension($output, "h");
- util::FileSave($header, IdlHeader::Parse($idl));
+ util::FileSave($header, IdlHeader::Parse($pidl));
}
if ($opt_parser) {
- my($idl) = util::LoadStructure($pidl_file);
my($parser) = util::ChangeExtension($output, "c");
- IdlParser::Parse($idl, $parser);
+ IdlParser::Parse($pidl, $parser);
}
if ($opt_eparser) {
- my($idl) = util::LoadStructure($pidl_file);
my($parser) = util::ChangeExtension($output, "c");
- util::FileSave($parser, IdlEParser::Parse($idl));
+ util::FileSave($parser, IdlEParser::Parse($pidl));
}
if ($opt_diff) {
- my($idl) = util::LoadStructure($pidl_file);
my($tempfile) = util::ChangeExtension($output, "tmp");
- util::FileSave($tempfile, IdlDump::Dump($idl));
+ util::FileSave($tempfile, IdlDump::Dump($pidl));
system("diff -wu $idl_file $tempfile");
unlink($tempfile);
}
-
- if (!$opt_keep) {
- system("rm -f $pidl_file");
- }
}