https://svn.lrde.epita.fr/svn/nolimips/trunk
Index: ChangeLog from Roland Levillain roland@lrde.epita.fr
Update bison++.
* build-aux/bison++.in: Catch up with TC's bison++.in.
bison++.in | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 69 insertions(+), 10 deletions(-)
Index: build-aux/bison++.in --- build-aux/bison++.in (revision 219) +++ build-aux/bison++.in (working copy) @@ -19,10 +19,15 @@ shift output=$1 output_base=$(basename "$output") +output_base_noext=$(echo "$output_base" | sed -e 's/.[^.]*//') output_dir=$(dirname "$output") -output_dir_abs=$(cd "$output_dir" && pwd) shift + options="$@" +if $BISON --xml --version >/dev/null 2>&1; then + options="$options --xml" +fi +
# Alexandre Duret-Lutz also notes that in VPATH-builds $(srcdir) can # be an absolute path depending on how ./configure is called ... @@ -34,7 +39,7 @@ # paths with Bison, chdir there.
# A tmp dir. -tmp=$output_base.dir +tmp=$output_base_noext.dir rm -rf $tmp mkdir $tmp
@@ -47,23 +52,77 @@ status=$? set -e
-if test $status = 0; then - for file in * + +# fix_bison_output FILE +# --------------------- +# Fixes in place. +fix_bison_output () +{ + # Fix doxygen tags. + perl -pi -e "s|\Q\file $base\E\b|\\file parse/$base|g;" "$1" + +} + +# Go back to where we were and use relative paths instead of using +# absolute file names. The messages look nicer. +cd .. +case $status in + 0) + for file in $tmp/* do - case $file in + base=$(basename $file) + base_noext=$(echo "$base" | sed -e 's/.[^.]*//') + out=$output_dir/$base + case $base in $input_base) # Leave it here. ;; + + *.xml) + # Computing the HTML is slow. Do it when the XML changed. + fix_bison_output "$file" + if ! test -r "$out" || ! cmp -s "$file" "$out"; then + xml2html="xsltproc $($BISON --print-datadir)/xslt/xml2xhtml.xsl" + if $xml2html "$file" >$tmp/$base_noext.html; then + $move_if_change "$tmp/$base_noext.html" \ + "$output_dir/$base_noext.html" + else + echo >&2 "$0: cannot convert XML report to HTML" + rm $tmp/$base_noext.html + fi + fi + $move_if_change "$file" "$out" + ;; + + *.hh) + fix_bison_output "$file" + # To save cycles, if the file differs only on sync lines, + # update it (to be right), but keep the original timestamps. + if test -r "$out" && + diff -I '^#line' -I '/* Line .* of .* */' -q "$file" "$out"; then + touch -r "$out" "$file" + cp "$out" "$out.bak" + echo >&2 "$0: kept the stamps of $file" + fi + $move_if_change "$file" "$out" + ;; + *) - # Fix doxygen tags. - perl -pi -e "s|\Q\file $file\E\b|\\file parse/$file|g;" "$file" - $move_if_change "$file" "$output_dir_abs/$file" + fix_bison_output "$file" + $move_if_change "$file" "$out" ;; esac done -fi + ;; + + *) # We really want to keep the *.output files. + for file in $(ls $tmp/*.output $tmp/*.xml $tmp/*.html 2>/dev/null) + do + $move_if_change "$file" "$output_dir/$(basename $file)" + done + ;; +esac
# Get rid of the tmp dir. -cd .. rm -rf $tmp exit $status