diff --git a/coin/provisioning/common/windows/helpers.ps1 b/coin/provisioning/common/windows/helpers.ps1 index 982c5ee9..35583b3b 100644 --- a/coin/provisioning/common/windows/helpers.ps1 +++ b/coin/provisioning/common/windows/helpers.ps1 @@ -382,3 +382,22 @@ function Invoke-MtCommand { & $Env:SystemRoot\system32\cmd.exe /c $cmdLine | Write-Output Remove-Item $tempFile } + +function Invoke-NMake { + param([string[]]$NmakeArgs) + # Temporarily remove MAKE flags for NMAKE process + $old = @{ + MAKEFLAGS = (Get-Item Env:MAKEFLAGS -ErrorAction Ignore).Value + MFLAGS = (Get-Item Env:MFLAGS -ErrorAction Ignore).Value + MAKE = (Get-Item Env:MAKE -ErrorAction Ignore).Value + NMAKEFLAGS = (Get-Item Env:NMAKEFLAGS -ErrorAction Ignore).Value + } + foreach ($n in $old.Keys) {Remove-Item "Env:$n" -ErrorAction SilentlyContinue} + try {& nmake @NmakeArgs} + finally { + foreach ($n in $old.Keys) { + if ($old[$n]) {Set-EnvironmentVariable -Key "$n" -Value $old[$n]} + else {Remove-Item "Env:$n" -ErrorAction SilentlyContinue} + } + } +} diff --git a/coin/provisioning/common/windows/zlib.ps1 b/coin/provisioning/common/windows/zlib.ps1 index f725f8f6..87c59690 100644 --- a/coin/provisioning/common/windows/zlib.ps1 +++ b/coin/provisioning/common/windows/zlib.ps1 @@ -42,8 +42,7 @@ function BuildZlib { ) PrepareBuildEnvironment -HostArchitecture $HostArchitecture -TargetArchitecture $TargetArchitecture - - nmake /f $MAKEFILE + Invoke-NMake -NmakeArgs @('/f', "$MAKEFILE") } function CopySource {