r3790: use a registration function that is called from dcerpc_*_init functions
[samba.git] / source4 / script / build_idl.sh
1 #!/bin/sh
2
3 FULLBUILD=$1
4
5 [ -d librpc/gen_ndr ] || mkdir -p librpc/gen_ndr || exit 1
6
7 PIDL="$PERL ./build/pidl/pidl.pl --output librpc/gen_ndr/ndr_ --parse --header --parser --server"
8 EPARSERPIDL="$PERL ./build/pidl/pidl.pl --output $EPARSERPREFIX/ndr_ --parse --header --eparser"
9
10 if [ x$FULLBUILD = xFULL ]; then
11       echo Rebuilding all idl files in librpc/idl
12       $PIDL librpc/idl/*.idl || exit 1
13       exit 0
14 fi
15
16 if [ x$FULLBUILD = xEPARSER ]; then
17       echo Rebuilding all idl files in librpc/idl
18       $EPARSERPIDL librpc/idl/*.idl || exit 1
19       exit 0
20 fi
21
22 list=""
23
24 for f in librpc/idl/*.idl; do
25     basename=`basename $f .idl`
26     ndr="librpc/gen_ndr/ndr_$basename.c"
27     # blergh - most shells don't have the -nt function
28     if [ -f $ndr ]; then
29         if [ x`find $f -newer $ndr -print` = x$f ]; then
30             list="$list $f"
31         fi
32     else 
33         list="$list $f"
34     fi
35 done
36
37 if [ "x$list" != x ]; then
38     $PIDL $list || exit 1
39 fi
40
41 exit 0