r8803: Rename --header to --ndr-header and --parser to --ndr-parser
[sfrench/samba-autobuild/.git] / source4 / script / build_idl.sh
1 #!/bin/sh
2
3 FULLBUILD=$1
4 shift 1
5 PIDL_EXTRA_ARGS="$*"
6
7 [ -d librpc/gen_ndr ] || mkdir -p librpc/gen_ndr || exit 1
8
9 PIDL="$PERL -Ibuild/pidl ./build/pidl/pidl --outputdir librpc/gen_ndr --parse --ndr-header --ndr-parser --server --client --dcom-proxy --com-header --swig --odl --ejs $PIDL_EXTRA_ARGS"
10
11 if [ x$FULLBUILD = xFULL ]; then
12       echo Rebuilding all idl files in librpc/idl
13       $PIDL librpc/idl/*.idl || exit 1
14       exit 0
15 fi
16
17 list=""
18
19 for f in librpc/idl/*.idl ; do
20     basename=`basename $f .idl`
21     ndr="librpc/gen_ndr/ndr_$basename.c"
22     # blergh - most shells don't have the -nt function
23     if [ -f $ndr ]; then
24         if [ x`find $f -newer $ndr -print` = x$f ]; then
25             list="$list $f"
26         fi
27     else 
28         list="$list $f"
29     fi
30 done
31
32 if [ "x$list" != x ]; then
33     $PIDL $list || exit 1
34 fi
35
36 exit 0