diff options
Diffstat (limited to 'dist/mcode/windows/compile-libraries.ps1')
-rw-r--r-- | dist/mcode/windows/compile-libraries.ps1 | 253 |
1 files changed, 135 insertions, 118 deletions
diff --git a/dist/mcode/windows/compile-libraries.ps1 b/dist/mcode/windows/compile-libraries.ps1 index dc7cbb57e..01ab7712b 100644 --- a/dist/mcode/windows/compile-libraries.ps1 +++ b/dist/mcode/windows/compile-libraries.ps1 @@ -39,12 +39,14 @@ # .SYNOPSIS # GHDL for Windows - Library compile script -# Use 'complib.ps1 -Help' to see the integrated help page +# Use 'compile-libraries.ps1 -Help' to see the integrated help page # # .EXAMPLE -# C:\PS> .\complib.ps1 -Verbose -Compile +# C:\PS> .\complib.ps1 -Clean # .EXAMPLE -# C:\PS> .\complib.ps1 -Verbose -Clean +# C:\PS> .\complib.ps1 -Compile -Verbose +# .EXAMPLE +# C:\PS> .\complib.ps1 -VHDL2008 -SuppressWarnings # [CmdletBinding()] param( @@ -70,29 +72,41 @@ param( [switch]$HaltOnError = $false, # Set GHDL executable - [string]$GHDL = "" + [string]$GHDL = "", + # Undocumented + [switch]$Hosted = $false ) # configure script here -$Script_RelPathToRoot = "..\..\.." +$RelPathToRoot = "..\..\.." # --------------------------------------------- # save parameters and working directory -$Script_Parameters = $args $Script_ScriptDir = $PSScriptRoot $Script_WorkingDir = Get-Location -$GHDLRootDir = Convert-Path (Resolve-Path ($PSScriptRoot + "\" + $Script_RelPathToRoot)) +$GHDLRootDir = Convert-Path (Resolve-Path ($PSScriptRoot + "\" + $RelPathToRoot)) # set default values -$EnableVerbose = $PSCmdlet.MyInvocation.BoundParameters["Verbose"].IsPresent -$EnableDebug = $PSCmdlet.MyInvocation.BoundParameters["Debug"].IsPresent +$EnableVerbose = $PSCmdlet.MyInvocation.BoundParameters["Verbose"].IsPresent +$EnableDebug = $PSCmdlet.MyInvocation.BoundParameters["Debug"].IsPresent # load modules from GHDL's 'libraries' directory -Import-Module $PSScriptRoot\shared.psm1 -ArgumentList "$Script_WorkingDir" +Import-Module $PSScriptRoot\shared.psm1 -Verbose:$false -ArgumentList "$Script_WorkingDir" # Display help if no command was selected $Help = $Help -or (-not ($Compile -or $VHDL87 -or $VHDL93 -or $VHDL2008 -or $Clean)) +function Exit-CompileScript +{ [CmdletBinding()] + param( + [int]$ExitCode = 0 + ) + cd $Script_WorkingDir + # unload modules + Remove-Module shared -Verbose:$false + exit $ExitCode +} + if ($Help) { Get-Help $MYINVOCATION.InvocationName -Detailed Exit-CompileScript @@ -115,22 +129,6 @@ $VHDLDestinationLibraryDirectory = "$GHDLRootDir\$BuildDirectoryName\$Backend\$V # construct executables $GHDLNewExecutable = "$GHDLRootDir\$BuildDirectoryName\$Backend\bin\ghdl.exe" -# get GHDL executable -if ($GHDL -ne "") -{ $GHDLExecutable = $GHDL } -elseif (Test-Path env:GHDL) -{ $GHDLExecutable = $env:GHDL } -elseif (Test-Path $GHDLNewExecutable -PathType Leaf) -{ $GHDLExecutable = $GHDLNewExecutable } -else -{ $GHDLExecutable = "ghdl.exe" } - -if (-not (Test-Path $GHDLExecutable -PathType Leaf)) -{ Write-Host "GHDL executable 'ghdl.exe' not found." -ForegroundColor Red - Write-Host "Use adv. options '-GHDL' to set the GHDL executable." -ForegroundColor Yellow - Exit-CompileScript -1 -} - # Library sources $SourceFiles = @{ @@ -190,17 +188,40 @@ $SourceFiles = @{ ) } -Write-Host "================================================================================" -ForegroundColor Yellow -Write-Host "GHDL ($Backend) for Windows - Library compile script" -ForegroundColor Yellow -Write-Host "================================================================================" -ForegroundColor Yellow +if (-not $Hosted) +{ Write-Host "================================================================================" -ForegroundColor Yellow + Write-Host "GHDL ($Backend) for Windows - Library compile script" -ForegroundColor Yellow + Write-Host "================================================================================" -ForegroundColor Yellow +} if ($Clean) { Write-Host "Removing all created files and directories..." - Write-Host " rmdir $VHDLDestinationLibraryDirectory" - - Remove-Item $VHDLDestinationLibraryDirectory -Force -Recurse -ErrorAction SilentlyContinue + if (Test-Path -Path $VHDLDestinationLibraryDirectory) + { Write-Host " rmdir $VHDLDestinationLibraryDirectory" + Remove-Item $VHDLDestinationLibraryDirectory -Force -Recurse -ErrorAction SilentlyContinue + if ($? -eq $false) + { Write-Host "[ERROR]: Cannot remove '$VHDLDestinationLibraryDirectory'." -ForegroundColor Red + Exit-CompileScript -1 + } + } + if (-not ($VHDL87 -or $VHDL93 -or $VHDL2008)) + { Exit-CompileScript } +} + +# get GHDL executable +if ($GHDL -ne "") +{ $GHDLExecutable = $GHDL } +elseif (Test-Path env:GHDL) +{ $GHDLExecutable = $env:GHDL } +elseif (Test-Path $GHDLNewExecutable -PathType Leaf) +{ $GHDLExecutable = $GHDLNewExecutable } +else +{ $GHDLExecutable = "ghdl.exe" } - Exit-CompileScript +if (-not (Test-Path $GHDLExecutable -PathType Leaf)) +{ Write-Host "GHDL executable 'ghdl.exe' not found." -ForegroundColor Red + Write-Host "Use adv. options '-GHDL' to set the GHDL executable." -ForegroundColor Yellow + Exit-CompileScript -1 } @@ -223,7 +244,7 @@ if ($VHDL87 -or $VHDL93 -or $VHDL2008) else { Write-Host " Creating directory '$VHDLDestinationLibraryDirectory'." New-Item -ItemType Directory -Path $VHDLDestinationLibraryDirectory -ErrorAction SilentlyContinue | Out-Null - if ($LastExitCode -ne 0) + if (-not $?) { Write-Host "[ERROR]: Cannot create destination directory '$VHDLDestinationLibraryDirectory'." -ForegroundColor Red Exit-CompileScript -1 } @@ -236,10 +257,6 @@ if ($VHDL87 -or $VHDL93 -or $VHDL2008) Write-Host Write-Host "Start compilation..." } - - - - # ============================================================================ # v87 # ============================================================================ @@ -261,7 +278,7 @@ if ($VHDL87) $VHDLSourcesIndex = "std" foreach ($SourceFile in $SourceFiles[$VHDLSourcesIndex]) { Write-Host " file: v$VHDLVersion\$SourceFile.v$VHDLVersion" - $EnableVerbose -and (Write-Host " Patching file for $VHDLVersion" ) | Out-Null + $EnableVerbose -and (Write-Host " Patching file for $VHDLVersion" ) | Out-Null # Patch file Get-Content "$VHDLSourceLibraryDirectory\$VHDLSourcesIndex\$SourceFile.vhdl" -Encoding Ascii ` | Format-VHDLSourceFile -Version "$VHDLVersion" ` @@ -269,10 +286,10 @@ if ($VHDL87) # Analyze file $InvokeExpr = "$GHDLExecutable -a -C --bootstrap --std=$VHDLVersion --work=$VHDLLibrary $SourceFile.v$VHDLVersion 2>&1" - $EnableVerbose -and (Write-Host " Analyzing file '$SourceFile.v$VHDLVersion'" ) | Out-Null - $EnableDebug -and (Write-Host " $InvokeExpr" ) | Out-Null + $EnableVerbose -and (Write-Host " Analyzing file '$SourceFile.v$VHDLVersion'" ) | Out-Null + $EnableDebug -and (Write-Host " $InvokeExpr" -ForegroundColor DarkGray ) | Out-Null $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings " " - if ($LastExitCode -ne 0) + if (($LastExitCode -ne 0) -or -not $?) { $ErrorCount += 1 if ($HaltOnError) { Exit-CompileScript -1 } @@ -293,7 +310,7 @@ if ($VHDL87) $VHDLSourcesIndex = "ieee" foreach ($SourceFile in $SourceFiles[$VHDLSourcesIndex]) { Write-Host " file: v$VHDLVersion\$SourceFile.v$VHDLVersion" - $EnableVerbose -and (Write-Host " Patching file for $VHDLVersion" ) | Out-Null + $EnableVerbose -and (Write-Host " Patching file for $VHDLVersion" ) | Out-Null # Patch file Get-Content "$VHDLSourceLibraryDirectory\$VHDLSourcesIndex\$SourceFile.vhdl" -Encoding Ascii ` | Format-VHDLSourceFile -Version "$VHDLVersion" ` @@ -301,10 +318,10 @@ if ($VHDL87) # Analyze file $InvokeExpr = "$GHDLExecutable -a -C `"-P../std`" --std=$VHDLVersion --work=$VHDLLibrary $SourceFile.v$VHDLVersion 2>&1" - $EnableVerbose -and (Write-Host " Analyzing file '$SourceFile.v$VHDLVersion'" ) | Out-Null - $EnableDebug -and (Write-Host " $InvokeExpr" ) | Out-Null + $EnableVerbose -and (Write-Host " Analyzing file '$SourceFile.v$VHDLVersion'" ) | Out-Null + $EnableDebug -and (Write-Host " $InvokeExpr" -ForegroundColor DarkGray ) | Out-Null $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings " " - if ($LastExitCode -ne 0) + if (($LastExitCode -ne 0) -or -not $?) { $ErrorCount += 1 if ($HaltOnError) { Exit-CompileScript -1 } @@ -325,7 +342,7 @@ if ($VHDL87) $VHDLSourcesIndex = "ieee" foreach ($SourceFile in $SourceFiles[$VHDLSourcesIndex]) { Write-Host " file: v$VHDLVersion\$SourceFile.v$VHDLVersion" - $EnableVerbose -and (Write-Host " Patching file for $VHDLVersion" ) | Out-Null + $EnableVerbose -and (Write-Host " Patching file for $VHDLVersion" ) | Out-Null # Patch file Get-Content "$VHDLSourceLibraryDirectory\$VHDLSourcesIndex\$SourceFile.vhdl" -Encoding Ascii ` | Format-VHDLSourceFile -Version "$VHDLVersion" ` @@ -333,10 +350,10 @@ if ($VHDL87) # Analyze file $InvokeExpr = "$GHDLExecutable -a -C `"-P../std`" --std=$VHDLVersion --work=$VHDLLibrary $SourceFile.v$VHDLVersion 2>&1" - $EnableVerbose -and (Write-Host " Analyzing file '$SourceFile.v$VHDLVersion'" ) | Out-Null - $EnableDebug -and (Write-Host " $InvokeExpr" ) | Out-Null + $EnableVerbose -and (Write-Host " Analyzing file '$SourceFile.v$VHDLVersion'" ) | Out-Null + $EnableDebug -and (Write-Host " $InvokeExpr" -ForegroundColor DarkGray ) | Out-Null $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings " " - if ($LastExitCode -ne 0) + if (($LastExitCode -ne 0) -or -not $?) { $ErrorCount += 1 if ($HaltOnError) { Exit-CompileScript -1 } @@ -345,7 +362,7 @@ if ($VHDL87) foreach ($SourceFile in $SourceFiles["synopsys"] + $SourceFiles["synopsys8793"]) { Write-Host " file: v$VHDLVersion\$SourceFile.v$VHDLVersion" - $EnableVerbose -and (Write-Host " Patching file for $VHDLVersion" ) | Out-Null + $EnableVerbose -and (Write-Host " Patching file for $VHDLVersion" ) | Out-Null # Patch file Get-Content "$VHDLSourceLibraryDirectory\$VHDLFlavor\$SourceFile.vhdl" -Encoding Ascii ` | Format-VHDLSourceFile -Version "$VHDLVersion" ` @@ -353,10 +370,10 @@ if ($VHDL87) # Analyze file $InvokeExpr = "$GHDLExecutable -a -C `"-P../std`" --std=$VHDLVersion --work=$VHDLLibrary $SourceFile.v$VHDLVersion 2>&1" - $EnableVerbose -and (Write-Host " Analyzing file '$SourceFile.v$VHDLVersion'" ) | Out-Null - $EnableDebug -and (Write-Host " $InvokeExpr" ) | Out-Null + $EnableVerbose -and (Write-Host " Analyzing file '$SourceFile.v$VHDLVersion'" ) | Out-Null + $EnableDebug -and (Write-Host " $InvokeExpr" -ForegroundColor DarkGray ) | Out-Null $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings " " - if ($LastExitCode -ne 0) + if (($LastExitCode -ne 0) -or -not $?) { $ErrorCount += 1 if ($HaltOnError) { Exit-CompileScript -1 } @@ -366,7 +383,7 @@ if ($VHDL87) $VHDLSourcesIndex = "vital95" foreach ($SourceFile in $SourceFiles[$VHDLSourcesIndex]) { Write-Host " file: v$VHDLVersion\$SourceFile.v$VHDLVersion" - $EnableVerbose -and (Write-Host " Patching file for $VHDLVersion" ) | Out-Null + $EnableVerbose -and (Write-Host " Patching file for $VHDLVersion" ) | Out-Null # Patch file Get-Content "$VHDLSourceLibraryDirectory\$VHDLSourcesIndex\$SourceFile.vhdl" -Encoding Ascii ` | Format-VHDLSourceFile -Version "$VHDLVersion" ` @@ -374,10 +391,10 @@ if ($VHDL87) # Analyze file $InvokeExpr = "$GHDLExecutable -a -C `"-P../std`" --std=$VHDLVersion --work=$VHDLLibrary $SourceFile.v$VHDLVersion 2>&1" - $EnableVerbose -and (Write-Host " Analyzing file '$SourceFile.v$VHDLVersion'" ) | Out-Null - $EnableDebug -and (Write-Host " $InvokeExpr" ) | Out-Null + $EnableVerbose -and (Write-Host " Analyzing file '$SourceFile.v$VHDLVersion'" ) | Out-Null + $EnableDebug -and (Write-Host " $InvokeExpr" -ForegroundColor DarkGray ) | Out-Null $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings " " - if ($LastExitCode -ne 0) + if (($LastExitCode -ne 0) -or -not $?) { $ErrorCount += 1 if ($HaltOnError) { Exit-CompileScript -1 } @@ -405,7 +422,7 @@ if ($VHDL93) $VHDLSourcesIndex = "std" foreach ($SourceFile in $SourceFiles[$VHDLSourcesIndex]) { Write-Host " file: v$VHDLVersion\$SourceFile.v$VHDLVersion" - $EnableVerbose -and (Write-Host " Patching file for $VHDLVersion" ) | Out-Null + $EnableVerbose -and (Write-Host " Patching file for $VHDLVersion" ) | Out-Null # Patch file Get-Content "$VHDLSourceLibraryDirectory\$VHDLSourcesIndex\$SourceFile.vhdl" -Encoding Ascii ` | Format-VHDLSourceFile -Version "$VHDLVersion" ` @@ -413,10 +430,10 @@ if ($VHDL93) # Analyze file $InvokeExpr = "$GHDLExecutable -a -C --bootstrap --std=$VHDLVersion --work=$VHDLLibrary $SourceFile.v$VHDLVersion 2>&1" - $EnableVerbose -and (Write-Host " Analyzing file '$SourceFile.v$VHDLVersion'" ) | Out-Null - $EnableDebug -and (Write-Host " $InvokeExpr" ) | Out-Null + $EnableVerbose -and (Write-Host " Analyzing file '$SourceFile.v$VHDLVersion'" ) | Out-Null + $EnableDebug -and (Write-Host " $InvokeExpr" -ForegroundColor DarkGray ) | Out-Null $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings " " - if ($LastExitCode -ne 0) + if (($LastExitCode -ne 0) -or -not $?) { $ErrorCount += 1 if ($HaltOnError) { Exit-CompileScript -1 } @@ -437,7 +454,7 @@ if ($VHDL93) $VHDLSourcesIndex = "ieee" foreach ($SourceFile in $SourceFiles[$VHDLSourcesIndex] + $SourceFiles["math"]) { Write-Host " file: v$VHDLVersion\$SourceFile.v$VHDLVersion" - $EnableVerbose -and (Write-Host " Patching file for $VHDLVersion" ) | Out-Null + $EnableVerbose -and (Write-Host " Patching file for $VHDLVersion" ) | Out-Null # Patch file Get-Content "$VHDLSourceLibraryDirectory\$VHDLSourcesIndex\$SourceFile.vhdl" -Encoding Ascii ` | Format-VHDLSourceFile -Version "$VHDLVersion" ` @@ -445,10 +462,10 @@ if ($VHDL93) # Analyze file $InvokeExpr = "$GHDLExecutable -a -C `"-P../std`" --std=$VHDLVersion --work=$VHDLLibrary $SourceFile.v$VHDLVersion 2>&1" - $EnableVerbose -and (Write-Host " Analyzing file '$SourceFile.v$VHDLVersion'" ) | Out-Null - $EnableDebug -and (Write-Host " $InvokeExpr" ) | Out-Null + $EnableVerbose -and (Write-Host " Analyzing file '$SourceFile.v$VHDLVersion'" ) | Out-Null + $EnableDebug -and (Write-Host " $InvokeExpr" -ForegroundColor DarkGray ) | Out-Null $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings " " - if ($LastExitCode -ne 0) + if (($LastExitCode -ne 0) -or -not $?) { $ErrorCount += 1 if ($HaltOnError) { Exit-CompileScript -1 } @@ -458,7 +475,7 @@ if ($VHDL93) $VHDLSourcesIndex = "vital2000" foreach ($SourceFile in $SourceFiles[$VHDLSourcesIndex]) { Write-Host " file: v$VHDLVersion\$SourceFile.v$VHDLVersion" - $EnableVerbose -and (Write-Host " Patching file for $VHDLVersion" ) | Out-Null + $EnableVerbose -and (Write-Host " Patching file for $VHDLVersion" ) | Out-Null # Patch file Get-Content "$VHDLSourceLibraryDirectory\$VHDLSourcesIndex\$SourceFile.vhdl" -Encoding Ascii ` | Format-VHDLSourceFile -Version "$VHDLVersion" ` @@ -466,10 +483,10 @@ if ($VHDL93) # Analyze file $InvokeExpr = "$GHDLExecutable -a -C `"-P../std`" --std=$VHDLVersion --work=$VHDLLibrary $SourceFile.v$VHDLVersion 2>&1" - $EnableVerbose -and (Write-Host " Analyzing file '$SourceFile.v$VHDLVersion'" ) | Out-Null - $EnableDebug -and (Write-Host " $InvokeExpr" ) | Out-Null + $EnableVerbose -and (Write-Host " Analyzing file '$SourceFile.v$VHDLVersion'" ) | Out-Null + $EnableDebug -and (Write-Host " $InvokeExpr" -ForegroundColor DarkGray ) | Out-Null $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings " " - if ($LastExitCode -ne 0) + if (($LastExitCode -ne 0) -or -not $?) { $ErrorCount += 1 if ($HaltOnError) { Exit-CompileScript -1 } @@ -490,7 +507,7 @@ if ($VHDL93) $VHDLSourcesIndex = "ieee" foreach ($SourceFile in $SourceFiles[$VHDLSourcesIndex] + $SourceFiles["math"]) { Write-Host " file: v$VHDLVersion\$SourceFile.v$VHDLVersion" - $EnableVerbose -and (Write-Host " Patching file for $VHDLVersion" ) | Out-Null + $EnableVerbose -and (Write-Host " Patching file for $VHDLVersion" ) | Out-Null # Patch file Get-Content "$VHDLSourceLibraryDirectory\$VHDLSourcesIndex\$SourceFile.vhdl" -Encoding Ascii ` | Format-VHDLSourceFile -Version "$VHDLVersion" ` @@ -498,10 +515,10 @@ if ($VHDL93) # Analyze file $InvokeExpr = "$GHDLExecutable -a -C `"-P../std`" --std=$VHDLVersion --work=$VHDLLibrary $SourceFile.v$VHDLVersion 2>&1" - $EnableVerbose -and (Write-Host " Analyzing file '$SourceFile.v$VHDLVersion'" ) | Out-Null - $EnableDebug -and (Write-Host " $InvokeExpr" ) | Out-Null + $EnableVerbose -and (Write-Host " Analyzing file '$SourceFile.v$VHDLVersion'" ) | Out-Null + $EnableDebug -and (Write-Host " $InvokeExpr" -ForegroundColor DarkGray ) | Out-Null $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings " " - if ($LastExitCode -ne 0) + if (($LastExitCode -ne 0) -or -not $?) { $ErrorCount += 1 if ($HaltOnError) { Exit-CompileScript -1 } @@ -510,7 +527,7 @@ if ($VHDL93) foreach ($SourceFile in $SourceFiles[$VHDLFlavor] + $SourceFiles["synopsys8793"]) { Write-Host " file: v$VHDLVersion\$SourceFile.v$VHDLVersion" - $EnableVerbose -and (Write-Host " Patching file for $VHDLVersion" ) | Out-Null + $EnableVerbose -and (Write-Host " Patching file for $VHDLVersion" ) | Out-Null # Patch file Get-Content "$VHDLSourceLibraryDirectory\$VHDLFlavor\$SourceFile.vhdl" -Encoding Ascii ` | Format-VHDLSourceFile -Version "$VHDLVersion" ` @@ -518,10 +535,10 @@ if ($VHDL93) # Analyze file $InvokeExpr = "$GHDLExecutable -a -C `"-P../std`" --std=$VHDLVersion --work=$VHDLLibrary $SourceFile.v$VHDLVersion 2>&1" - $EnableVerbose -and (Write-Host " Analyzing file '$SourceFile.v$VHDLVersion'" ) | Out-Null - $EnableDebug -and (Write-Host " $InvokeExpr" ) | Out-Null + $EnableVerbose -and (Write-Host " Analyzing file '$SourceFile.v$VHDLVersion'" ) | Out-Null + $EnableDebug -and (Write-Host " $InvokeExpr" -ForegroundColor DarkGray ) | Out-Null $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings " " - if ($LastExitCode -ne 0) + if (($LastExitCode -ne 0) -or -not $?) { $ErrorCount += 1 if ($HaltOnError) { Exit-CompileScript -1 } @@ -531,7 +548,7 @@ if ($VHDL93) $VHDLSourcesIndex = "vital2000" foreach ($SourceFile in $SourceFiles[$VHDLSourcesIndex]) { Write-Host " file: v$VHDLVersion\$SourceFile.v$VHDLVersion" - $EnableVerbose -and (Write-Host " Patching file for $VHDLVersion" ) | Out-Null + $EnableVerbose -and (Write-Host " Patching file for $VHDLVersion" ) | Out-Null # Patch file Get-Content "$VHDLSourceLibraryDirectory\$VHDLSourcesIndex\$SourceFile.vhdl" -Encoding Ascii ` | Format-VHDLSourceFile -Version "$VHDLVersion" ` @@ -539,10 +556,10 @@ if ($VHDL93) # Analyze file $InvokeExpr = "$GHDLExecutable -a -C `"-P../std`" --std=$VHDLVersion --work=$VHDLLibrary $SourceFile.v$VHDLVersion 2>&1" - $EnableVerbose -and (Write-Host " Analyzing file '$SourceFile.v$VHDLVersion'" ) | Out-Null - $EnableDebug -and (Write-Host " $InvokeExpr" ) | Out-Null + $EnableVerbose -and (Write-Host " Analyzing file '$SourceFile.v$VHDLVersion'" ) | Out-Null + $EnableDebug -and (Write-Host " $InvokeExpr" -ForegroundColor DarkGray ) | Out-Null $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings " " - if ($LastExitCode -ne 0) + if (($LastExitCode -ne 0) -or -not $?) { $ErrorCount += 1 if ($HaltOnError) { Exit-CompileScript -1 } @@ -563,7 +580,7 @@ if ($VHDL93) $VHDLSourcesIndex = "ieee" foreach ($SourceFile in $SourceFiles[$VHDLSourcesIndex] + $SourceFiles["math"]) { Write-Host " file: v$VHDLVersion\$SourceFile.v$VHDLVersion" - $EnableVerbose -and (Write-Host " Patching file for $VHDLVersion" ) | Out-Null + $EnableVerbose -and (Write-Host " Patching file for $VHDLVersion" ) | Out-Null # Patch file Get-Content "$VHDLSourceLibraryDirectory\$VHDLSourcesIndex\$SourceFile.vhdl" -Encoding Ascii ` | Format-VHDLSourceFile -Version "$VHDLVersion" ` @@ -571,10 +588,10 @@ if ($VHDL93) # Analyze file $InvokeExpr = "$GHDLExecutable -a -C `"-P../std`" --std=$VHDLVersion --work=$VHDLLibrary $SourceFile.v$VHDLVersion 2>&1" - $EnableVerbose -and (Write-Host " Analyzing file '$SourceFile.v$VHDLVersion'" ) | Out-Null - $EnableDebug -and (Write-Host " $InvokeExpr" ) | Out-Null + $EnableVerbose -and (Write-Host " Analyzing file '$SourceFile.v$VHDLVersion'" ) | Out-Null + $EnableDebug -and (Write-Host " $InvokeExpr" -ForegroundColor DarkGray ) | Out-Null $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings " " - if ($LastExitCode -ne 0) + if (($LastExitCode -ne 0) -or -not $?) { $ErrorCount += 1 if ($HaltOnError) { Exit-CompileScript -1 } @@ -583,7 +600,7 @@ if ($VHDL93) foreach ($SourceFile in $SourceFiles[$VHDLFlavor]) { Write-Host " file: v$VHDLVersion\$SourceFile.v$VHDLVersion" - $EnableVerbose -and (Write-Host " Patching file for $VHDLVersion" ) | Out-Null + $EnableVerbose -and (Write-Host " Patching file for $VHDLVersion" ) | Out-Null # Patch file Get-Content "$VHDLSourceLibraryDirectory\$VHDLFlavor\$SourceFile.vhdl" -Encoding Ascii ` | Format-VHDLSourceFile -Version "$VHDLVersion" ` @@ -591,10 +608,10 @@ if ($VHDL93) # Analyze file $InvokeExpr = "$GHDLExecutable -a -C `"-P../std`" --std=$VHDLVersion --work=$VHDLLibrary $SourceFile.v$VHDLVersion 2>&1" - $EnableVerbose -and (Write-Host " Analyzing file '$SourceFile.v$VHDLVersion'" ) | Out-Null - $EnableDebug -and (Write-Host " $InvokeExpr" ) | Out-Null + $EnableVerbose -and (Write-Host " Analyzing file '$SourceFile.v$VHDLVersion'" ) | Out-Null + $EnableDebug -and (Write-Host " $InvokeExpr" -ForegroundColor DarkGray ) | Out-Null $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings " " - if ($LastExitCode -ne 0) + if (($LastExitCode -ne 0) -or -not $?) { $ErrorCount += 1 if ($HaltOnError) { Exit-CompileScript -1 } @@ -604,7 +621,7 @@ if ($VHDL93) $VHDLSourcesIndex = "vital2000" foreach ($SourceFile in $SourceFiles[$VHDLSourcesIndex]) { Write-Host " file: v$VHDLVersion\$SourceFile.v$VHDLVersion" - $EnableVerbose -and (Write-Host " Patching file for $VHDLVersion" ) | Out-Null + $EnableVerbose -and (Write-Host " Patching file for $VHDLVersion" ) | Out-Null # Patch file Get-Content "$VHDLSourceLibraryDirectory\$VHDLSourcesIndex\$SourceFile.vhdl" -Encoding Ascii ` | Format-VHDLSourceFile -Version "$VHDLVersion" ` @@ -612,10 +629,10 @@ if ($VHDL93) # Analyze file $InvokeExpr = "$GHDLExecutable -a -C `"-P../std`" --std=$VHDLVersion --work=$VHDLLibrary $SourceFile.v$VHDLVersion 2>&1" - $EnableVerbose -and (Write-Host " Analyzing file '$SourceFile.v$VHDLVersion'" ) | Out-Null - $EnableDebug -and (Write-Host " $InvokeExpr" ) | Out-Null + $EnableVerbose -and (Write-Host " Analyzing file '$SourceFile.v$VHDLVersion'" ) | Out-Null + $EnableDebug -and (Write-Host " $InvokeExpr" -ForegroundColor DarkGray ) | Out-Null $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings " " - if ($LastExitCode -ne 0) + if (($LastExitCode -ne 0) -or -not $?) { $ErrorCount += 1 if ($HaltOnError) { Exit-CompileScript -1 } @@ -643,7 +660,7 @@ if ($VHDL2008) $VHDLSourcesIndex = "std08" foreach ($SourceFile in $SourceFiles[$VHDLSourcesIndex]) { Write-Host " file: v$VHDLVersion\$SourceFile.v$VHDLVersion" - $EnableVerbose -and (Write-Host " Patching file for $VHDLVersion" ) | Out-Null + $EnableVerbose -and (Write-Host " Patching file for $VHDLVersion" ) | Out-Null # Patch file Get-Content "$VHDLSourceLibraryDirectory\$VHDLLibrary\$SourceFile.vhdl" -Encoding Ascii ` | Format-VHDLSourceFile -Version "$VHDLVersion" ` @@ -651,10 +668,10 @@ if ($VHDL2008) # Analyze file $InvokeExpr = "$GHDLExecutable -a -C --bootstrap --std=$VHDLVersion --work=$VHDLLibrary $SourceFile.v$VHDLVersion 2>&1" - $EnableVerbose -and (Write-Host " Analyzing file '$SourceFile.v$VHDLVersion'" ) | Out-Null - $EnableDebug -and (Write-Host " $InvokeExpr" ) | Out-Null + $EnableVerbose -and (Write-Host " Analyzing file '$SourceFile.v$VHDLVersion'" ) | Out-Null + $EnableDebug -and (Write-Host " $InvokeExpr" -ForegroundColor DarkGray ) | Out-Null $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings " " - if ($LastExitCode -ne 0) + if (($LastExitCode -ne 0) -or -not $?) { $ErrorCount += 1 if ($HaltOnError) { Exit-CompileScript -1 } @@ -675,7 +692,7 @@ if ($VHDL2008) $VHDLSourcesIndex = "ieee2008" foreach ($SourceFile in $SourceFiles[$VHDLSourcesIndex]) { Write-Host " file: v$VHDLVersion\$SourceFile.v$VHDLVersion" - $EnableVerbose -and (Write-Host " Patching file for $VHDLVersion" ) | Out-Null + $EnableVerbose -and (Write-Host " Patching file for $VHDLVersion" ) | Out-Null # Patch file Get-Content "$VHDLSourceLibraryDirectory\$VHDLSourcesIndex\$SourceFile.vhdl" -Encoding Ascii ` | Format-VHDLSourceFile -Version "$VHDLVersion" ` @@ -683,10 +700,10 @@ if ($VHDL2008) # Analyze file $InvokeExpr = "$GHDLExecutable -a -C `"-P../std`" --std=$VHDLVersion --work=$VHDLLibrary $SourceFile.v$VHDLVersion 2>&1" - $EnableVerbose -and (Write-Host " Analyzing file '$SourceFile.v$VHDLVersion'" ) | Out-Null - $EnableDebug -and (Write-Host " $InvokeExpr" ) | Out-Null + $EnableVerbose -and (Write-Host " Analyzing file '$SourceFile.v$VHDLVersion'" ) | Out-Null + $EnableDebug -and (Write-Host " $InvokeExpr" -ForegroundColor DarkGray ) | Out-Null $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings " " - if ($LastExitCode -ne 0) + if (($LastExitCode -ne 0) -or -not $?) { $ErrorCount += 1 if ($HaltOnError) { Exit-CompileScript -1 } @@ -696,7 +713,7 @@ if ($VHDL2008) $VHDLSourcesIndex = "vital2000" foreach ($SourceFile in $SourceFiles[$VHDLSourcesIndex]) { Write-Host " file: v$VHDLVersion\$SourceFile.v$VHDLVersion" - $EnableVerbose -and (Write-Host " Patching file for $VHDLVersion" ) | Out-Null + $EnableVerbose -and (Write-Host " Patching file for $VHDLVersion" ) | Out-Null # Patch file Get-Content "$VHDLSourceLibraryDirectory\$VHDLSourcesIndex\$SourceFile.vhdl" -Encoding Ascii ` | Format-VHDLSourceFile -Version "$VHDLVersion" ` @@ -704,10 +721,10 @@ if ($VHDL2008) # Analyze file $InvokeExpr = "$GHDLExecutable -a -C `"-P../std`" -frelaxed-rules --std=$VHDLVersion --work=$VHDLLibrary $SourceFile.v$VHDLVersion 2>&1" - $EnableVerbose -and (Write-Host " Analyzing file '$SourceFile.v$VHDLVersion'" ) | Out-Null - $EnableDebug -and (Write-Host " $InvokeExpr" ) | Out-Null + $EnableVerbose -and (Write-Host " Analyzing file '$SourceFile.v$VHDLVersion'" ) | Out-Null + $EnableDebug -and (Write-Host " $InvokeExpr" -ForegroundColor DarkGray ) | Out-Null $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings " " - if ($LastExitCode -ne 0) + if (($LastExitCode -ne 0) -or -not $?) { $ErrorCount += 1 if ($HaltOnError) { Exit-CompileScript -1 } @@ -728,7 +745,7 @@ if ($VHDL2008) $VHDLSourcesIndex = "ieee2008" foreach ($SourceFile in $SourceFiles[$VHDLSourcesIndex]) { Write-Host " file: v$VHDLVersion\$SourceFile.v$VHDLVersion" - $EnableVerbose -and (Write-Host " Patching file for $VHDLVersion" ) | Out-Null + $EnableVerbose -and (Write-Host " Patching file for $VHDLVersion" ) | Out-Null # Patch file Get-Content "$VHDLSourceLibraryDirectory\$VHDLSourcesIndex\$SourceFile.vhdl" -Encoding Ascii ` | Format-VHDLSourceFile -Version "$VHDLVersion" ` @@ -736,10 +753,10 @@ if ($VHDL2008) # Analyze file $InvokeExpr = "$GHDLExecutable -a -C `"-P../std`" --std=$VHDLVersion --work=$VHDLLibrary $SourceFile.v$VHDLVersion 2>&1" - $EnableVerbose -and (Write-Host " Analyzing file '$SourceFile.v$VHDLVersion'" ) | Out-Null - $EnableDebug -and (Write-Host " $InvokeExpr" ) | Out-Null + $EnableVerbose -and (Write-Host " Analyzing file '$SourceFile.v$VHDLVersion'" ) | Out-Null + $EnableDebug -and (Write-Host " $InvokeExpr" -ForegroundColor DarkGray ) | Out-Null $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings " " - if ($LastExitCode -ne 0) + if (($LastExitCode -ne 0) -or -not $?) { $ErrorCount += 1 if ($HaltOnError) { Exit-CompileScript -1 } @@ -748,7 +765,7 @@ if ($VHDL2008) foreach ($SourceFile in $SourceFiles[$VHDLFlavor]) { Write-Host " file: v$VHDLVersion\$SourceFile.v$VHDLVersion" - $EnableVerbose -and (Write-Host " Patching file for $VHDLVersion" ) | Out-Null + $EnableVerbose -and (Write-Host " Patching file for $VHDLVersion" ) | Out-Null # Patch file Get-Content "$VHDLSourceLibraryDirectory\$VHDLFlavor\$SourceFile.vhdl" -Encoding Ascii ` | Format-VHDLSourceFile -Version "$VHDLVersion" ` @@ -756,10 +773,10 @@ if ($VHDL2008) # Analyze file $InvokeExpr = "$GHDLExecutable -a -C `"-P../std`" --std=$VHDLVersion --work=$VHDLLibrary $SourceFile.v$VHDLVersion 2>&1" - $EnableVerbose -and (Write-Host " Analyzing file '$SourceFile.v$VHDLVersion'" ) | Out-Null - $EnableDebug -and (Write-Host " $InvokeExpr" ) | Out-Null + $EnableVerbose -and (Write-Host " Analyzing file '$SourceFile.v$VHDLVersion'" ) | Out-Null + $EnableDebug -and (Write-Host " $InvokeExpr" -ForegroundColor DarkGray ) | Out-Null $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings " " - if ($LastExitCode -ne 0) + if (($LastExitCode -ne 0) -or -not $?) { $ErrorCount += 1 if ($HaltOnError) { Exit-CompileScript -1 } @@ -769,7 +786,7 @@ if ($VHDL2008) $VHDLSourcesIndex = "vital2000" foreach ($SourceFile in $SourceFiles[$VHDLSourcesIndex]) { Write-Host " file: v$VHDLVersion\$SourceFile.v$VHDLVersion" - $EnableVerbose -and (Write-Host " Patching file for $VHDLVersion" ) | Out-Null + $EnableVerbose -and (Write-Host " Patching file for $VHDLVersion" ) | Out-Null # Patch file Get-Content "$VHDLSourceLibraryDirectory\$VHDLSourcesIndex\$SourceFile.vhdl" -Encoding Ascii ` | Format-VHDLSourceFile -Version "$VHDLVersion" ` @@ -777,10 +794,10 @@ if ($VHDL2008) # Analyze file $InvokeExpr = "$GHDLExecutable -a -C `"-P../std`" -frelaxed-rules --std=$VHDLVersion --work=$VHDLLibrary $SourceFile.v$VHDLVersion 2>&1" - $EnableVerbose -and (Write-Host " Analyzing file '$SourceFile.v$VHDLVersion'" ) | Out-Null - $EnableDebug -and (Write-Host " $InvokeExpr" ) | Out-Null + $EnableVerbose -and (Write-Host " Analyzing file '$SourceFile.v$VHDLVersion'" ) | Out-Null + $EnableDebug -and (Write-Host " $InvokeExpr" -ForegroundColor DarkGray ) | Out-Null $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings " " - if ($LastExitCode -ne 0) + if (($LastExitCode -ne 0) -or -not $?) { $ErrorCount += 1 if ($HaltOnError) { Exit-CompileScript -1 } |