1set need_setup=0
2
3@rem if we don't have nmake in the path, we need to run setup
4where nmake.exe 2> NUL
5if %ERRORLEVEL% GTR 0 set need_setup=1
6
7@rem if we don't have the include path set, we need to run setup
8if not defined INCLUDE set need_setup=1
9
10@rem backup of the path, otherwise we end up with an "input line is too long"
11@rem error since the path env var is growing up at every call to vsvarsall.bat
12@set PATH_BACKUP=%PATH%
13
14@rem run setup if we need to
15if %need_setup% == 1 call "c:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
16
17@rem Allow python build to succeed:
18@rem http://stackoverflow.com/questions/2817869/error-unable-to-find-vcvarsall-bat
19SET VS90COMNTOOLS=%VS140COMNTOOLS%
20
21where python.exe 2> NUL
22if %ERRORLEVEL% GTR 0 set PATH=c:\Python27;%PATH%
23
24where php.exe 2> NUL
25if %ERRORLEVEL% GTR 0 set PATH=c:\php;%PATH%
26
27@rem finally, run make
28nmake /nologo /s /f winbuild\Makefile %1 %2 %3 %4
29
30SET RETURN_CODE=%ERRORLEVEL%
31
32@rem restore the original path value
33@set PATH=%PATH_BACKUP%
34
35@rem "input line is too long" problem occur also with the INCLUDE environment variable
36@rem We just wipe it since next call to the batch file will set back the right value
37@set INCLUDE=
38@set LIB=
39@set LIBPATH=
40
41EXIT /B %RETURN_CODE%
42