@echo off if /I "%ScriptDebug%" EQU "Yes" ( @echo on ) @rem @setlocal enableextensions rem This needs to be defined before invoking goto usage. set _EXIT_CMD=exit /b if .==.%1 goto good if ".%1"=="./?" goto usage :good rem Save path when first run. Need to use goto in case the path contains parens. if defined SINGULARITY_SAVED_PATH goto SINGULARITY_SAVED_PATH_set set SINGULARITY_SAVED_PATH=%PATH% :SINGULARITY_SAVED_PATH_set rem Set source directory set SINGULARITY_ROOT=%~dp0 if .%SINGULARITY_ROOT:~-1%==.\ ( set SINGULARITY_ROOT=%SINGULARITY_ROOT:~0,-1% ) rem Set default object output directory. set SINGULARITY_OBJROOT=%SINGULARITY_ROOT%.obj rem Clear no defaults variable. Needs to be reset after missing default rem causes an error. set NO_SINGULARITY_DEFAULTS= rem Clear the codegen variable. It will be reset by the default codegen rem variable that should still be in the environment or will be set by a rem platform option. set CODE_GENERATOR= set CODE_GENERATOR_BUILD= set CODE_GENERATOR_RUNTIME= :parse if /I .%1==./release ( set Configuration=Release shift /1 goto parse ) if /I .%1==./debug ( set Configuration=Debug shift /1 goto parse ) if /I .%1==./terminate ( set _EXIT_CMD=exit shift /1 goto parse ) if /I .%1==./prototype ( set Configuration=Prototype shift /1 goto parse ) if /I .%1==./apicup ( set PLATFORM=ApicPC set PROCESSOR=x86 shift /1 goto parse ) if /I .%1==./apic ( set PLATFORM=ApicMP set PROCESSOR=x86 shift /1 goto parse ) if /I .%1==./mp ( set PLATFORM=ApicMP set PROCESSOR=x86 shift /1 goto parse ) if /I .%1==./apic64 ( set PLATFORM=Apic64 set PROCESSOR=x64 shift /1 goto parse ) rem Temporarily disabled until ARM support is ready rem if /I .%1==./omap3430 ( rem set PLATFORM=Omap3430 rem set PROCESSOR=arm rem set COLLECTOR_KERNEL=MarkSweep rem set COLLECTOR_APP=MarkSweep rem set CODE_GENERATOR=PHXBRIDGE rem shift /1 rem goto parse rem ) rem Temporarily disabled until ARM support is ready rem if /I .%1==./smdk2410 ( rem set PLATFORM=Smdk2410 rem set PROCESSOR=arm rem set COLLECTOR_KERNEL=MarkSweep rem set COLLECTOR_APP=MarkSweep rem set CODE_GENERATOR=PHXBRIDGE rem shift /1 rem goto parse rem ) if /I .%1==./kms ( set COLLECTOR_KERNEL=MarkSweep shift /1 goto parse ) if /I .%1==./kcc ( set COLLECTOR_KERNEL=Concurrent shift /1 goto parse ) if /I .%1==./kss ( set COLLECTOR_KERNEL=Semispace shift /1 goto parse ) if /I .%1==./knl ( set COLLECTOR_KERNEL=Null shift /1 goto parse ) if /I .%1==./pms ( set COLLECTOR_APP=MarkSweep shift /1 goto parse ) rem Currently broken - see internal bug 60 rem if /I .%1==./pcc ( rem set COLLECTOR_APP=Concurrent rem shift /1 rem goto parse rem ) rem Currently broken - see internal bug 63 rem if /I .%1==./pss ( rem set COLLECTOR_APP=Semispace rem shift /1 rem goto parse rem ) if /I .%1==./pnl ( set COLLECTOR_APP=Null shift /1 goto parse ) rem Currently broken - see internal bug 75 rem if /I .%1==./paging ( rem set PAGING=On rem shift /1 rem goto parse rem ) if /I .%1==./nopaging ( set PAGING=Off shift /1 goto parse ) if /I .%1==./affinity ( set SCHEDULER=Affinity shift /1 goto parse ) if /I .%1==./noaffinity ( set SCHEDULER=Min shift /1 goto parse ) if /I .%1==./objdir ( set SINGULARITY_OBJROOT=%~f2 shift /1 shift /1 goto parse ) if /I .%1==./fullpaths ( set ShowFullPaths=true shift /1 goto parse ) if /I .%1==./nofullpaths ( set ShowFullPaths=false shift /1 goto parse ) if /I .%1==./failearly ( set StopOnFirstFailure=true shift /1 goto parse ) if /I .%1==./nofailearly ( set StopOnFirstFailure=false shift /1 goto parse ) if /I .%1==./skipapps ( set DistroSkipApps=true shift /1 goto parse ) if /I .%1==./noskipapps ( set DistroSkipApps=false shift /1 goto parse ) if /I .%1==./skipkernel ( set DistroSkipKernel=true shift /1 goto parse ) if /I .%1==./noskipkernel ( set DistroSkipKernel=false shift /1 goto parse ) rem Currently broken - see internal bug 61 rem if /I .%1==./parallel ( rem set BuildInParallel=true rem shift /1 rem goto parse rem ) if /I .%1==./noparallel ( set BuildInParallel=false shift /1 goto parse ) if /I .%1==./bartok ( set CODE_GENERATOR=BARTOK shift /1 goto parse ) rem Currently broken - see internal bug 65 rem if /I .%1==./phxbridge ( rem set CODE_GENERATOR=PHXBRIDGE rem shift /1 rem goto parse rem ) if /I .%1==./codegenDBG ( set CODE_GENERATOR_BUILD=DEBUG shift /1 goto parse ) if /I .%1==./codegenTST ( set CODE_GENERATOR_BUILD=TEST shift /1 goto parse ) if /I .%1==./codegenREL ( set CODE_GENERATOR_BUILD=RELEASE shift /1 goto parse ) if /I .%1==./codegenCLR ( set CODE_GENERATOR_RUNTIME=CLR shift /1 goto parse ) if /I .%1==./codegenSH1 ( set CODE_GENERATOR_RUNTIME=SELFHOST1 shift /1 goto parse ) if /I "%1" == "/distro" ( set SINGULARITY_DISTRO_NAME=%2 shift /1 shift /1 goto parse ) if /I "%1" == "/nodistro" ( set SINGULARITY_DISTRO_NAME= shift /1 goto parse ) rem Currently broken - see internal bug 7 rem if /I "%1" == "/linkedstacks" ( rem set SINGULARITY_LINKED_STACKS=true rem shift /1 rem goto parse rem ) if /I "%1" == "/nolinkedstacks" ( set SINGULARITY_LINKED_STACKS=false shift /1 goto parse ) if /I "%1" == "/stackchecks" ( set SINGULARITY_STACK_CHECKS=true shift /1 goto parse ) if /I "%1" == "/nostackchecks" ( set SINGULARITY_STACK_CHECKS=false shift /1 goto parse ) rem Use goto in case %SINGULARITY_SAVED_PATH% contains parens if /I not .%1==./clean goto noclean set SINGULARITY_ROOT= set SINGULARITY_OBJROOT= set SINGULARITY_INTERNAL= set SINGULARITY_DISTRO_SUFFIX= set SINGULARITY_DISTRO_NAME= set SINGULARITY_BUILD_SETTINGS= set PATH=%SINGULARITY_SAVED_PATH% set SINGULARITY_SAVED_PATH= set Configuration= set PLATFORM= set PROCESSOR= set BUILDTYPE= set COLLECTOR_KERNEL= set COLLECTOR_APP= set PAGING= set PAGING_FLAG= set GENERATE_ABI_SHIM= set SCHEDULER= set ShowFullPaths= set StopOnFirstFailure= set DistroSkipApps= set DistroSkipKernel= set BuildInParallel= set SINGULARITY_PATH= set CODE_GENERATOR= set CODE_GENERATOR_BUILD= set CODE_GENERATOR_RUNTIME= set SINGULARITY_LINKED_STACKS= set SINGULARITY_STACK_CHECKS= set DEFAULT_CODE_GENERATOR= set KERNEL_GC= set SINGULARITY_BUILD_ISO= set SINGULARITY_DISTRO_PATH= set TITLE= echo.Environment cleaned. title CLEAN rem This cleans the _EXIT_CMD variable while still being able to rem execute its contents. ( set _EXIT_CMD= %_EXIT_CMD% 0 ) :noclean if /I .%1==./nodefaults ( set GENERATE_ABI_SHIM=Off set NO_SINGULARITY_DEFAULTS=Yes shift /1 goto parse ) if /I .%1==./notitle ( set NO_SINGULARITY_WINDOW_TITLE=Yes shift /1 goto parse ) if /I .%1==./vs ( set _create_vs_targets=On shift /1 goto parse ) if /I .%1==./iso ( set SINGULARITY_BUILD_ISO=true shift /1 goto parse ) if /I .%1==./noiso ( set SINGULARITY_BUILD_ISO=false shift /1 goto parse ) setlocal set ARG=.%1 if %ARG:~0,2%==./ ( echo.Unrecognized option "%1" %_EXIT_CMD% 2 ) endlocal :finished set TITLE= if "%SINGULARITY_DISTRO_NAME%" == "" ( set SINGULARITY_DISTRO_NAME=BVT ) set SINGULARITY_DISTRO_PATH=%SINGULARITY_ROOT%\Distro\%SINGULARITY_DISTRO_NAME%.proj if not exist "%SINGULARITY_DISTRO_PATH%" ( echo. echo *** WARNING: You have selected '%SINGULARITY_DISTRO_NAME%' as the current distro project, echo *** but there is no such file '%SINGULARITY_DISTRO_PATH%'. echo. ) if .%Configuration%==.Release ( rem ) else if .%Configuration%==.Debug ( rem ) else if .%Configuration%==.Prototype ( rem ) else ( if .%NO_SINGULARITY_DEFAULTS%==.Yes ( echo.Missing or invalid 'Configuration' value: "%Configuration%" %_EXIT_CMD% 1 ) set Configuration=Debug ) if .%SINGULARITY_BUILD_ISO%==.true ( rem ) else if .%SINGULARITY_BUILD_ISO%==.false ( rem ) else ( if .%NO_SINGULARITY_DEFAULTS%==.Yes ( echo.Missing or invalid 'SINGULARITY_BUILD_ISO' value: "%SINGULARITY_BUILD_ISO%" %_EXIT_CMD% 1 ) set SINGULARITY_BUILD_ISO=true ) if .%SINGULARITY_LINKED_STACKS%==.true ( rem Currently broken - see internal bug 7 rem rem set TITLE=%TITLE% Pcc echo.SINGULARITY_LINKED_STACKS value "%SINGULARITY_LINKED_STACKS%" is not currently available. %_EXIT_CMD% 1 ) else if .%SINGULARITY_LINKED_STACKS%==.false ( rem ) else ( rem if .%NO_SINGULARITY_DEFAULTS%==.Yes ( rem echo.Missing or invalid 'SINGULARITY_LINKED_STACKS' value: "%SINGULARITY_LINKED_STACKS%" rem %_EXIT_CMD% 1 rem ) set SINGULARITY_LINKED_STACKS=false ) if .%SINGULARITY_STACK_CHECKS%==.true ( rem ) else if .%SINGULARITY_STACK_CHECKS%==.false ( rem ) else ( if .%NO_SINGULARITY_DEFAULTS%==.Yes ( echo.Missing or invalid 'SINGULARITY_STACK_CHECKS' value: "%SINGULARITY_STACK_CHECKS%" %_EXIT_CMD% 1 ) set SINGULARITY_STACK_CHECKS=true ) if .%CODE_GENERATOR_BUILD%==.DEBUG ( rem ) else if .%CODE_GENERATOR_BUILD%==.TEST ( rem ) else if .%CODE_GENERATOR_BUILD%==.RELEASE ( rem ) else if .%CODE_GENERATOR_BUILD%==.CLR ( rem ) else ( if .%NO_SINGULARITY_DEFAULTS%==.Yes ( echo.Missing or invalid 'CODE_GENERATOR_BUILD' value: "%CODE_GENERATOR_BUILD%" %_EXIT_CMD% 1 ) set CODE_GENERATOR_BUILD=DEBUG ) call :SetInitialTitle "%SINGULARITY_ROOT%" set TITLE=%TITLE% %Configuration% if .%PLATFORM%==.ApicPC ( rem ) else if .%PLATFORM%==.ApicMP ( rem ) else if .%PLATFORM%==.Apic64 ( rem ) else if .%PLATFORM%==.Omap3430 ( rem rem ARM support temporarily removed. echo.'Platform' value "%PLATFORM%" is not currently available. %_EXIT_CMD% 1 ) else if .%PLATFORM%==.Smdk2410 ( rem rem ARM support temporarily removed. echo.'Platform' value "%PLATFORM%" is not currently available. %_EXIT_CMD% 1 ) else ( if .%NO_SINGULARITY_DEFAULTS%==.Yes ( echo.Missing or invalid 'Platform' value: "%PLATFORM%" %_EXIT_CMD% 1 ) set PLATFORM=ApicMP set PROCESSOR=x86 set DEFAULT_CODE_GENERATOR=BARTOK ) set TITLE=%TITLE% %PLATFORM% if .%COLLECTOR_KERNEL%==.MarkSweep ( set KERNEL_GC=Kms ) else if .%COLLECTOR_KERNEL%==.Concurrent ( set KERNEL_GC=Kcc ) else if .%COLLECTOR_KERNEL%==.Semispace ( set KERNEL_GC=Kss rem ) else if .%COLLECTOR_KERNEL%==.Null ( set TITLE=%TITLE% Knl rem ) else if .%COLLECTOR_KERNEL%==.Null ( set TITLE=%TITLE% Knl rem ) else ( if .%NO_SINGULARITY_DEFAULTS%==.Yes ( echo.Missing or invalid COLLECTOR_KERNEL value: "%COLLECTOR_KERNEL" %_EXIT_CMD% 1 ) set COLLECTOR_KERNEL=Concurrent set KERNEL_GC=Kcc ) set TITLE=%TITLE% %KERNEL_GC% if .%COLLECTOR_APP%==.MarkSweep ( rem ) else if .%COLLECTOR_APP%==.Concurrent ( rem Currently broken - see internal bug 60 rem rem set TITLE=%TITLE% Pcc echo.COLLECTOR_APP value "%COLLECTOR_APP%" is not currently available. %_EXIT_CMD% 1 ) else if .%COLLECTOR_APP%==.Semispace ( rem Currently broken - see internal bug 63 rem rem set TITLE=%TITLE% Pss echo.COLLECTOR_APP value "%COLLECTOR_APP%" is not currently available. %_EXIT_CMD% 1 ) else if .%COLLECTOR_APP%==.Null ( rem set TITLE=%TITLE% Pnl ) else ( if .%NO_SINGULARITY_DEFAULTS%==.Yes ( echo.Missing or invalid COLLECTOR_APP value: "%COLLECTOR_APP%" %_EXIT_CMD% 1 ) set COLLECTOR_APP=MarkSweep ) if .%SCHEDULER%==.Min ( rem ) else if .%SCHEDULER%==.Affinity ( rem ) else ( if .%NO_SINGULARITY_DEFAULTS%==.Yes ( echo.Missing or invalid SCHEDULER value: "%SCHEDULER%" %_EXIT_CMD% 1 ) set SCHEDULER=Min ) set TITLE=%TITLE% %SCHEDULER% if .%PAGING%==.On ( rem Currently broken - see internal bug 75 rem set PAGING_FLAG=.Paging rem set TITLE=%TITLE% Paging echo.PAGING value "%PAGING%" is not currently available. %_EXIT_CMD% 1 ) else if .%PAGING%==.Off ( set PAGING_FLAG= ) else ( rem Currently only one option - see internal bug 75 rem if .%NO_SINGULARITY_DEFAULTS%==.Yes ( rem echo.Missing or invalid PAGING value: "%PAGING%" rem %_EXIT_CMD% 1 rem ) set PAGING=Off set PAGING_FLAG= ) if not defined CODE_GENERATOR_BUILD set CODE_GENERATOR_BUILD=%DEFAULT_CODE_GENERATOR_BUILD% if not defined CODE_GENERATOR_RUNTIME set CODE_GENERATOR_RUNTIME=%DEFAULT_CODE_GENERATOR_RUNTIME% if .%CODE_GENERATOR%==.BARTOK ( rem ) else if .%CODE_GENERATOR%==.PHXBRIDGE ( rem Currently broken - see internal bug 65 rem echo.CODE_GENERATOR value "%CODE_GENERATOR%" is not currently available. %_EXIT_CMD% 1 ) else ( rem if .%NO_SINGULARITY_DEFAULTS%==.Yes ( rem echo.Missing or invalid 'CODE_GENERATOR' value: "%CODE_GENERATOR" rem %_EXIT_CMD% 1 rem ) set CODE_GENERATOR=BARTOK ) if .%CODE_GENERATOR_BUILD%==.DEBUG ( rem ) else if .%CODE_GENERATOR_BUILD%==.TEST ( rem ) else if .%CODE_GENERATOR_BUILD%==.RELEASE ( rem ) else ( rem if .%NO_SINGULARITY_DEFAULTS%==.Yes ( rem echo.Missing or invalid CODE_GENERATOR_BUILD value: "%CODE_GENERATOR_BUILD" rem %_EXIT_CMD% 1 rem ) if .%CODE_GENERATOR%==.BARTOK ( set CODE_GENERATOR_BUILD=DEBUG ) else if .%CODE_GENERATOR%==.PHXBRIDGE ( set CODE_GENERATOR_BUILD=RELEASE ) ) if .%CODE_GENERATOR_RUNTIME%==.CLR ( rem ) else if .%CODE_GENERATOR_RUNTIME%==.SELFHOST1 ( rem ) else ( rem if .%NO_SINGULARITY_DEFAULTS%==.Yes ( rem echo.Missing or invalid CODE_GENERATOR_RUNTIME value: "%CODE_GENERATOR_RUNTIME%" rem %_EXIT_CMD% 1 rem ) if .%CODE_GENERATOR%==.BARTOK ( set CODE_GENERATOR_RUNTIME=CLR ) else if .%CODE_GENERATOR%==.PHXBRIDGE ( if .%CODE_GENERATOR_BUILD%==.RELEASE ( set CODE_GENERATOR_RUNTIME=SELFHOST1 ) else if .%CODE_GENERATOR_BUILD%==.TEST ( set CODE_GENERATOR_RUNTIME=CLR ) else if .%CODE_GENERATOR_BUILD%==.DEBUG ( set CODE_GENERATOR_RUNTIME=CLR ) ) ) if not exist "%SINGULARITY_ROOT%\build\x86_%PROCESSOR%\%CODE_GENERATOR%\%CODE_GENERATOR_BUILD%\%CODE_GENERATOR_RUNTIME%\bartok.exe" ( echo.Requested compiler does not exist: echo "%SINGULARITY_ROOT%\build\x86_%PROCESSOR%\%CODE_GENERATOR%\%CODE_GENERATOR_BUILD%\%CODE_GENERATOR_RUNTIME%\bartok.exe" %_EXIT_CMD% 1 ) rem Tread with fear -- the CMD "rules" for escaping characters would rem make Cthulhu cry. Notably, how escape characters are interpreted rem varies, depending on whether or not you are within a ( ) context. rem Note: We set several variables in Ide.targets, but notably we omit rem Configuration and Platform. This is because the VS IDE allows rem you to select these values. For the others (GC), there is no way rem to do this in the IDE. if "%_create_vs_targets%" == "On" ( rem Temporarily disable delayed expansion so that the exclamation rem points (!'s) are not interpretted as variables setlocal DISABLEDELAYEDEXPANSION echo Creating %SINGULARITY_ROOT%\Targets\Ide.targets ( echo ^ echo ^