r13355: check controls are correctly exported
[Samba/aatanasov.git] / source4 / script / yacc_compile.sh
blob77b5efb06f88e8a269be04bee6c6b45eae35a1a8
1 #!/bin/sh
3 YACC="$1"
4 SRC="$2"
5 DEST="$3"
7 dir=`dirname $SRC`
8 file=`basename $SRC`
9 base=`basename $SRC .y`
10 if [ -z "$YACC" ]; then
11 echo "yacc not found"
12 exit;
14 if [ -r $DEST ]; then
15 if [ x`find $SRC -newer $DEST -print` != x$SRC ]; then
16 exit;
19 TOP=`pwd`
20 if cd $dir && $YACC -d $file; then
21 if [ -r y.tab.h -a -r y.tab.c ];then
22 echo "move files"
23 sed -e "/^#/!b" -e "s|y\.tab\.h|$base.h|" y.tab.h > $base.h
24 sed '/^#/ s|y\.tab\.c|$base.c|' y.tab.c > $base.c
25 rm -f y.tab.c y.tab.h
28 cd $TOP