| 1 |
@echo off |
| 2 |
TITLE W32 STUNNEL |
| 3 |
:: In a multi-target compilation environment, it is better to open |
| 4 |
:: a new cmd.exe window in order to avoid PATH pollution |
| 5 |
:: (for example with some previous WCE compilation attempts) |
| 6 |
|
| 7 |
set NEWTGTCPU=W32 |
| 8 |
|
| 9 |
rem Adjust the MS VC environment variables |
| 10 |
rem --------------------- |
| 11 |
|
| 12 |
rem Detect the latest Visual Studio |
| 13 |
rem Visual Studio 2008 |
| 14 |
if DEFINED VS90COMNTOOLS if exist "%VS90COMNTOOLS%..\..\vc\vcvarsall.bat" set vsTools=%VS90COMNTOOLS% |
| 15 |
rem Visual Studio 2010 |
| 16 |
if DEFINED VS100COMNTOOLS if exist "%VS100COMNTOOLS%..\..\vc\vcvarsall.bat" set vsTools=%VS100COMNTOOLS% |
| 17 |
rem Visual Studio 2012 |
| 18 |
if DEFINED VS110COMNTOOLS if exist "%VS110COMNTOOLS%..\..\vc\vcvarsall.bat" set vsTools=%VS110COMNTOOLS% |
| 19 |
rem Visual Studio 2013 |
| 20 |
if DEFINED VS120COMNTOOLS if exist "%VS120COMNTOOLS%..\..\vc\vcvarsall.bat" set vsTools=%VS120COMNTOOLS% |
| 21 |
rem Visual Studio 2015 |
| 22 |
if DEFINED VS140COMNTOOLS if exist "%VS140COMNTOOLS%..\..\vc\vcvarsall.bat" set vsTools=%VS140COMNTOOLS% |
| 23 |
|
| 24 |
::rem Initialize the Visual Studio tools |
| 25 |
::call "%vsTools%..\..\vc\vcvarsall.bat" |
| 26 |
|
| 27 |
rem Check the MSenv variables against our reference values |
| 28 |
set isenvok=0 |
| 29 |
if NOT DEFINED TARGETCPU set TARGETCPU=XXXXX |
| 30 |
if "%NEWTGTCPU%"=="%TARGETCPU%" set /A "isenvok+=1" |
| 31 |
|
| 32 |
if %isenvok%==1 echo W32 ENVIRONMENT OK |
| 33 |
if %isenvok%==1 goto envisok |
| 34 |
|
| 35 |
:: Useless with separated target folders |
| 36 |
::echo W32 TARGET CPU changed, destroying every obj files |
| 37 |
::del .\*.obj |
| 38 |
|
| 39 |
:: if env is NOT ok, adjust the MS VC environment variables |
| 40 |
:: (this is to avoid repetitive pollution of PATH) |
| 41 |
|
| 42 |
echo W32 ENVIRONMENT ADJUSTED |
| 43 |
|
| 44 |
:: Reset of INCLUDE is needed because of accumulation of includes in vcvars32 |
| 45 |
|
| 46 |
set INCLUDE= |
| 47 |
|
| 48 |
call "%vsTools%..\..\vc\bin\vcvars32.bat" |
| 49 |
|
| 50 |
set TARGETCPU=%NEWTGTCPU% |
| 51 |
|
| 52 |
:envisok |
| 53 |
|
| 54 |
rem Make everything |
| 55 |
rem --------------- |
| 56 |
|
| 57 |
nmake.exe -f vc.mak %1 %2 %3 %4 %5 %6 %7 %8 %9 |