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.
14 if [ "x$1" == "x-f" ] ; then
18 if [ "x$BISON" == "x" ] ; then
21 if [ "x$FLEX" == "x" ] ; then
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
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 ]] && $BISON -t -o parser.cpp --defines=parser.h parser.y && patch -p0 < parser.patch && rm -f parser.cpp.orig
35 [[ $FORCE || scanner.l -nt scanner.cpp ]] && $FLEX -o scanner.cpp scanner.l && patch -p0 < scanner.patch && rm -f scanner.cpp.orig