summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/Makefile.in2
-rwxr-xr-xsource4/build/pidl/pidl.pl130
-rwxr-xr-xsource4/script/build_idl.sh22
3 files changed, 89 insertions, 65 deletions
diff --git a/source4/Makefile.in b/source4/Makefile.in
index b6e9ee0327..e4d9dc6ce2 100644
--- a/source4/Makefile.in
+++ b/source4/Makefile.in
@@ -1088,11 +1088,9 @@ proto_exists: include/proto.h include/build_env.h \
include/tdbsam2_parse_info.h
delheaders:
- @echo Removing prototype headers
@/bin/rm -f $(srcdir)/include/proto.h $(srcdir)/include/build_env.h
include/proto.h:
- @echo Building include/proto.h
@cd $(srcdir) && $(SHELL) script/mkproto.sh $(PERL) \
-h _PROTO_H_ $(builddir)/include/proto.h \
$(PROTO_OBJ)
diff --git a/source4/build/pidl/pidl.pl b/source4/build/pidl/pidl.pl
index b4710e5756..b8802ebe23 100755
--- a/source4/build/pidl/pidl.pl
+++ b/source4/build/pidl/pidl.pl
@@ -12,6 +12,7 @@ use FindBin qw($RealBin);
use lib "$RealBin";
use lib "$RealBin/lib";
use Getopt::Long;
+use File::Basename;
use idl;
use dump;
use header;
@@ -98,65 +99,78 @@ if ($opt_help) {
exit(0);
}
-my($idl_file) = shift;
-die "ERROR: You must specify an idl file to process" unless ($idl_file);
-
-if (!defined($opt_output)) {
- $opt_output = $idl_file;
-}
-
-my($pidl_file) = util::ChangeExtension($opt_output, "pidl");
-
-if ($opt_parse) {
- print "Generating $pidl_file from $idl_file\n";
- 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);
-}
-
-if ($opt_dump) {
- my($idl) = util::LoadStructure($pidl_file);
- print IdlDump::Dump($idl);
-}
-
-if ($opt_header) {
- my($idl) = util::LoadStructure($pidl_file);
- my($header) = util::ChangeExtension($opt_output, "h");
- print "Generating $header\n";
- util::FileSave($header, IdlHeader::Parse($idl));
-}
-
-if ($opt_parser) {
- my($idl) = util::LoadStructure($pidl_file);
- my($parser) = util::ChangeExtension($opt_output, "c");
- print "Generating $parser\n";
- IdlParser::Parse($idl, $parser);
-}
-
-if ($opt_eparser) {
- my($idl) = util::LoadStructure($pidl_file);
- my($parser) = util::ChangeExtension($opt_output, "c");
- print "Generating $parser for ethereal\n";
- util::FileSave($parser, IdlEParser::Parse($idl));
-}
-
-if ($opt_client) {
- my($idl) = util::LoadStructure($pidl_file);
- my($client) = util::ChangeExtension($opt_client, "c");
- print "Generating $client client calls\n";
- util::FileSave($client, IdlClient::Parse($idl));
+sub process_file($)
+{
+ my $idl_file = shift;
+ my $output;
+
+ my $basename = basename($idl_file, ".idl");
+
+ if (!defined($opt_output)) {
+ $output = $idl_file;
+ } else {
+ $output = $opt_output . $basename;
+ }
+
+ my($pidl_file) = util::ChangeExtension($output, "pidl");
+
+ if ($opt_parse) {
+ print "Generating $pidl_file from $idl_file\n";
+ 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);
+ }
+
+ if ($opt_dump) {
+ my($idl) = util::LoadStructure($pidl_file);
+ print IdlDump::Dump($idl);
+ }
+
+ if ($opt_header) {
+ my($idl) = util::LoadStructure($pidl_file);
+ my($header) = util::ChangeExtension($output, "h");
+ print "Generating $header\n";
+ util::FileSave($header, IdlHeader::Parse($idl));
+ }
+
+ if ($opt_parser) {
+ my($idl) = util::LoadStructure($pidl_file);
+ my($parser) = util::ChangeExtension($output, "c");
+ print "Generating $parser\n";
+ IdlParser::Parse($idl, $parser);
+ }
+
+ if ($opt_eparser) {
+ my($idl) = util::LoadStructure($pidl_file);
+ my($parser) = util::ChangeExtension($output, "c");
+ print "Generating $parser for ethereal\n";
+ util::FileSave($parser, IdlEParser::Parse($idl));
+ }
+
+ if ($opt_client) {
+ my($idl) = util::LoadStructure($pidl_file);
+ my($client) = $opt_client . $basename;
+ $client = util::ChangeExtension($client, "c");
+ print "Generating $client client calls\n";
+ util::FileSave($client, IdlClient::Parse($idl));
+ }
+
+ if ($opt_diff) {
+ my($idl) = util::LoadStructure($pidl_file);
+ my($tempfile) = util::ChangeExtension($output, "tmp");
+ util::FileSave($tempfile, IdlDump::Dump($idl));
+ system("diff -wu $idl_file $tempfile");
+ unlink($tempfile);
+ }
+
+ if (!$opt_keep) {
+ system("rm -f $pidl_file");
+ }
}
-if ($opt_diff) {
- my($idl) = util::LoadStructure($pidl_file);
- my($tempfile) = util::ChangeExtension($opt_output, "tmp");
- util::FileSave($tempfile, IdlDump::Dump($idl));
- system("diff -wu $idl_file $tempfile");
- unlink($tempfile);
-}
-if (!$opt_keep) {
- system("rm -f $pidl_file");
+foreach my $filename (@ARGV) {
+ process_file($filename);
}
diff --git a/source4/script/build_idl.sh b/source4/script/build_idl.sh
index 569dd7dd31..9ad9391ee0 100755
--- a/source4/script/build_idl.sh
+++ b/source4/script/build_idl.sh
@@ -7,13 +7,25 @@ FULLBUILD=$1
( cd build/pidl && make ) || exit 1
+PIDL="build/pidl/pidl.pl --output librpc/gen_ndr/ndr_ --parse --header --parser --client librpc/gen_rpc/rpc_"
+
+if [ x$FULLBUILD = xFULL ]; then
+ echo Rebuilding all idl files in librpc/idl
+ $PIDL librpc/idl/*.idl || exit 1
+ exit 0
+fi
+
+list=""
+
for f in librpc/idl/*.idl; do
- base=`basename $f .idl`
- ndr=librpc/gen_ndr/ndr_$base
- if [ x$FULLBUILD = xFULL -o "$f" -nt $ndr.c ]; then
- echo Processing $f
- build/pidl/pidl.pl --output $ndr --parse --header --parser --client librpc/gen_rpc/rpc_$base.c $f || exit 1
+ basename=`basename $f .idl`
+ if [ "$f" -nt librpc/gen_ndr/ndr_$basename.c ]; then
+ list="$list $f"
fi
done
+if [ "x$list" != x ]; then
+ $PIDL $list || exit 1
+fi
+
exit 0