Merge branch 'master' of ssh://git.samba.org/data/git/samba into wspp-schema
[jra/samba/.git] / librpc / build_idl.sh
1 #!/bin/sh
2
3 if [ "$1" = "--full" ]; then
4         FULL=1
5         shift 1
6 else
7         FULL=0
8 fi
9
10 ARGS="--outputdir $PIDL_OUTPUTDIR --header --ndr-parser --samba3-ndr-server --samba3-ndr-client --server --client --python --dcom-proxy --com-header $PIDL_ARGS --"
11 IDL_FILES="$*"
12
13 oldpwd=`pwd`
14 cd ${srcdir}
15
16 [ -d $PIDL_OUTPUTDIR ] || mkdir -p $PIDL_OUTPUTDIR || exit 1
17
18 PIDL="$PIDL $ARGS"
19
20 if [ $FULL = 1 ]; then
21         echo "Rebuilding all idl files"
22         $PIDL $IDL_FILES || exit 1
23         exit 0
24 fi
25
26 ##
27 ## Find newer files rather than rebuild all of them
28 ##
29
30 list=""
31 for f in ${IDL_FILES}; do
32         basename=`basename $f .idl`
33         ndr="$PIDL_OUTPUTDIR/py_$basename.c"
34
35         if [ -f $ndr ]; then
36                 if [ "x`find $f -newer $ndr -print`" = "x$f" ]; then
37                         list="$list $f"
38                 fi
39         else 
40                 list="$list $f"
41         fi
42 done
43
44 ##
45 ## generate the ndr stubs
46 ##
47
48 if [ "x$list" != x ]; then
49         # echo "${PIDL} ${list}"
50         $PIDL $list || exit 1
51 fi
52
53 cd ${oldpwd}
54
55 exit 0