blob: 1bebd6a607860954f953649125f1b37a0b499630 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
@echo off
REM $PostgreSQL: pgsql/src/tools/msvc/pgbison.bat,v 1.5 2007/03/17 14:01:01 mha Exp $
if exist src\tools\msvc\buildenv.bat call src\tools\msvc\buildenv.bat
SET BV=
for /F "tokens=4 usebackq" %%f in (`bison -V`) do if "!BV!"=="" SET BV=%%f
if "%BV%"=="" goto novarexp
if %BV% LSS 1.875 goto nobison
if %BV% EQU 2.1 goto nobison
if "%1" == "src\backend\parser\gram.y" call :generate %1 src\backend\parser\gram.c src\include\parser\parse.h
if "%1" == "src\backend\bootstrap\bootparse.y" call :generate %1 src\backend\bootstrap\bootparse.c src\backend\bootstrap\bootstrap_tokens.h
if "%1" == "src\pl\plpgsql\src\gram.y" call :generate %1 src\pl\plpgsql\src\pl_gram.c src\pl\plpgsql\src\pl.tab.h
if "%1" == "src\interfaces\ecpg\preproc\preproc.y" call :generate %1 src\interfaces\ecpg\preproc\preproc.c src\interfaces\ecpg\preproc\preproc.h
if "%1" == "contrib\cube\cubeparse.y" call :generate %1 contrib\cube\cubeparse.c contrib\cube\cubeparse.h
if "%1" == "contrib\seg\segparse.y" call :generate %1 contrib\seg\segparse.c contrib\seg\segparse.h
echo Unknown bison input: %1
exit 1
:generate
SET fn=%1
SET cf=%2
bison.exe -d %fn% -o %cf%
if errorlevel 1 exit 1
SET hf=%cf:~0,-2%.h
if not "%hf%"=="%3" (
copy /y %hf% %3
if errorlevel 1 exit 1
del %hf%
)
exit 0
:novarexp
echo pgbison must be called with cmd /V:ON /C pgbison to work!
exit 1
:nobison
echo WARNING! Bison install not found, or unsupported Bison version.
echo Attempting to build without.
exit 0
|