cope with yapp not being installed
[ira/wip.git] / source / 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 if [ ! -f build/pidl/idl.pm -o build/pidl/idl.yp -nt build/pidl/idl.pm ]; then
8     if `which yapp`; then
9         echo Rebuilding IDL parser
10         ( cd build/pidl && make ) || exit 1;
11     else 
12         echo "warning: yapp is not installed";
13     fi
14 fi
15
16 PIDL="build/pidl/pidl.pl --output librpc/gen_ndr/ndr_ --parse --header --parser"
17 TABLES="build/pidl/tables.pl --output librpc/gen_ndr/tables"
18
19 if [ x$FULLBUILD = xFULL ]; then
20       echo Rebuilding all idl files in librpc/idl
21       $PIDL librpc/idl/*.idl || exit 1
22
23       echo Rebuilding IDL tables
24       $TABLES librpc/gen_ndr/ndr_*.h || exit 1
25       exit 0
26 fi
27
28 list=""
29
30 for f in librpc/idl/*.idl; do
31     basename=`basename $f .idl`
32     if [ "$f" -nt librpc/gen_ndr/ndr_$basename.c ]; then
33         list="$list $f"
34     fi
35 done
36
37 if [ "x$list" != x ]; then
38     $PIDL $list || exit 1
39     $TABLES librpc/gen_ndr/ndr_*.h || exit 1
40 fi
41
42 exit 0