@rem ---------- uncomment to select between static and dynamic CRT
@rem set CRTLIB=shared
@set CRTLIB=static
@rem ---------- create directories for static libs and client includes
@mkdir ..\lib
@mkdir ..\include
@rem ---------- open includes and libs for edit in Perforce
@p4 open ..\include\...
@p4 open ..\lib\...
@rem ---------- copy over include files
@xcopy /E /F /R /Y ..\src\include ..\include
@rem ---------- set path to include local python and scons
@PATH %CD%\python;%CD%\python\scripts;%PATH%
@rem ---------- keep a copy of the current %PATH% to reset it later and avoid exceeding the path length
@set ORGPATH=%PATH%
@cd ..\src
@rem ---------- delete leftovers from previous builds
@del /Q *.lib
@del /Q /S obj
@del /Q *.idb
@del /Q *.pdb
@rem ---------- setup x64 VS10 build environment
@call "%VS100COMNTOOLS%\..\..\VC\vcvarsall.bat" amd64
@rem ---------- build x64 release static libs
@call scons.bat msvcrt=%CRTLIB% arch=x64 mode=release
@rem ---------- rename resulting libs
@ren v8.lib v8_winx64r.lib
@ren v8preparser.lib v8preparser_winx64r.lib
@rem ---------- cleanup
@del /Q /S obj
@del /Q *.idb
@del /Q *.pdb
@rem ---------- build x64 debug static libs
@call scons.bat msvcrt=%CRTLIB% arch=x64 mode=debug
@rem ---------- rename resulting libs
@ren v8_g.lib v8_winx64d.lib
@ren v8preparser_g.lib v8preparser_winx64d.lib
@rem ---------- setup x86 VS10 build environment
@PATH %ORGPATH%
@call "%VS100COMNTOOLS%\..\..\VC\vcvarsall.bat" x86
@rem ---------- cleanup
@del /Q /S obj
@del /Q *.idb
@del /Q *.pdb
@rem ---------- build x86 release static libs
@call scons.bat msvcrt=%CRTLIB% arch=ia32 mode=release env="PATH:%PATH%,INCLUDE:%INCLUDE%,LIB:%LIB%"
@rem ---------- rename resulting libs
@ren v8.lib v8_winx86r.lib
@ren v8preparser.lib v8preparser_winx86r.lib
@rem ---------- cleanup
@del /Q /S obj
@del /Q *.idb
@del /Q *.pdb
@rem ---------- build x86 debug static libs
@call scons.bat msvcrt=%CRTLIB% arch=ia32 mode=debug env="PATH:%PATH%,INCLUDE:%INCLUDE%,LIB:%LIB%"
@rem ---------- rename resulting libs
@ren v8_g.lib v8_winx86d.lib
@ren v8preparser_g.lib v8preparser_winx86d.lib
@rem ---------- cleanup
@PATH %ORGPATH%
@del /Q /S obj
@del /Q *.idb
@del /Q *.pdb
@del /Q obj
@set CRTLIB=
@copy *.lib ..\lib\
@del /Q *.lib
@rem ---------- go back to where we started
@cd ..\tools
