42 lines
1.8 KiB
PowerShell
42 lines
1.8 KiB
PowerShell
param([string]$MasmRoot = '')
|
|
$ErrorActionPreference = 'Stop'
|
|
$root = (Resolve-Path (Join-Path $PSScriptRoot '..\..')).Path
|
|
Push-Location $root
|
|
try {
|
|
$masmCandidates = @(
|
|
$MasmRoot,
|
|
'D:\MASM32\masm32',
|
|
'C:\masm32',
|
|
'F:\MASM32\masm32'
|
|
) | Where-Object { -not [string]::IsNullOrWhiteSpace($_) }
|
|
|
|
$foundMasm = $null
|
|
foreach ($cand in $masmCandidates) {
|
|
try {
|
|
$drive = [System.IO.Path]::GetPathRoot($cand).TrimEnd('\', '/')
|
|
if ($drive -and -not (Test-Path -LiteralPath $drive)) { continue }
|
|
$ml = Join-Path $cand 'bin\ml.exe'
|
|
if (Test-Path -LiteralPath $ml) {
|
|
$foundMasm = $cand
|
|
break
|
|
}
|
|
} catch {}
|
|
}
|
|
|
|
if ($foundMasm) {
|
|
& "$foundMasm\bin\ml.exe" /c /coff /Cp /nologo /I. /Fobuild\graphics\poker.obj poker.asm
|
|
if ($LASTEXITCODE -ne 0) { throw 'MASM assembly failed' }
|
|
if (Test-Path -LiteralPath 'build\casino_icon.res') {
|
|
& "$foundMasm\bin\link.exe" /nologo /SUBSYSTEM:WINDOWS /RELEASE /VERSION:5.0 "/LIBPATH:$foundMasm\lib" /OUT:build\graphics\poker.exe build\graphics\poker.obj build\casino_icon.res kernel32.lib winmm.lib user32.lib ws2_32.lib gdi32.lib
|
|
} else {
|
|
& "$foundMasm\bin\link.exe" /nologo /SUBSYSTEM:WINDOWS /RELEASE /VERSION:5.0 "/LIBPATH:$foundMasm\lib" /OUT:build\graphics\poker.exe build\graphics\poker.obj kernel32.lib winmm.lib user32.lib ws2_32.lib gdi32.lib
|
|
}
|
|
if ($LASTEXITCODE -ne 0) { throw 'Link failed' }
|
|
} else {
|
|
& cmd.exe /c build.bat
|
|
if ($LASTEXITCODE -ne 0) { throw 'Build via build.bat failed' }
|
|
}
|
|
Write-Output 'Built build\graphics\poker.exe. Publish only after verification.'
|
|
} finally {
|
|
Pop-Location
|
|
}
|