param([string]$Toolchain = $env:AMIGA_TOOLCHAIN) $ErrorActionPreference = 'Stop' if (!$Toolchain) { throw 'Specificare -Toolchain con la cartella che contiene bin e targets/m68k-amigaos.' } $Toolchain = (Resolve-Path -LiteralPath $Toolchain).Path $targetPath = Join-Path $Toolchain 'targets/m68k-amigaos' $buildPath = Join-Path $PSScriptRoot 'build' $configPath = Join-Path $buildPath 'vbcc' New-Item -ItemType Directory -Path (Join-Path $configPath 'config') -Force | Out-Null $config = [IO.File]::ReadAllText((Join-Path $PSScriptRoot 'vbcc-config.in')).Replace('@TARGET@', $targetPath.Replace('\','/')) [IO.File]::WriteAllText((Join-Path $configPath 'config/boing'), $config) $previousVBCC = $env:VBCC $previousPath = $env:PATH try { $env:VBCC = $configPath $env:PATH = (Join-Path $Toolchain 'bin') + ';' + $env:PATH Push-Location -LiteralPath $PSScriptRoot try { & (Join-Path $Toolchain 'bin/vc.exe') +boing -O2 -c99 -o build/AmigaSession session.c if ($LASTEXITCODE -ne 0) { throw 'Compilazione fallita.' } } finally { Pop-Location } } finally { $env:VBCC = $previousVBCC $env:PATH = $previousPath } Write-Output ('Pronto per Amiga: ' + $buildPath)