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