BUILDVC.BAT (1619B)
1 :: Call this with either x86 (for 32bit compile on a 32bit machine), 2 :: amd64 (if you want to do a 64bit compile on a 64bit machine), 3 :: or x86_amd64 (if you want to compile for amd64 on an x86) 4 :: With no argument, will default to amd64 on Win64 and x86 otherwise. 5 :: Call this with the argument "run" if you want to only run the 6 :: previously compiled executables. 7 @echo off 8 setlocal 9 if not "%1"=="run" goto :Default 10 set CC=echo 11 set CFLAGS= 12 goto :Loop 13 14 :Default 15 if "%~1"=="" goto :Guess 16 set NEWBUILDVC=%1 17 goto :Next 18 19 :Guess 20 set RegQry=HKLM\Hardware\Description\System\CentralProcessor\0 21 REG.exe Query %RegQry% > hwdesc.o 22 FIND /i "x86" < hwdesc.o > hwcheck.o 23 if %errorlevel% == 0 ( 24 set NEWBUILDVC=x86 25 ) else ( 26 set NEWBUILDVC=amd64 27 ) 28 29 :Next 30 if "%BUILDVC%"=="%NEWBUILDVC%" goto :Continue 31 if NOT DEFINED VCBAT set VCBAT="c:\Program Files (x86)\Microsoft Visual Studio 10.0\vc\vcvarsall.bat" 32 call %VCBAT% %NEWBUILDVC% 33 if errorlevel 1 exit /b 1 34 set BUILDVC=%NEWBUILDVC% 35 36 :Continue 37 :: /Zi for debug. /favor:INTEL64 is ignored for 32bit compiles. 38 if NOT DEFINED CFLAGS set CFLAGS=/DR123_NO_SINCOS=1 /I..\include /W3 /Ox /EHs /nologo /favor:INTEL64 39 set CC=cl 40 echo Using %VCBAT% 41 echo Building for %BUILDVC% with %CC% %CFLAGS% 42 43 :Loop 44 set BUILDFILES= ( kat_c.c kat_cpp.cpp pi_aes.cpp pi_capi.c pi_cppapi.cpp pi_microurng.cpp simple.c simplepp.cpp time_serial.c time_boxmuller.cpp timers.cpp ut_Engine.cpp ut_M128.cpp ut_ReinterpretCtr.cpp ut_aes.cpp ut_ars.c ut_carray.cpp ut_features.cpp ut_uniform.cpp ) 45 FOR %%A IN %BUILDFILES% DO ( 46 %CC% %CFLAGS% %%A 47 if errorlevel 1 exit /b 1 48 %%~nA 49 if errorlevel 1 exit /b 1 ) 50 endlocal