Split g96 I/O routines from confio.cpp
[gromacs.git] / src / gromacs / selection / regenerate_parser.sh
blob56e2a77930fad170538b0f1d2ff2896347303a2d
1 #!/bin/bash
3 # This script runs Bison and/or Flex to regenerate the files as follows:
4 # parser.y -> parser.cpp, parser.h
5 # scanner.l -> scanner.cpp, scanner_flex.h
6 # The commands are run only if the generated files are older than the
7 # Bison/Flex input files, or if a '-f' flag is provided.
9 # Note: You can check parser.cpp/scanner.cpp for the exact versions of
10 # bison/flex that were used in the generation. Some OSs have older versions
11 # of these tools installed.
13 FORCE=
14 if [ "x$1" == "x-f" ] ; then
15 FORCE=1
18 if [ "x$BISON" == "x" ] ; then
19 BISON=bison
21 if [ "x$FLEX" == "x" ] ; then
22 FLEX=flex
25 # For convenience, change to the directory where the files are located
26 # if the script is run from the root of the source tree.
27 dirname=src/gromacs/selection
28 if [[ -f $dirname/parser.y && -f $dirname/scanner.l ]] ; then
29 cd $dirname
32 # We apply some trivial patches to the output to avoid warnings for PGI
33 # (and maybe other) compilers
34 [[ $FORCE || parser.y -nt parser.cpp ]] && \
35 echo Generating parser.cpp and parser.h... && \
36 $BISON -t -o parser.cpp --defines=parser.h parser.y && \
37 patch -p0 < parser.patch && \
38 rm -f parser.cpp.orig
39 [[ $FORCE || scanner.l -nt scanner.cpp ]] && \
40 echo Generating scanner.cpp and scanner_flex.h... && \
41 $FLEX -o scanner.cpp scanner.l && \
42 patch -p0 < scanner.patch && \
43 rm -f scanner.cpp.orig