summaryrefslogtreecommitdiff
path: root/source4/librpc
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-05-19 02:03:00 +0200
committerJelmer Vernooij <jelmer@samba.org>2008-05-19 02:03:00 +0200
commit32dfdae009132ed2152f1c3ba242df630c0d9e22 (patch)
tree1fbbad81e8d8f9e5efd75c004ca240056d730739 /source4/librpc
parent60ae8f06574c74261643f469e6be2a945fd90880 (diff)
downloadsamba-32dfdae009132ed2152f1c3ba242df630c0d9e22.tar.gz
samba-32dfdae009132ed2152f1c3ba242df630c0d9e22.tar.bz2
samba-32dfdae009132ed2152f1c3ba242df630c0d9e22.zip
Move IDL build script to rpc directory, make various bits and pieces easier to use externally.
(This used to be commit 8328ff76416df5a6e05461d3a19f510b76f2e902)
Diffstat (limited to 'source4/librpc')
-rw-r--r--source4/librpc/config.mk16
-rwxr-xr-xsource4/librpc/idl-deps.pl22
-rwxr-xr-xsource4/librpc/scripts/build_idl.sh38
3 files changed, 64 insertions, 12 deletions
diff --git a/source4/librpc/config.mk b/source4/librpc/config.mk
index f25f90c96d..b9f79a51e6 100644
--- a/source4/librpc/config.mk
+++ b/source4/librpc/config.mk
@@ -359,7 +359,7 @@ include $(librpcsrcdir)/idl-deps
$(gen_ndrsrcdir)/tables.c: $(IDL_NDR_PARSE_H_FILES)
@echo Generating $@
- @$(PERL) $(srcdir)/$(librpcsrcdir)/tables.pl --output=$@ $^ > $(gen_ndrsrcdir)/tables.x
+ @$(PERL) $(librpcsrcdir)/tables.pl --output=$@ $^ > $(gen_ndrsrcdir)/tables.x
@mv $(gen_ndrsrcdir)/tables.x $@
[SUBSYSTEM::NDR_TABLE]
@@ -801,3 +801,17 @@ python_drsuapi_OBJ_FILES = $(gen_ndrsrcdir)/py_drsuapi.o
PRIVATE_DEPENDENCIES = PYTALLOC
python_dcerpc_security_OBJ_FILES = $(gen_ndrsrcdir)/py_security.o
+
+$(IDL_HEADER_FILES) $(IDL_NDR_PARSE_H_FILES) $(IDL_NDR_PARSE_C_FILES) \
+ $(IDL_NDR_CLIENT_C_FILES) $(IDL_NDR_CLIENT_H_FILES) \
+ $(IDL_NDR_SERVER_C_FILES) $(IDL_SWIG_FILES) \
+ $(IDL_NDR_EJS_C_FILES) $(IDL_NDR_EJS_H_FILES) \
+ $(IDL_NDR_PY_C_FILES) $(IDL_NDR_PY_H_FILES): idl
+
+idl_full:: $(pidldir)/lib/Parse/Pidl/IDL.pm $(pidldir)/lib/Parse/Pidl/Expr.pm
+ @CPP="$(CPP)" PIDL="$(PIDL)" $(librpcsrcdir)/scripts/build_idl.sh FULL $(librpcsrcdir)/idl $(librpcsrcdir)/gen_ndr
+
+idl:: $(pidldir)/lib/Parse/Pidl/IDL.pm $(pidldir)/lib/Parse/Pidl/Expr.pm
+ @CPP="$(CPP)" PIDL="$(PIDL)" $(librpcsrcdir)/scripts/build_idl.sh PARTIAL $(librpcsrcdir)/idl $(librpcsrcdir)/gen_ndr
+
+
diff --git a/source4/librpc/idl-deps.pl b/source4/librpc/idl-deps.pl
index d5bfe0b2ec..e630ee4f61 100755
--- a/source4/librpc/idl-deps.pl
+++ b/source4/librpc/idl-deps.pl
@@ -6,17 +6,17 @@ my %vars = ();
foreach(@ARGV) {
push (@{$vars{IDL_FILES}}, $_);
my $b = $_; $b =~ s/.*\/(.*?).idl$/$1/;
- push (@{$vars{IDL_HEADER_FILES}}, "librpc/gen_ndr/$b.h");
- push (@{$vars{IDL_NDR_PARSE_H_FILES}}, "librpc/gen_ndr/ndr_$b.h");
- push (@{$vars{IDL_NDR_PARSE_C_FILES}}, "librpc/gen_ndr/ndr_$b.c");
- push (@{$vars{IDL_NDR_CLIENT_C_FILES}}, "librpc/gen_ndr/ndr_$b\_c.c");
- push (@{$vars{IDL_NDR_CLIENT_H_FILES}}, "librpc/gen_ndr/ndr_$b\_c.h");
- push (@{$vars{IDL_SWIG_FILES}}, "librpc/gen_ndr/$b.i");
- push (@{$vars{IDL_NDR_SERVER_C_FILES}}, "librpc/gen_ndr/ndr_$b\_s.c");
- push (@{$vars{IDL_NDR_EJS_C_FILES}}, "librpc/gen_ndr/ndr_$b\_ejs.c");
- push (@{$vars{IDL_NDR_EJS_H_FILES}}, "librpc/gen_ndr/ndr_$b\_ejs.h");
- push (@{$vars{IDL_NDR_PY_C_FILES}}, "librpc/gen_ndr/py_$b.c");
- push (@{$vars{IDL_NDR_PY_H_FILES}}, "librpc/gen_ndr/py_$b.h");
+ push (@{$vars{IDL_HEADER_FILES}}, "\$(librpcsrcdir)/gen_ndr/$b.h");
+ push (@{$vars{IDL_NDR_PARSE_H_FILES}}, "\$(librpcsrcdir)/gen_ndr/ndr_$b.h");
+ push (@{$vars{IDL_NDR_PARSE_C_FILES}}, "\$(librpcsrcdir)/gen_ndr/ndr_$b.c");
+ push (@{$vars{IDL_NDR_CLIENT_C_FILES}}, "\$(librpcsrcdir)/gen_ndr/ndr_$b\_c.c");
+ push (@{$vars{IDL_NDR_CLIENT_H_FILES}}, "\$(librpcsrcdir)/gen_ndr/ndr_$b\_c.h");
+ push (@{$vars{IDL_SWIG_FILES}}, "\$(librpcsrcdir)/gen_ndr/$b.i");
+ push (@{$vars{IDL_NDR_SERVER_C_FILES}}, "\$(librpcsrcdir)/gen_ndr/ndr_$b\_s.c");
+ push (@{$vars{IDL_NDR_EJS_C_FILES}}, "\$(librpcsrcdir)/gen_ndr/ndr_$b\_ejs.c");
+ push (@{$vars{IDL_NDR_EJS_H_FILES}}, "\$(librpcsrcdir)/gen_ndr/ndr_$b\_ejs.h");
+ push (@{$vars{IDL_NDR_PY_C_FILES}}, "\$(librpcsrcdir)/gen_ndr/py_$b.c");
+ push (@{$vars{IDL_NDR_PY_H_FILES}}, "\$(librpcsrcdir)/gen_ndr/py_$b.h");
}
foreach (keys %vars) {
diff --git a/source4/librpc/scripts/build_idl.sh b/source4/librpc/scripts/build_idl.sh
new file mode 100755
index 0000000000..5796f40c61
--- /dev/null
+++ b/source4/librpc/scripts/build_idl.sh
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+FULLBUILD=$1
+IDLDIR=$2
+OUTDIR=$3
+shift 3
+PIDL_EXTRA_ARGS="$*"
+
+[ -d $OUTDIR ] || mkdir -p $OUTDIR || exit 1
+
+PIDL="$PIDL --outputdir $OUTDIR --header --ndr-parser --server --client --swig --ejs --python $PIDL_EXTRA_ARGS"
+
+if [ x$FULLBUILD = xFULL ]; then
+ echo Rebuilding all idl files in $IDLDIR
+ $PIDL $IDLDIR/*.idl || exit 1
+ exit 0
+fi
+
+list=""
+
+for f in $IDLDIR/*.idl ; do
+ basename=`basename $f .idl`
+ ndr="$OUTDIR/ndr_$basename.c"
+ # blergh - most shells don't have the -nt function
+ if [ -f $ndr ]; then
+ if [ x`find $f -newer $ndr -print` = x$f ]; then
+ list="$list $f"
+ fi
+ else
+ list="$list $f"
+ fi
+done
+
+if [ "x$list" != x ]; then
+ $PIDL $list || exit 1
+fi
+
+exit 0