|
1 | 1 | @echo off
|
2 |
| -REM src/tools/msvc/pgflex.bat |
3 |
| - |
4 |
| -REM silence flex bleatings about file path style |
5 |
| -SET CYGWIN=nodosfilewarning |
6 |
| - |
7 |
| -IF NOT EXIST src\tools\msvc\buildenv.pl goto nobuildenv |
8 |
| -perl -e "require 'src/tools/msvc/buildenv.pl'; while(($k,$v) = each %%ENV) { print qq[\@SET $k=$v\n]; }" > bldenv.bat |
9 |
| -CALL bldenv.bat |
10 |
| -del bldenv.bat |
11 |
| -:nobuildenv |
12 |
| - |
13 |
| -flex -V > NUL |
14 |
| -if errorlevel 1 goto noflex |
15 | 2 |
|
16 |
| -if "%1" == "src\backend\parser\scan.l" call :generate %1 src\backend\parser\scan.c -CF |
17 |
| -if "%1" == "src\backend\bootstrap\bootscanner.l" call :generate %1 src\backend\bootstrap\bootscanner.c |
18 |
| -if "%1" == "src\backend\utils\misc\guc-file.l" call :generate %1 src\backend\utils\misc\guc-file.c |
19 |
| -if "%1" == "src\backend\replication\repl_scanner.l" call :generate %1 src\backend\replication\repl_scanner.c |
20 |
| -if "%1" == "src\test\isolation\specscanner.l" call :generate %1 src\test\isolation\specscanner.c |
21 |
| -if "%1" == "src\interfaces\ecpg\preproc\pgc.l" call :generate %1 src\interfaces\ecpg\preproc\pgc.c |
22 |
| -if "%1" == "src\bin\psql\psqlscan.l" call :generate %1 src\bin\psql\psqlscan.c |
23 |
| -if "%1" == "contrib\cube\cubescan.l" call :generate %1 contrib\cube\cubescan.c |
24 |
| -if "%1" == "contrib\seg\segscan.l" call :generate %1 contrib\seg\segscan.c |
25 |
| - |
26 |
| -echo Unknown flex input: %1 |
27 |
| -exit 1 |
28 |
| - |
29 |
| -REM For non-reentrant scanners we need to fix up the yywrap macro definition |
30 |
| -REM to keep the MS compiler happy. |
31 |
| -REM For reentrant scanners (like the core scanner) we do not |
32 |
| -REM need to (and must not) change the yywrap definition. |
33 |
| -:generate |
34 |
| -flex %3 -o%2 %1 |
35 |
| -if errorlevel 1 exit %errorlevel% |
36 |
| -perl -n -e "exit 1 if /^\%%option\s+reentrant/;" %1 |
37 |
| -if errorlevel 1 exit 0 |
38 |
| -perl -pi.bak -e "s/yywrap\(n\)/yywrap()/;" %2 |
39 |
| -if errorlevel 1 exit %errorlevel% |
40 |
| -del %2.bak |
41 |
| -exit 0 |
42 |
| - |
43 |
| -:noflex |
44 |
| -echo WARNING! flex install not found, attempting to build without |
45 |
| -exit 0 |
| 3 | +REM src/tools/msvc/pgflex.bat |
| 4 | +REM all the logic for this now belongs in builddoc.pl. This file really |
| 5 | +REM only exists so you don't have to type "perl src/tools/msvc/pgflex.pl" |
| 6 | +REM Resist any temptation to add any logic here. |
| 7 | +@perl src/tools/msvc/pgflex.pl %* |
0 commit comments