Jeff Cohen | 4ed1de8 | 2005-10-26 05:37:34 +0000 | [diff] [blame] | 1 | @echo off |
| 2 | rem dobison.cmd prefix mode target source |
| 3 | rem prefix - passed to bison as -p<prefix> |
| 4 | rem mode - either debug or release |
| 5 | rem target - generated parser file name without extension |
| 6 | rem source - input to bison |
Chuck Rose III | 0ccb930 | 2007-11-21 00:37:56 +0000 | [diff] [blame] | 7 | rem headercopydir - directory to receive a copy of the header |
Jeff Cohen | 4ed1de8 | 2005-10-26 05:37:34 +0000 | [diff] [blame] | 8 | |
| 9 | if "%2"=="debug" (set flags=-tvdo) else (set flags=-vdo) |
| 10 | |
Jeff Cohen | 53c13b1 | 2005-10-27 01:10:36 +0000 | [diff] [blame] | 11 | rem Test for presence of bison. |
| 12 | bison --help >NUL |
| 13 | if errorlevel 1 goto nobison |
Jeff Cohen | 4ed1de8 | 2005-10-26 05:37:34 +0000 | [diff] [blame] | 14 | |
Jeff Cohen | 53c13b1 | 2005-10-27 01:10:36 +0000 | [diff] [blame] | 15 | rem Run bison. |
Chuck Rose III | 0ccb930 | 2007-11-21 00:37:56 +0000 | [diff] [blame] | 16 | echo bison -p%1 %flags%%3.cpp %4 |
| 17 | echo move %3.hpp %3.h |
Jeff Cohen | 53c13b1 | 2005-10-27 01:10:36 +0000 | [diff] [blame] | 18 | bison -p%1 %flags%%3.cpp %4 && move %3.hpp %3.h |
Chuck Rose III | 0ccb930 | 2007-11-21 00:37:56 +0000 | [diff] [blame] | 19 | echo copy %3.h %5 |
| 20 | copy %3.h %5 |
Jeff Cohen | 53c13b1 | 2005-10-27 01:10:36 +0000 | [diff] [blame] | 21 | exit |
| 22 | |
| 23 | :nobison |
| 24 | echo Bison not found. Using pre-generated files. |
Chris Lattner | b08b8e6 | 2008-01-02 21:30:58 +0000 | [diff] [blame] | 25 | copy %~pn4.cpp.cvs %5\%3.cpp |
| 26 | copy %~pn4.h.cvs %5\%3.h |
Jeff Cohen | 53c13b1 | 2005-10-27 01:10:36 +0000 | [diff] [blame] | 27 | exit |