pthreadpool: fix helgrind error in pthreadpool_free()
[Samba.git] / source4 / heimdal_build / lexyacc.sh
blob00fe7a4bddb19feba8517b75349dc71e9624a218
1 #!/bin/bash
3 # rebuild our heimdal lex/yacc files. Run this manually if you update heimdal
5 lexfiles="heimdal/lib/asn1/lex.l heimdal/lib/hx509/sel-lex.l heimdal/lib/com_err/lex.l"
6 yaccfiles="heimdal/lib/asn1/asn1parse.y heimdal/lib/hx509/sel-gram.y heimdal/lib/com_err/parse.y"
8 set -e
10 LEX="lex"
11 YACC="yacc"
13 top=$PWD
15 call_lex() {
16 lfile="$1"
18 echo "Calling $LEX on $lfile"
20 dir=$(dirname $lfile)
21 base=$(basename $lfile .l)
22 cfile=$base".c"
23 lfile=$base".l"
25 cd $dir
27 # --noline specified because line directives cause more bother than they solve (issues with lcov finding the source files)
28 $LEX --noline $lfile || exit 1
30 if [ -r lex.yy.c ]; then
31 echo "#include \"config.h\"" > $base.c
32 grep -v "^#line" lex.yy.c >> $base.c
33 rm -f $base.yy.c
34 elif [ -r $base.yy.c ]; then
35 echo "#include \"config.h\"" > $base.c
36 grep -v "^#line" $base.yy.c >> $base.c
37 rm -f $base.yy.c
38 elif [ -r $base.c ]; then
39 mv $base.c $base.c.tmp
40 echo "#include \"config.h\"" > $base.c
41 grep -v "^#line" $base.c.tmp >> $base.c
42 rm -f $base.c.tmp
43 elif [ ! -r base.c ]; then
44 echo "$base.c nor $base.yy.c nor lex.yy.c generated."
45 exit 1
47 cd $top
51 call_yacc() {
52 yfile="$1"
54 echo "Calling $YACC on $yfile"
56 dir=$(dirname $yfile)
57 base=$(basename $yfile .y)
58 cfile=$base".c"
59 yfile=$base".y"
61 cd $dir
63 # -l specified because line directives cause more bother than they solve (issues with lcov finding the source files)
64 $YACC -l -d $yfile || exit 1
65 if [ -r y.tab.h -a -r y.tab.c ];then
66 cat y.tab.h > $base.h
67 cat y.tab.c > $base.c
68 rm -f y.tab.c y.tab.h
69 elif [ ! -r $base.h -a ! -r $base.c]; then
70 echo "$base.h nor $base.c generated."
71 exit 1
73 cd $top
78 for lfile in $lexfiles; do
79 call_lex $lfile
80 done
82 for yfile in $yaccfiles; do
83 call_yacc $yfile
84 done