@exit 1
x86-32:
- nmake PLATFORM=x86-32 /f Nmakefile all
+ nmake /nologo PLATFORM=x86-32 /f Nmakefile all
x86-64:
- nmake PLATFORM=x86-64 /f Nmakefile all
+ nmake /nologo PLATFORM=x86-64 /f Nmakefile all
clean:
del vm\*.obj
- del factor.lib
- del factor.com
- del factor.exe
- del factor.dll
- del factor.dll.lib
+ if exist factor.lib del factor.lib
+ if exist factor.com del factor.com
+ if exist factor.exe del factor.exe
+ if exist factor.dll del factor.dll
+ if exist factor.dll.lib del factor.dll.lib
-bootimage-x86-32:
- cscript /nologo build-support\http-get.vbs http://factorcode.org/images/$(BOOTIMAGE_VERSION)/boot.winnt-x86.32.image boot.winnt-x86.32.image
-
-bootimage-x86-64:
- cscript /nologo build-support\http-get.vbs http://factorcode.org/images/$(BOOTIMAGE_VERSION)/boot.winnt-x86.64.image boot.winnt.x86.64.image
-
-.PHONY: all bootimage-x86-32 bootimage-x86-64 default x86-32 x86-64 clean
+.PHONY: all default x86-32 x86-64 clean
.SUFFIXES: .rs
--- /dev/null
+@echo off\r
+if not exist Nmakefile goto wrong_dir\r
+\r
+if /i %PROCESSOR_ARCHITECTURE%==AMD64 (\r
+ set _target="x86-64"\r
+ set _bootimage="boot.winnt-x86.64.image"\r
+) else (\r
+ set _target="x86-32"\r
+ set _bootimage="boot.winnt-x86.32.image"\r
+)\r
+\r
+if "%1"=="/?" goto usage\r
+\r
+if "%1"=="" (\r
+ set _bootimage_version="latest"\r
+ set _git_branch=master\r
+)\r
+if "%1"=="latest" (\r
+ set _bootimage_version="latest"\r
+ set _git_branch=master\r
+)\r
+if "%1"=="clean" (\r
+ set _bootimage_version="clean"\r
+ set _git_branch=clean-winnt-%_target%\r
+)\r
+\r
+if not defined _bootimage_version goto usage\r
+\r
+echo Updating working copy...\r
+cmd /c "git pull http://factorcode.org/git/factor.git %_git_branch%"\r
+if not errorlevel 0 goto fail\r
+\r
+echo Building vm...\r
+nmake /nologo /f Nmakefile clean\r
+if not errorlevel 0 goto fail\r
+nmake /nologo /f Nmakefile %_target%\r
+if not errorlevel 0 goto fail\r
+\r
+echo Fetching %_bootimage_version% boot image...\r
+cscript /nologo build-support\http-get.vbs http://factorcode.org/images/%_bootimage_version%/%_bootimage% %_bootimage%\r
+if not errorlevel 0 goto fail\r
+\r
+echo Bootstrapping...\r
+.\factor.com -i=%_bootimage%\r
+if not errorlevel 0 goto fail\r
+\r
+echo Build complete.\r
+goto cleanup\r
+\r
+:fail\r
+echo Build failed.\r
+goto cleanup\r
+\r
+:wrong_dir\r
+echo build-support\factor.cmd must be run from the root of the Factor source tree.\r
+goto cleanup\r
+\r
+:usage\r
+echo Usage: build-support\factor.cmd [latest/clean]\r
+echo Updates the working copy, cleans and builds the vm using nmake,\r
+echo fetches a boot image, and bootstraps factor.\r
+echo If latest is specified, then the working copy is updated to the\r
+echo upstream "master" branch and the boot image corresponding to the\r
+echo most recent factor build is downloaded. This is the default.\r
+echo If clean is specified, then the working copy is updated to the\r
+echo upstream "clean-winnt-*" branch corresponding to the current\r
+echo platform and the corresponding boot image is downloaded.\r
+goto cleanup\r
+\r
+:cleanup\r
+set _target=\r
+set _bootimage=\r
+set _bootimage_version=\r
+set _git_branch=\r