s3/ldap: remove outdated netscape ds 5 schema file
[Samba/gbeck.git] / librpc / build_idl.sh
blobe028bc68311dd036fd724782e1cfa3ce2fd9d92c
1 #!/bin/sh
3 if [ "$1" = "--full" ]; then
4 FULL=1
5 shift 1
6 else
7 FULL=0
8 fi
10 ARGS="--outputdir $PIDL_OUTPUTDIR --header --ndr-parser --samba3-ndr-server --server --client --python --dcom-proxy --com-header $PIDL_ARGS --"
11 IDL_FILES="$*"
13 oldpwd=`pwd`
14 cd ${srcdir}
16 [ -d $PIDL_OUTPUTDIR ] || mkdir -p $PIDL_OUTPUTDIR || exit 1
18 PIDL_DIR=`dirname $PIDL`
19 PIDL_CMD="$PIDL $ARGS"
21 if [ $FULL = 1 ]; then
22 echo "Rebuilding all idl files"
23 $PIDL_CMD $IDL_FILES || exit 1
24 exit 0
28 ## Find newer files rather than rebuild all of them. Also handle the case
29 ## where the pidl compiler itself is newer.
31 PIDL_NEWEST=`find $PIDL_DIR -type f -printf "%p\0%T@\n" \
32 | perl -e '$ts_newest = 0;
33 while (<STDIN>) {
34 ($f, $ts) = split(/\0/);
35 next if ($ts <= $ts_newest);
36 $ts_newest = $ts;
37 $f_newest = $f;
39 print $f_newest'` || exit 1
41 list=""
42 for f in ${IDL_FILES}; do
43 b=`basename $f .idl`
44 outfiles="$b.h ndr_${b}_c.c ndr_$b.h ndr_${b}_s.c srv_$b.c"
45 outfiles="$outfiles ndr_$b.c ndr_${b}_c.h py_$b.c srv_$b.h"
47 for o in $outfiles; do
48 [ -f $PIDL_OUTPUTDIR/$o ] || {
49 list="$list $f"
50 break
52 test "`find $f -newer $PIDL_OUTPUTDIR/$o`" != "" && {
53 list="$list $f"
54 break
56 test "`find $PIDL_NEWEST -newer $PIDL_OUTPUTDIR/$o`" != "" && {
57 list="$list $f"
58 break
60 done
61 done
64 ## generate the ndr stubs
67 if [ "x$list" != x ]; then
68 # echo "${PIDL_CMD} ${list}"
69 $PIDL_CMD $list || exit 1
72 cd ${oldpwd}
74 exit 0