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