0f4908114edba03311050e72f4b5f0247d812ff7
[samba.git] / source3 / script / build_idl.sh
1 #!/bin/sh
2
3 ARGS="--includedir=../librpc/idl --outputdir $PIDL_OUTPUTDIR --header --ndr-parser --samba3-ndr-server --samba3-ndr-client $PIDL_ARGS --"
4 IDL_FILES="$*"
5
6 oldpwd=`pwd`
7 cd ${srcdir}
8
9 [ -d $PIDL_OUTPUTDIR ] || mkdir -p $PIDL_OUTPUTDIR || exit 1
10
11 PIDL="$PIDL $ARGS"
12
13 ##
14 ## Find newer files rather than rebuild all of them
15 ##
16
17 list=""
18 for f in ${IDL_FILES}; do
19         basename=`basename $f .idl`
20         ndr="$PIDL_OUTPUTDIR/ndr_$basename.c"
21
22         if [ -f $ndr ]; then
23                 if [ "x`find $f -newer $ndr -print`" = "x$f" ]; then
24                         list="$list $f"
25                 fi
26         else 
27                 list="$list $f"
28         fi
29 done
30
31 ##
32 ## generate the ndr stubs
33 ##
34
35 if [ "x$list" != x ]; then
36         # echo "${PIDL} ${list}"
37         $PIDL $list || exit 1
38 fi
39
40 cd ${oldpwd}
41
42 exit 0
43