2008-12-16 20:56:21 +03:00
#!/bin/sh
if [ " $1 " = "--full" ] ; then
FULL = 1
shift 1
else
FULL = 0
fi
2011-02-02 20:53:54 +03:00
ARGS = " --outputdir $PIDL_OUTPUTDIR --header --ndr-parser --samba3-ndr-server --server --client --python --dcom-proxy --com-header $PIDL_ARGS -- "
2008-12-16 20:56:21 +03:00
IDL_FILES = " $* "
oldpwd = ` pwd `
cd ${ srcdir }
[ -d $PIDL_OUTPUTDIR ] || mkdir -p $PIDL_OUTPUTDIR || exit 1
2012-04-16 03:00:46 +04:00
PIDL_DIR = ` dirname $PIDL `
PIDL_CMD = " $PIDL $ARGS "
2008-12-16 20:56:21 +03:00
if [ $FULL = 1 ] ; then
echo "Rebuilding all idl files"
2012-04-16 03:00:46 +04:00
$PIDL_CMD $IDL_FILES || exit 1
2008-12-16 20:56:21 +03:00
exit 0
fi
##
2012-04-16 03:00:46 +04:00
## Find newer files rather than rebuild all of them. Also handle the case
## where the pidl compiler itself is newer.
2008-12-16 20:56:21 +03:00
##
2012-04-19 11:03:18 +04:00
PIDL_NEWEST = $( ls -rt $( find $PIDL_DIR -type f) | tail -n -1)
2008-12-16 20:56:21 +03:00
list = ""
for f in ${ IDL_FILES } ; do
2010-05-04 09:34:32 +04:00
b = ` basename $f .idl`
2011-02-02 20:53:54 +03:00
outfiles = " $b .h ndr_ ${ b } _c.c ndr_ $b .h ndr_ ${ b } _s.c srv_ $b .c "
outfiles = " $outfiles ndr_ $b .c ndr_ ${ b } _c.h py_ $b .c srv_ $b .h "
2010-05-04 09:34:32 +04:00
for o in $outfiles ; do
[ -f $PIDL_OUTPUTDIR /$o ] || {
list = " $list $f "
break
}
2010-05-07 15:45:00 +04:00
test " `find $f -newer $PIDL_OUTPUTDIR / $o ` " != "" && {
2008-12-16 20:56:21 +03:00
list = " $list $f "
2010-05-04 09:34:32 +04:00
break
}
2012-04-16 03:00:46 +04:00
test " `find $PIDL_NEWEST -newer $PIDL_OUTPUTDIR / $o ` " != "" && {
list = " $list $f "
break
}
2010-05-04 09:34:32 +04:00
done
2008-12-16 20:56:21 +03:00
done
##
## generate the ndr stubs
##
if [ " x $list " != x ] ; then
2012-04-16 03:00:46 +04:00
# echo "${PIDL_CMD} ${list}"
$PIDL_CMD $list || exit 1
2008-12-16 20:56:21 +03:00
fi
cd ${ oldpwd }
exit 0