diff options
author | Patrick Lehmann | 2015-01-21 00:34:37 +0100 |
---|---|---|
committer | Patrick Lehmann | 2015-01-21 00:34:37 +0100 |
commit | 57e9abd616275b7f82fb835b582917fdab70b816 (patch) | |
tree | 098cc0f39e970ec861c1defb0fcc39f7993e41f9 | |
parent | 98fa5f28b2c97ce321b13660d4db969a0072f606 (diff) | |
download | ghdl-57e9abd616275b7f82fb835b582917fdab70b816.tar.gz ghdl-57e9abd616275b7f82fb835b582917fdab70b816.tar.bz2 ghdl-57e9abd616275b7f82fb835b582917fdab70b816.zip |
Experimental: Translated compile scripts for windows to PowerShell scripts (*.ps1). Updated .hgignore file to ignore folders from windows build process.
-rw-r--r-- | .hgignore | 3 | ||||
-rw-r--r-- | dist/mcode/winbuild.ps1 | 422 | ||||
-rw-r--r-- | dist/mcode/windows/compile.ps1 | 256 | ||||
-rw-r--r-- | dist/mcode/windows/complib.ps1 | 722 |
4 files changed, 1403 insertions, 0 deletions
@@ -22,3 +22,6 @@ translate/grt/grt-files translate/grt/grt-files.in translate/grt/run-bind.adb translate/grt/run-bind.ads +syntax: glob +dist/mcode/lib +dist/mcode/build diff --git a/dist/mcode/winbuild.ps1 b/dist/mcode/winbuild.ps1 new file mode 100644 index 0000000..ef662a1 --- /dev/null +++ b/dist/mcode/winbuild.ps1 @@ -0,0 +1,422 @@ +# EMACS settings: -*- tab-width: 2; indent-tabs-mode: t -*-
+# vim: tabstop=2:shiftwidth=2:noexpandtab
+# kate: tab-width 2; replace-tabs off; indent-width 2;
+#
+# ==============================================================================
+# PowerShell Script: Script to compile GHDL for Windows
+#
+# Authors: Patrick Lehmann (ported batch file to PowerShell)
+# Brian Davis (contributions to the batch file)
+# Tristan Gingold (initial batch file for compilations on Windows)
+#
+# Description:
+# ------------------------------------
+# This is a PowerShell script (executable) which:
+# - compiles GHDL and GHDLFilter
+# - analyses VHDL libraries
+# - installs GHDL into a directory (xcopy deploiment)
+#
+# ==============================================================================
+# Copyright (C) 2002, 2003, 2004, 2005 Tristan Gingold
+#
+# GHDL is free software; you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free
+# Software Foundation; either version 2, or (at your option) any later
+# version.
+#
+# GHDL is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GHDL; see the file COPYING. If not, write to the Free
+# Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+# ==============================================================================
+<#
+ .SYNOPSIS
+ GHDL for Windows - GHDL compile script
+ Use 'winbuild.ps1 -Help' to see the integrated help page
+
+ .EXAMPLE
+ #
+ # Normal flow
+ PS> .\winbuild.ps1 -Clean
+ PS> .\winbuild.ps1 -Compile
+ PS> .\winbuild.ps1 -Install -InstallPath "C:\Tools\GHDL"
+
+ # Create a zip-file
+ PS>.\winbuild.ps1 -CreatePackage -Zip
+
+ # combine all commands in a single call
+ PS>.\winbuild.ps1 -Clean -Compile -Install -InstallPath "C:\Tools\GHDL"
+#>
+
+# define script parameters
+[CmdletBinding()]
+Param(
+ # compile GHDL
+ [switch]$Compile,
+
+ # clean up all files and directories
+ [switch]$Clean,
+
+ # create an installer package
+ [switch]$CreatePackage,
+ # creates a zip-file for xcopy deployment
+ [switch]$Zip,
+
+ # install all files into a directory (xcopy deployment)
+ [switch]$Install,
+ # Installation directory
+ [string]$InstallPath,
+
+ # uninstall all files from a directory
+ [switch]$Uninstall,
+
+ # display this help"
+ [switch]$Help
+)
+
+# configure script here
+$Script_RelPathToRoot = "..\.."
+
+# save parameters and current working directory
+$Script_Parameters = $args
+$Script_ScriptDir = $PSScriptRoot
+$Script_WorkingDir = Get-Location
+$GHDLRootDir_AbsPath = Convert-Path (Resolve-Path ($PSScriptRoot + "\" + $Script_RelPathToRoot))
+
+# configure some variables: paths, executables, directory names, ...
+$WindowsDirName = "dist\mcode\windows"
+$BuildDirName = "dist\mcode\build"
+$LibraryDirName = "dist\mcode\lib"
+$ZipPackageDirName = "dist\mcode\zip"
+$ZipPackageFileName = "dist\mcode\ghdl-install.zip"
+
+# construct directories
+$GHDLWindowsDir = $GHDLRootDir_AbsPath + "\" + $WindowsDirName
+$GHDLBuildDir = $GHDLRootDir_AbsPath + "\" + $BuildDirName
+$GHDLLibraryDir = $GHDLRootDir_AbsPath + "\" + $LibraryDirName
+$GHDLZipPackageDir = $GHDLRootDir_AbsPath + "\" + $ZipPackageDirName
+$GHDLZipPackageFile = $GHDLRootDir_AbsPath + "\" + $ZipPackageFileName
+
+# set default values
+$Script_ExitCode = 0
+if ($PSCmdlet.MyInvocation.BoundParameters["Debug"].IsPresent) { $Script_EnableDebug = $true }
+if ($PSCmdlet.MyInvocation.BoundParameters["Verbose"].IsPresent) { $Script_EnableVerbose = $true }
+
+# Author: Ed Wilson
+# Source: http://blogs.technet.com/b/heyscriptingguy/archive/2011/07/23/use-powershell-to-modify-your-environmental-path.aspx
+function Add-Path
+ ( [parameter(Mandatory=$True,ValueFromPipeline=$True,Position=0)]
+ [string]$AddedFolder
+ )
+# function body
+ { # Get the current search path from the environment keys in the registry.
+ $OldPath = (Get-ItemProperty -Path "Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment" -Name PATH).Path
+
+ # See if a new folder has been supplied.
+ if (!$AddedFolder)
+ { return "No Folder Supplied. $ENV:PATH Unchanged" }
+
+ # See if the new folder exists on the file system.
+ if (!(Test-Path $AddedFolder))
+ { return "Folder Does not Exist, Cannot be added to $ENV:PATH" }
+
+ # See if the new Folder is already in the path.
+ if ($ENV:Path | Select-String -SimpleMatch $AddedFolder)
+ { return "Folder already within $ENV:PATH" }
+
+ # Set the New Path
+ $NewPath = $OldPath + ";" + $AddedFolder
+
+ Set-ItemProperty -Path "Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment" -Name PATH -Value $NewPath
+ }
+
+# Author: Ed Wilson
+# Source: http://blogs.technet.com/b/heyscriptingguy/archive/2011/07/23/use-powershell-to-modify-your-environmental-path.aspx
+function Remove-Path
+ ( [parameter(Mandatory=$True,ValueFromPipeline=$True,Position=0)]
+ [string]$RemovedFolder
+ )
+# function body
+ { # Get the Current Search Path from the environment keys in the registry
+ $OldPath = (Get-ItemProperty -Path "Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment" -Name PATH).Path
+
+ # Find the value to remove, replace it with $NULL. If it’s not found, nothing will change.
+ $NewPath = $OldPath -replace $RemovedFolder,$Null
+
+ # Update the Environment Path
+ Set-ItemProperty -Path "Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment" -Name PATH -Value $NewPath
+ }
+
+
+if ($Help)
+ { Write-Host "Usage:"
+ Write-Host " compile.ps1 [-Verbose] [-Debug] (-Help|-Compile|-Clean|-CreatePackage|-Install|-Uninstall)" -ForegroundColor Gray
+ Write-Host
+ Write-Host "Options:"
+ Write-Host " -Verbose enable detailed messages"
+ Write-Host " -Debug enable debug messages"
+ Write-Host
+ Write-Host "Commands:"
+ Write-Host " -Help display this help"
+ Write-Host " -Compile compile all library files"
+ Write-Host " -Clean clean up all files and directories"
+ Write-Host " -CreatePackage create an installer package"
+ Write-Host " -Install install all files into a directory (xcopy deployment)"
+ Write-Host " -Uninstall uninstall all files from a directory"
+ Write-Host
+ Write-Host "Options for -CreatePackage:"
+ Write-Host " -Zip creates a zip-file for xcopy deployment"
+ Write-Host
+ Write-Host "Options for -Install:"
+ Write-Host " -InstallPath <dir> directory into which GHDL will be installed"
+ Write-Host
+ Write-Host "Examples:"
+ Write-Host " # Normal flow"
+ Write-Host " PS>.\winbuild.ps1 -Clean" -ForegroundColor Gray
+ Write-Host " PS>.\winbuild.ps1 -Compile" -ForegroundColor Gray
+ Write-Host " PS>.\winbuild.ps1 -Install -InstallPath `"C:\Tools\GHDL`"" -ForegroundColor Gray
+ Write-Host
+ Write-Host " # Create a zip-file"
+ Write-Host " PS>.\winbuild.ps1 -CreatePackage -Zip" -ForegroundColor Gray
+ Write-Host
+ Write-Host " # combine all commands in a single call"
+ Write-Host " PS>.\winbuild.ps1 -Clean -Compile -Install -InstallPath `"C:\Tools\GHDL`"" -ForegroundColor Gray
+ Write-Host
+ }
+elseif ($Uninstall)
+ { Write-Host "Uninstalling GHDL $GHDLVersion for Windows"
+
+ Write-Host "This command is not implemented" -ForegroundColor Red
+ $Script_ExitCode = 1
+
+ if ($Script_ExitCode -eq 0)
+ { Write-Host
+ Write-Host "Uninstall " -NoNewline
+ Write-Host "[SUCCESSFUL]" -ForegroundColor Green
+ Write-Host
+ }
+ } # Uninstall
+else
+ { $Script_ExitCode = -1
+
+ if ($Clean)
+ { $Script_ExitCode = 0
+ Write-Host "Removing all created files and directories..."
+
+ if ($Script_ExitCode -eq 0)
+ { $Script_Path = $GHDLWindowsDir + "\compile.ps1"
+ $Script_Parameters = @('-Clean')
+ #$Script_Parameters += '-Clean'
+ if ($Script_EnableVerbose -eq $true) { $Script_Parameters += '-Verbose' }
+ if ($Script_EnableDebug -eq $true) { $Script_Parameters += '-Debug' }
+
+ Write-Host "Running compile.ps1 ..."
+ Write-Host "--------------------------------------------------------------------------------"
+ Invoke-Expression "$Script_Path $($Script_Parameters -join " ")"
+ if ($LastExitCode -ne 0)
+ { $Script_ExitCode = 1
+ Write-Host "--------------------------------------------------------------------------------"
+ Write-Host "ERROR while executing 'compile.ps1 $($Script_Paramters -join " ")'" -ForegroundColor Red
+ }
+ else
+ { Write-Host "--------------------------------------------------------------------------------"
+ Write-Host "Completed [SUCCESSFUL]"
+ Write-Host
+ }
+ }
+
+ if ($Script_ExitCode -eq 0)
+ { $Script_Path = $GHDLWindowsDir + "\compile.ps1"
+ $Script_Parameters = @()
+ $Script_Parameters += '-Clean'
+ if ($Script_EnableVerbose -eq $true) { $Script_Parameters += '-Verbose' }
+ if ($Script_EnableDebug -eq $true) { $Script_Parameters += '-Debug' }
+
+ Write-Host "Running complib.ps1 ..."
+ Write-Host "--------------------------------------------------------------------------------"
+ Invoke-Expression "$Script_Path $($Script_Parameters -join " ")"
+ if ($LastExitCode -ne 0)
+ { $Script_ExitCode = 1
+ Write-Host "--------------------------------------------------------------------------------"
+ Write-Host "ERROR while executing 'complib.ps1 $($Script_Paramters -join " ")'" -ForegroundColor Red
+ }
+ else
+ { Write-Host "--------------------------------------------------------------------------------"
+ Write-Host "Completed [SUCCESSFUL]"
+ Write-Host
+ }
+ }
+
+ if ($Script_ExitCode -eq 0)
+ { Write-Host "Removing installer packages and temporary directories..."
+ Write-Host " $GHDLZipPackageDir"
+ Remove-Item $GHDLZipPackageDir -Force -Recurse -ErrorAction SilentlyContinue
+
+ Write-Host " $GHDLZipPackageFile"
+ Remove-Item $GHDLZipPackageFile -Force -Recurse -ErrorAction SilentlyContinue
+ }
+
+ if ($Script_ExitCode -eq 0)
+ { Write-Host
+ Write-Host "Clean " -NoNewline
+ Write-Host "[SUCCESSFUL]" -ForegroundColor Green
+ Write-Host
+ }
+ } # Clean
+
+ if ($Compile)
+ { $Script_ExitCode = 0
+ Write-Host "Compiling GHDL $GHDLVersion for Windows"
+
+ if ($Script_ExitCode -eq 0)
+ { $Script_Path = $GHDLWindowsDir + "\compile.ps1"
+ $Script_Parameters = @()
+ $Script_Parameters += '-Compile'
+ if ($Script_EnableVerbose -eq $true) { $Script_Parameters += '-Verbose' }
+ if ($Script_EnableDebug -eq $true) { $Script_Parameters += '-Debug' }
+
+ Write-Host "Running compile.ps1 ..."
+ Write-Host "--------------------------------------------------------------------------------"
+ Invoke-Expression "$Script_Path $($Script_Parameters -join " ")"
+ if ($LastExitCode -ne 0)
+ { $Script_ExitCode = 1
+ Write-Host "--------------------------------------------------------------------------------"
+ Write-Host "ERROR while executing 'compile.ps1 $($Script_Paramters -join " ")'" -ForegroundColor Red
+ }
+ else
+ { Write-Host "--------------------------------------------------------------------------------"
+ Write-Host "Completed [SUCCESSFUL]"
+ Write-Host
+ }
+ }
+
+ if ($Script_ExitCode -eq 0)
+ { $Script_Path = $GHDLWindowsDir + "\complib.ps1"
+ $Script_Parameters = @()
+ $Script_Parameters += '-Compile'
+ if ($Script_EnableVerbose -eq $true) { $Script_Parameters += '-Verbose' }
+ if ($Script_EnableDebug -eq $true) { $Script_Parameters += '-Debug' }
+
+ Write-Host "Running complib.ps1 ..."
+ Write-Host "--------------------------------------------------------------------------------"
+ Invoke-Expression "$Script_Path $($Script_Parameters -join " ")"
+ if ($LastExitCode -ne 0)
+ { $Script_ExitCode = 1
+ Write-Host "--------------------------------------------------------------------------------"
+ Write-Host "ERROR while executing 'complib.ps1 $($Script_Paramters -join " ")'" -ForegroundColor Red
+ }
+ else
+ { Write-Host "--------------------------------------------------------------------------------"
+ Write-Host "Completed [SUCCESSFUL]"
+ Write-Host
+ }
+ }
+
+ if ($Script_ExitCode -eq 0)
+ { Write-Host
+ Write-Host "Compile " -NoNewline
+ Write-Host "[SUCCESSFUL]" -ForegroundColor Green
+ Write-Host
+ }
+ } # Compile
+
+ if ($CreatePackage)
+ { $Script_ExitCode = 0
+ Write-Host "Creating an installation package for GHDL $GHDLVersion for Windows"
+
+ if ($Zip)
+ { Write-Host "Output format: zip-file"
+
+ Write-Host " Removing old directory '$GHDLZipPackageDir'."
+ Remove-Item $GHDLZipPackageDir -Force -Recurse -ErrorAction SilentlyContinue
+
+ Write-Host " Creating directory '$GHDLZipPackageDir'."
+ [void](New-Item -ItemType directory -Path $GHDLZipPackageDir -ErrorAction SilentlyContinue)
+ [void](New-Item -ItemType directory -Path "$GHDLZipPackageDir\bin" -ErrorAction SilentlyContinue)
+
+ Copy-Item "$GHDLBuildDir\ghdl.exe" "$GHDLZipPackageDir\bin\ghdl.exe" -ErrorAction SilentlyContinue
+ Copy-Item "$GHDLBuildDir\ghdlfilter.exe" "$GHDLZipPackageDir\bin\ghdlfilter.exe" -ErrorAction SilentlyContinue
+
+ Copy-Item $GHDLLibraryDir -Recurse $GHDLZipPackageDir -ErrorAction SilentlyContinue
+
+ Write-Host " Compressing files into '$GHDLZipPackageFile'"
+ $file = Get-ChildItem $GHDLZipPackageDir -Recurse | Write-Zip -IncludeEmptyDirectories -EntryPathRoot $GHDLZipPackageDir -OutputPath $GHDLZipPackageFile
+ Write-Host " $([math]::round(($file.Length / 1MB), 3)) MiB written to disk"
+ }
+ else
+ { $Script_ExitCode = 1
+ Write-Host "No package format selected." -ForegroundColor Red
+ Write-Host "Possible formats:"
+ Write-Host " - zip-file (-Zip)"
+ Write-Host
+ }
+
+ if ($Script_ExitCode -eq 0)
+ { Write-Host
+ Write-Host "Create Package " -NoNewline
+ Write-Host "[SUCCESSFUL]" -ForegroundColor Green
+ Write-Host
+ }
+ } # CreatePackage
+
+ if ($Install)
+ { $Script_ExitCode = 0
+ Write-Host "Installing GHDL $GHDLVersion for Windows"
+
+ if ($InstallPath -eq "")
+ { $Script_ExitCode = 1
+ Write-Host "Missing argument -InstallPath" -ForegroundColor Red
+ }
+ else
+ { if (Test-Path -Path $InstallPath)
+ { $Script_ExitCode = 1
+ Write-Host " Directory '$InstallPath' already exists." -ForegroundColor Red
+ Write-Host
+ }
+ }
+
+ if ($Script_ExitCode -eq 0)
+ { Write-Host " Install directory: $InstallPath"
+
+ Write-Host " Creating directory '$InstallPath'."
+ [void](New-Item -ItemType directory -Path $InstallPath -ErrorAction SilentlyContinue)
+ [void](New-Item -ItemType directory -Path "$InstallPath\bin" -ErrorAction SilentlyContinue)
+
+ Copy-Item "$GHDLBuildDir\ghdl.exe" "$InstallPath\bin\ghdl.exe" -ErrorAction SilentlyContinue
+ Copy-Item "$GHDLBuildDir\ghdlfilter.exe" "$InstallPath\bin\ghdlfilter.exe" -ErrorAction SilentlyContinue
+
+ Copy-Item $GHDLLibraryDir -Recurse $InstallPath -ErrorAction SilentlyContinue
+ }
+
+ if ($Script_ExitCode -eq 0)
+ { Write-Host " Registering installation directory in system PATH"
+ Add-Path "$InstallPath\bin"
+ }
+
+ if ($Script_ExitCode -eq 0)
+ { Write-Host
+ Write-Host "Install " -NoNewline
+ Write-Host "[SUCCESSFUL]" -ForegroundColor Green
+ Write-Host
+ }
+ } # Install
+
+ if ($Script_ExitCode -eq -1)
+ { Write-Host "ERROR: missing argument(s)" -ForegroundColor Red
+ Write-Host
+ Write-Host "Usage:"
+ Write-Host " winbuild.ps1 [-Verbose] [-Debug] (-Help|-Compile|-Clean|-CreatePackage|-Install|-Uninstall)" -ForegroundColor Gray
+ Write-Host
+ } # Unknown
+ }
+
+# restore working directory if changed
+Set-Location $Script_WorkingDir
+
+# return exit status
+exit $Script_ExitCode
diff --git a/dist/mcode/windows/compile.ps1 b/dist/mcode/windows/compile.ps1 new file mode 100644 index 0000000..2dea73a --- /dev/null +++ b/dist/mcode/windows/compile.ps1 @@ -0,0 +1,256 @@ +# EMACS settings: -*- tab-width: 2; indent-tabs-mode: t -*-
+# vim: tabstop=2:shiftwidth=2:noexpandtab
+# kate: tab-width 2; replace-tabs off; indent-width 2;
+#
+# ==============================================================================
+# PowerShell Script: Script to compile GHDL for Windows
+#
+# Authors: Patrick Lehmann (ported batch file to PowerShell)
+# Brian Davis (contributions to the batch file)
+# Tristan Gingold (initial batch file for compilations on Windows)
+#
+# Description:
+# ------------------------------------
+# This is a PowerShell script (executable) which:
+# - sets up a compilation environment
+# - test all dependencies
+# - compiles GHDL with GNAT
+#
+# ==============================================================================
+# Copyright (C) 2002, 2003, 2004, 2005 Tristan Gingold
+#
+# GHDL is free software; you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free
+# Software Foundation; either version 2, or (at your option) any later
+# version.
+#
+# GHDL is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GHDL; see the file COPYING. If not, write to the Free
+# Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+# ==============================================================================
+<#
+ .SYNOPSIS
+ GHDL for Windows - GHDL compile script
+ Use 'compile.ps1 -Help' to see the integrated help page
+
+ .EXAMPLE
+ C:\PS> .\compile.ps1 -Verbose -Compile
+#>
+
+# define script parameters
+[CmdletBinding()]
+Param(
+ # compile GHDL
+ [switch]$Compile,
+
+ # clean up all files and directories
+ [switch]$Clean,
+
+ # display this help"
+ [switch]$Help
+)
+
+# configure script here
+$Script_RelPathToRoot = "..\..\.."
+$GHDLVersion = "0.33dev"
+
+# save parameters and current working directory
+$Script_Parameters = $args
+$Script_ScriptDir = $PSScriptRoot
+$Script_WorkingDir = Get-Location
+$GHDLRootDir_AbsPath = Convert-Path (Resolve-Path ($PSScriptRoot + "\" + $Script_RelPathToRoot))
+
+# configure some variables: paths, executables, directory names, ...
+$SourceDirName = "src"
+$BuildDirName = "dist\mcode\build"
+
+# TODO:
+# check if:
+# - program are installed / auto find programs / auto find paths
+# - program version
+$GCCExecutable = "gcc.exe"
+$GNATExecutable = "gnatmake.exe"
+$StripExecutable = "strip.exe"
+$GHDLExecutable = "ghdl.exe"
+$GHDLFilterExecutable = "ghdlfilter.exe"
+
+# construct directories
+$SourceDir = $GHDLRootDir_AbsPath + "\" + $SourceDirName
+$BuildDir = $GHDLRootDir_AbsPath + "\" + $BuildDirName
+
+# set default values
+$Script_ExitCode = 0
+if ($PSCmdlet.MyInvocation.BoundParameters["Debug"].IsPresent) { $Script_EnableDebug = $true }
+if ($PSCmdlet.MyInvocation.BoundParameters["Verbose"].IsPresent) { $Script_EnableVerbose = $true }
+
+# Compiler flags
+$CFlags = @() # start with an empty array
+$CFlags += '-O' # optimize; level ?
+$CFlags += '-g' # enable debug symbols
+
+Write-Host "GHDL for Windows - GHDL and tools compile script" -ForegroundColor Yellow
+Write-Host
+
+if ($Help)
+ { Write-Host "Usage:"
+ Write-Host " compile.ps1 [-Verbose] [-Debug] (-Help|-Compile|-Clean)" -ForegroundColor Gray
+ Write-Host
+ Write-Host "Options:"
+ Write-Host " -Verbose enable detailed messages"
+ Write-Host " -Debug enable debug messages"
+ Write-Host
+ Write-Host "Commands:"
+ Write-Host " -Help display this help"
+ Write-Host " -Compile compile all library files"
+ Write-Host " -Clean clean up all files and directories"
+ } # Help
+elseif ($Clean)
+ { Write-Host "Removing all created files and directories..."
+ Write-Host " rmdir $BuildDir"
+
+ Remove-Item $BuildDir -Force -Recurse -ErrorAction SilentlyContinue
+ } # Clean
+elseif ($Compile)
+ { Write-Host "Compiling GHDL $GHDLVersion for Windows"
+ Write-Host "Preparing..."
+
+ # create build directory if it does not exist
+ if (Test-Path -Path $BuildDir)
+ { Write-Host " Directory '$BuildDir' already exists."}
+ else
+ { Write-Host " Creating directory '$BuildDir'."
+ [void](New-Item -ItemType directory -Path $BuildDir -ErrorAction SilentlyContinue)
+ }
+
+ # change working directory to BuildDir
+ Write-Host " cd $BuildDir"
+ Set-Location $BuildDir
+
+ Write-Host
+ Write-Host "Start compilation..."
+ # list all files to be compiled; add additional CFlags if needed
+ $SourceFiles = @()
+ $SourceFiles += New-Object PSObject -Property @{File="grt\grt-cbinding.c"; CFlags=@()}
+ $SourceFiles += New-Object PSObject -Property @{File="grt\grt-cvpi.c"; CFlags=@()}
+ $SourceFiles += New-Object PSObject -Property @{File="grt\config\clock.c"; CFlags=@()}
+ $SourceFiles += New-Object PSObject -Property @{File="grt\config\win32.c"; CFlags=@('-DWITH_GNAT_RUN_TIME')}
+ $SourceFiles += New-Object PSObject -Property @{File="ortho\mcode\memsegs_c.c"; CFlags=@()}
+
+ # compile c files
+ foreach ($SourceFile in $SourceFiles)
+ { $Parameters = @()
+ $Parameters += '-c'
+ $Parameters += $CFlags
+ $Parameters += $SourceFile.CFlags
+ $Parameters += $SourceDir + "\" + $SourceFile.File
+
+ Write-Host (" compiling: " + $SourceFile.File)
+ if ($Script_EnableDebug)
+ { Write-Host (" file: " + $SourceDir + "\" + $SourceFile.File)
+ Write-Host (" call: " + $GCCExecutable + " " + ($Parameters -join ' '))
+ }
+
+ # call compiler
+ & $GCCExecutable $Parameters
+ if ($LastExitCode -ne 0)
+ { $Script_ExitCode = 1
+ Write-Host " ERROR while compiling" -ForegroundColor Red
+ }
+ }
+
+ if ($Script_ExitCode -eq 0)
+ { # compile with GNAT
+ $Parameters = @()
+ $Parameters += $CFlags
+ $Parameters += '-gnatn'
+
+ # add source include paths
+ $Parameters += '-aI' + $GHDLRootDir_AbsPath + '\dist\mcode\windows'
+ $Parameters += '-aI' + $SourceDir
+ $Parameters += '-aI' + $SourceDir + '\ghdldrv'
+ $Parameters += '-aI' + $SourceDir + '\psl'
+ $Parameters += '-aI' + $SourceDir + '\grt'
+ $Parameters += '-aI' + $SourceDir + '\ortho'
+ $Parameters += '-aI' + $SourceDir + '\ortho\mcode'
+ $Parameters += '-aI' + $SourceDir + '\vhdl'
+ $Parameters += '-aI' + $SourceDir + '\vhdl\translate'
+ $Parameters += 'ghdl_jit'
+
+ # add output filename
+ $Parameters += '-o'
+ $Parameters += $GHDLExecutable
+
+ # add linker parameters
+ $Parameters += '-largs'
+ $Parameters += 'grt-cbinding.o'
+ $Parameters += 'clock.o'
+ $Parameters += 'grt-cvpi.o'
+ $Parameters += 'memsegs_c.o'
+ $Parameters += 'win32.o'
+ $Parameters += '-largs'
+ $Parameters += '-Wl,--stack,8404992'
+
+ # call compiler (GNAT)
+ Write-Host " compiling with GNAT"
+ if ($Script_EnableDebug)
+ { #Write-Host (" file: " + $SourceDir + "\" + $SourceFile.File)
+ Write-Host (" call: " + $GNATExecutable + " " + ($Parameters -join ' '))
+ }
+
+ & $GNATExecutable $Parameters
+ if ($LastExitCode -ne 0)
+ { $Script_ExitCode = 1
+ Write-Host " ERROR while compiling" -ForegroundColor Red }
+ }
+
+ if ($Script_ExitCode -eq 0)
+ { #
+ Write-Host " stripping executable..."
+ #& $StripExecutable $GHDLExecutable
+ }
+
+ if ($true) #$Script_ExitCode -eq 0)
+ { # compile with GNAT
+ $Parameters = @()
+ $Parameters += $CFlags
+
+ # add source include paths
+ $Parameters += '-aI' + $GHDLRootDir_AbsPath + '\dist\mcode\windows'
+ $Parameters += 'ghdlfilter'
+
+ # add output filename
+ $Parameters += '-o'
+ $Parameters += $GHDLFilterExecutable
+
+ # call compiler (GNAT)
+ Write-Host " compiling with GNAT"
+ if ($Script_EnableDebug)
+ { #Write-Host (" file: " + $SourceDir + "\" + $SourceFile.File)
+ Write-Host (" call: " + $GNATExecutable + " " + ($Parameters -join ' '))
+ }
+
+ & $GNATExecutable $Parameters
+ if ($LastExitCode -ne 0)
+ { $Script_ExitCode = 1
+ Write-Host " ERROR while compiling" -ForegroundColor Red }
+ }
+ } # compile
+else
+ { Write-Host "ERROR: missing argument(s)" -ForegroundColor Red
+ Write-Host
+ Write-Host "Usage:"
+ Write-Host " compile.ps1 [-Verbose] [-Debug] (-Help|-Compile|-Clean)" -ForegroundColor Gray
+ Write-Host
+ } # unknown command
+
+# restore working directory if changed
+Set-Location $Script_WorkingDir
+
+# return exit status
+exit $Script_ExitCode
diff --git a/dist/mcode/windows/complib.ps1 b/dist/mcode/windows/complib.ps1 new file mode 100644 index 0000000..5706557 --- /dev/null +++ b/dist/mcode/windows/complib.ps1 @@ -0,0 +1,722 @@ +# EMACS settings: -*- tab-width: 2; indent-tabs-mode: t -*-
+# vim: tabstop=2:shiftwidth=2:noexpandtab
+# kate: tab-width 2; replace-tabs off; indent-width 2;
+#
+# ==============================================================================
+# PowerShell Script: Script to compile VHDL libraries for GHDL
+#
+# Authors: Patrick Lehmann (ported batch file to PowerShell)
+# Brian Davis (contributions to the batch file)
+# Tristan Gingold (initial batch file for compilations on Windows)
+#
+# Description:
+# ------------------------------------
+# This is a PowerShell script (executable) which:
+# - sets up a compilation environment
+# - test all dependencies
+# - pre processes VHDL files with GHDLFilter
+# - analyses VHDL files with GHDL
+#
+# ==============================================================================
+# Copyright (C) 2002, 2003, 2004, 2005 Tristan Gingold
+#
+# GHDL is free software; you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free
+# Software Foundation; either version 2, or (at your option) any later
+# version.
+#
+# GHDL is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GHDL; see the file COPYING. If not, write to the Free
+# Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+# ==============================================================================
+<#
+ .SYNOPSIS
+ GHDL for Windows - Library compile script
+ Use 'complib.ps1 -Help' to see the integrated help page
+
+ .EXAMPLE
+ C:\PS> .\complib.ps1 -Verbose -Compile
+ .EXAMPLE
+ C:\PS> .\complib.ps1 -Verbose -Clean
+#>
+
+# define script parameters
+[CmdletBinding()]
+Param(
+ # compile all library files
+ [switch]$Compile,
+
+ # clean up all files and directories
+ [switch]$Clean,
+
+ # display this help"
+ [switch]$Help
+)
+
+# configure script here
+$Script_RelPathToRoot = "..\..\.."
+
+# set default values
+$Script_ExitCode = 0
+if ($PSCmdlet.MyInvocation.BoundParameters["Debug"].IsPresent) { $Script_EnableDebug = $true }
+if ($PSCmdlet.MyInvocation.BoundParameters["Verbose"].IsPresent) { $Script_EnableVerbose = $true }
+
+# save parameters and current working directory
+$Script_Parameters = $args
+$Script_ScriptDir = $PSScriptRoot
+$Script_WorkingDir = Get-Location
+$GHDLRootDir_AbsPath = Convert-Path (Resolve-Path ($PSScriptRoot + "\" + $Script_RelPathToRoot))
+
+# configure some variables: paths, executables, directory names, ...
+#$VHDLSourceLibraryDirName = "libraries"
+#$VHDLDestLibraryDirName = "lib"
+
+$GHDLExecutable = $GHDLRootDir_AbsPath + "\dist\mcode\build\ghdl.exe"
+$GHDLFilterExecutable = $GHDLRootDir_AbsPath + "\dist\mcode\build\ghdlfilter.exe"
+
+# construct directories
+$VHDLSourceLibraryDir = $GHDLRootDir_AbsPath + "\libraries" # + $VHDLSourceLibraryDirName
+$VHDLDestLibraryDir = $GHDLRootDir_AbsPath + "\dist\mcode\lib" # + $VHDLDestLibraryDirName
+
+
+Write-Host "GHDL for Windows - Library compile script" -ForegroundColor Yellow
+Write-Host
+
+if ($Help)
+ { Write-Host "Usage:"
+ Write-Host " complib.ps1 [-Verbose] [-Debug] (-Help|-Compile|-Clean)" -ForegroundColor Gray
+ Write-Host
+ Write-Host "Options:"
+ Write-Host " -Verbose enable detailed messages"
+ Write-Host " -Debug enable debug messages"
+ Write-Host
+ Write-Host "Commands:"
+ Write-Host " -Help display this help"
+ Write-Host " -Compile compile all library files"
+ Write-Host " -Clean clean up all files and directories"
+ }
+elseif ($Clean)
+ { Write-Host "Removing all created files and directories..."
+ Write-Host " rmdir $VHDLDestLibraryDir"
+
+ Remove-Item $VHDLDestLibraryDir -Force -Recurse -ErrorAction SilentlyContinue
+ }
+elseif ($Compile)
+ { Write-Host "Compiling VHDL Libraries..."
+ Write-Host "Preparing..."
+
+ # create lib directory if it does not exist
+ if (Test-Path -Path $VHDLDestLibraryDir)
+ { Write-Host " Directory '$VHDLDestLibraryDir' already exists."
+
+ # change working directory to VHDLDestLibraryDir
+ Write-Host " cd $VHDLDestLibraryDir"
+ Set-Location $VHDLDestLibraryDir
+
+ Write-Host " cleaning up directory..."
+ Remove-Item ./* -Force -Recurse -ErrorAction SilentlyContinue
+ }
+ else
+ { Write-Host " Creating directory '$VHDLDestLibraryDir'."
+ [void](New-Item -ItemType directory -Path $VHDLDestLibraryDir -ErrorAction SilentlyContinue)
+
+ # change working directory to VHDLDestLibraryDir
+ Write-Host " cd $VHDLDestLibraryDir"
+ Set-Location $VHDLDestLibraryDir
+ }
+
+
+ # Library sources
+ $SourceFiles = @{
+ "std" = @(
+ "textio",
+ "textio_body"
+ );
+ "ieee" = @(
+ "std_logic_1164",
+ "std_logic_1164_body",
+ "numeric_std",
+ "numeric_std-body",
+ "numeric_bit",
+ "numeric_bit-body"
+ );
+ "math" = @(
+ "math_real",
+ "math_real-body",
+ "math_complex",
+ "math_complex-body"
+ );
+ "std08" = @(
+ "textio",
+ "textio_body",
+ "env",
+ "env_body"
+ );
+ "ieee2008" = @(
+ "std_logic_1164",
+ "std_logic_1164-body",
+ "std_logic_textio",
+ "math_real",
+ "math_real-body",
+ "math_complex",
+ "math_complex-body",
+ "numeric_bit",
+ "numeric_bit-body",
+ "numeric_bit_unsigned",
+ "numeric_bit_unsigned-body",
+ "numeric_std",
+ "numeric_std-body",
+ "numeric_std_unsigned",
+ "numeric_std_unsigned-body",
+ "fixed_float_types",
+ "fixed_generic_pkg",
+ "fixed_generic_pkg-body",
+ "fixed_pkg",
+ "float_generic_pkg",
+ "float_generic_pkg-body",
+ "float_pkg"
+ );
+ "vital95" = @(
+ "vital_timing",
+ "vital_timing_body",
+ "vital_primitives",
+ "vital_primitives_body"
+ );
+ "vital2000" = @(
+ "timing_p",
+ "timing_b",
+ "prmtvs_p",
+ "prmtvs_b",
+ "memory_p",
+ "memory_b"
+ );
+ "synopsys" = @(
+ "std_logic_arith",
+ "std_logic_textio",
+ "std_logic_unsigned",
+ "std_logic_signed",
+ "std_logic_misc",
+ "std_logic_misc-body"
+ );
+ "mentor" = @(
+ "std_logic_arith",
+ "std_logic_arith_body"
+ )
+ }
+
+ Write-Host
+ Write-Host "Start compilation..."
+
+# ==============================================================================
+# v87
+# ==============================================================================
+ # create 'v87' directory if it does not exist
+ $LocalDirName = "v87"
+ $LocalDir = $VHDLDestLibraryDir + "\" + $LocalDirName
+ if (Test-Path -Path $LocalDir)
+ { if ($Script_EnableVerbose) { Write-Host " Directory '$LocalDirName' already exists." } }
+ else
+ { Write-Host " Creating directory '$LocalDirName'."
+ [void](New-Item -ItemType directory -Path $LocalDir -ErrorAction SilentlyContinue)
+ }
+
+ Write-Host " compiling into $LocalDirName"
+
+ # ----------------------------------------------------------------------
+ # v87\std
+ # ----------------------------------------------------------------------
+ if ($Script_ExitCode -eq 0)
+ { $VHDLDestLibrary = "std"
+
+ # create 'std' directory if it does not exist
+ $LocalDir2Name = $VHDLDestLibrary
+ $LocalDir2 = $LocalDir + "\" + $LocalDir2Name
+
+ Write-Host " compiling library $VHDLDestLibrary"
+ if (Test-Path -Path $LocalDir2)
+ { if ($Script_EnableVerbose) { Write-Host " Directory '$LocalDir2Name' already exists." } }
+ else
+ { Write-Host " Creating directory '$LocalDir2Name'."
+ [void](New-Item -ItemType Directory -Path $LocalDir2 -ErrorAction SilentlyContinue)
+ }
+
+ # change working directory to LocalDir2
+ Write-Host " cd $LocalDir2"
+ Set-Location $LocalDir2
+
+ $VHDLSrcLibrary = "std"
+ foreach ($SourceFile in $SourceFiles[$VHDLSrcLibrary])
+ { Write-Host " file: v87\$SourceFile.v87"
+ if ($Script_EnableVerbose) { Write-Host " ghdlfilter (-v87)" }
+ Get-Content "$VHDLSourceLibraryDir\$VHDLSrcLibrary\$SourceFile.vhdl" -Encoding Ascii -Raw
+ | & $GHDLFilterExecutable @('-v87')
+ | Out-File "$SourceFile.v87" -Encoding Ascii
+
+ #Write-Host "Press any key to continue..."
+ #[void]($Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown"))
+ #$Host.UI.RawUI.FlushInputBuffer()
+
+ $GHDLParameters = @("-a", "-C", "--std=87", "--bootstrap", "--work=$VHDLDestLibrary", "$SourceFile.v87")
+ if ($Script_EnableVerbose) { Write-Host (" ghdl analyse (" + ($GHDLParameters -join " ") + ")") }
+ & $GHDLExecutable $GHDLParameters
+ }
+ }
+
+ #$Script_ExitCode = 1
+
+ # ----------------------------------------------------------------------
+ # v87\ieee
+ # ----------------------------------------------------------------------
+ if ($Script_ExitCode -eq 0)
+ { $VHDLDestLibrary = "ieee"
+
+ # create 'ieee' directory if it does not exist
+ $LocalDir2Name = $VHDLDestLibrary
+ $LocalDir2 = $LocalDir + "\" + $LocalDir2Name
+
+ Write-Host " compiling library $VHDLDestLibrary"
+ if (Test-Path -Path $LocalDir2)
+ { if ($Script_EnableVerbose) { Write-Host " Directory '$LocalDir2Name' already exists." } }
+ else
+ { Write-Host " Creating directory '$LocalDir2Name'."
+ [void](New-Item -ItemType directory -Path $LocalDir2 -ErrorAction SilentlyContinue)
+ }
+
+ # change working directory to LocalDir2
+ Write-Host " cd $LocalDir2"
+ Set-Location $LocalDir2
+
+ $VHDLSrcLibrary = "ieee"
+ foreach ($SourceFile in $SourceFiles[$VHDLSrcLibrary])
+ { Write-Host " file: v87\$SourceFile.v87"
+ if ($Script_EnableVerbose) { Write-Host " ghdlfilter (-v87)" }
+ Get-Content "$VHDLSourceLibraryDir\$VHDLSrcLibrary\$SourceFile.vhdl" -Encoding Ascii -Raw | & $GHDLFilterExecutable @('-v87') | Out-File "$SourceFile.v87" -Encoding Ascii
+
+ $GHDLParameters = @("-a", "-C", "--std=87", "-P..\std", "--work=$VHDLDestLibrary", "$SourceFile.v87")
+ if ($Script_EnableVerbose) { Write-Host (" ghdl analyse (" + ($GHDLParameters -join " ") + ")") }
+ & $GHDLExecutable $GHDLParameters
+ }
+
+ $VHDLSrcLibrary = "vital95"
+ foreach ($SourceFile in $SourceFiles[$VHDLSrcLibrary])
+ { Write-Host " file: v87\$SourceFile.v87"
+ if ($Script_EnableVerbose) { Write-Host " copy: $SourceFile" }
+ Copy-Item "$VHDLSourceLibraryDir\$VHDLSrcLibrary\$SourceFile.vhdl" "$SourceFile.vhd"
+
+ $GHDLParameters = @("-a", "-C", "--std=87", "-P..\std", "--work=$VHDLDestLibrary", "$SourceFile.vhd")
+ if ($Script_EnableVerbose) { Write-Host (" ghdl analyse (" + ($GHDLParameters -join " ") + ")") }
+ & $GHDLExecutable $GHDLParameters
+ }
+ }
+
+ # ----------------------------------------------------------------------
+ # v87\synopsys
+ # ----------------------------------------------------------------------
+ if ($Script_ExitCode -eq 0)
+ { $VHDLDestLibrary = "ieee"
+
+ # create 'synopsys' directory if it does not exist
+ $LocalDir2Name = "synopsys"
+ $LocalDir2 = $LocalDir + "\" + $LocalDir2Name
+
+ Write-Host " compiling library $VHDLDestLibrary"
+ if (Test-Path -Path $LocalDir2)
+ { if ($Script_EnableVerbose) { Write-Host " Directory '$LocalDir2Name' already exists." } }
+ else
+ { Write-Host " Creating directory '$LocalDir2Name'."
+ [void](New-Item -ItemType directory -Path $LocalDir2 -ErrorAction SilentlyContinue)
+ }
+
+ # change working directory to LocalDir2
+ Write-Host " cd $LocalDir2"
+ Set-Location $LocalDir2
+
+ $VHDLSrcLibrary = "ieee"
+ foreach ($SourceFile in $SourceFiles[$VHDLSrcLibrary])
+ { Write-Host " file: v87\$SourceFile.v87"
+ if ($Script_EnableVerbose) { Write-Host " ghdlfilter (-v87)" }
+ Get-Content "$VHDLSourceLibraryDir\$VHDLSrcLibrary\$SourceFile.vhdl" -Encoding Ascii -Raw | & $GHDLFilterExecutable @('-v87') | Out-File "$SourceFile.v87" -Encoding Ascii
+
+ $GHDLParameters = @("-a", "-C", "--std=87", "-P..\std", "--work=$VHDLDestLibrary", "$SourceFile.v87")
+ if ($Script_EnableVerbose) { Write-Host (" ghdl analyse (" + ($GHDLParameters -join " ") + ")") }
+ & $GHDLExecutable $GHDLParameters
+ }
+
+ $VHDLSrcLibrary = "vital95"
+ foreach ($SourceFile in $SourceFiles[$VHDLSrcLibrary])
+ { Write-Host " file: v87\$SourceFile.v87"
+ if ($Script_EnableVerbose) { Write-Host " copy: $SourceFile" }
+ Copy-Item "$VHDLSourceLibraryDir\$VHDLSrcLibrary\$SourceFile.vhdl" "$SourceFile.vhd"
+
+ $GHDLParameters = @("-a", "-C", "--std=87", "-P..\std", "--work=$VHDLDestLibrary", "$SourceFile.vhd")
+ if ($Script_EnableVerbose) { Write-Host (" ghdl analyse (" + ($GHDLParameters -join " ") + ")") }
+ & $GHDLExecutable $GHDLParameters
+ }
+
+ $VHDLSrcLibrary = "synopsys"
+ foreach ($SourceFile in $SourceFiles[$VHDLSrcLibrary])
+ { Write-Host " file: v87\$SourceFile.v87"
+ if ($Script_EnableVerbose) { Write-Host " copy: $SourceFile" }
+ Copy-Item "$VHDLSourceLibraryDir\$VHDLSrcLibrary\$SourceFile.vhdl" "$SourceFile.vhd"
+
+ $GHDLParameters = @("-a", "-C", "--std=87", "-P..\std", "--work=$VHDLDestLibrary", "$SourceFile.vhd")
+ if ($Script_EnableVerbose) { Write-Host (" ghdl analyse (" + ($GHDLParameters -join " ") + ")") }
+ & $GHDLExecutable $GHDLParameters
+ }
+ }
+
+# ==============================================================================
+# v93
+# ==============================================================================
+ # create 'v93' directory if it does not exist
+ $LocalDirName = "v93"
+ $LocalDir = $VHDLDestLibraryDir + "\" + $LocalDirName
+ if (Test-Path -Path $LocalDir)
+ { Write-Host " Directory '$LocalDirName' already exists."}
+ else
+ { Write-Host " Creating directory '$LocalDirName'."
+ [void](New-Item -ItemType directory -Path $LocalDir -ErrorAction SilentlyContinue)
+ }
+
+ Write-Host " compiling into $LocalDirName"
+
+ # ----------------------------------------------------------------------
+ # v93\std
+ # ----------------------------------------------------------------------
+ if ($Script_ExitCode -eq 0)
+ { $VHDLDestLibrary = "std"
+
+ # create 'std' directory if it does not exist
+ $LocalDir2Name = $VHDLDestLibrary
+ $LocalDir2 = $LocalDir + "\" + $LocalDir2Name
+
+ Write-Host " compiling library $VHDLDestLibrary"
+ if (Test-Path -Path $LocalDir2)
+ { if ($Script_EnableVerbose) { Write-Host " Directory '$LocalDir2Name' already exists." } }
+ else
+ { Write-Host " Creating directory '$LocalDir2Name'."
+ [void](New-Item -ItemType directory -Path $LocalDir2 -ErrorAction SilentlyContinue)
+ }
+
+ # change working directory to LocalDir2
+ Write-Host " cd $LocalDir2"
+ Set-Location $LocalDir2
+
+ $VHDLSrcLibrary = "std"
+ foreach ($SourceFile in $SourceFiles[$VHDLSrcLibrary])
+ { Write-Host " file: v93\$SourceFile.v93"
+ if ($Script_EnableVerbose) { Write-Host " ghdlfilter (-v93)" }
+ Get-Content "$VHDLSourceLibraryDir\$VHDLSrcLibrary\$SourceFile.vhdl" -Encoding Ascii -Raw | & $GHDLFilterExecutable @('-v93') | Out-File "$SourceFile.v93" -Encoding Ascii
+
+ $GHDLParameters = @("-a", "-C", "--std=93", "--bootstrap", "--work=$VHDLDestLibrary", "$SourceFile.v93")
+ if ($Script_EnableVerbose) { Write-Host (" ghdl analyse (" + ($GHDLParameters -join " ") + ")") }
+ & $GHDLExecutable $GHDLParameters
+ }
+ }
+
+ # ----------------------------------------------------------------------
+ # v93\ieee
+ # ----------------------------------------------------------------------
+ if ($Script_ExitCode -eq 0)
+ { $VHDLDestLibrary = "ieee"
+
+ # create 'ieee' directory if it does not exist
+ $LocalDir2Name = $VHDLDestLibrary
+ $LocalDir2 = $LocalDir + "\" + $LocalDir2Name
+
+ Write-Host " compiling library $VHDLDestLibrary"
+ if (Test-Path -Path $LocalDir2)
+ { if ($Script_EnableVerbose) { Write-Host " Directory '$LocalDir2Name' already exists." } }
+ else
+ { Write-Host " Creating directory '$LocalDir2Name'."
+ [void](New-Item -ItemType directory -Path $LocalDir2 -ErrorAction SilentlyContinue)
+ }
+
+ # change working directory to LocalDir2
+ Write-Host " cd $LocalDir2"
+ Set-Location $LocalDir2
+
+ $VHDLSrcLibrary = "ieee"
+ foreach ($SourceFile in $SourceFiles[$VHDLSrcLibrary])
+ { Write-Host " file: v93\$SourceFile.v93"
+ if ($Script_EnableVerbose) { Write-Host " ghdlfilter (-v93)" }
+ Get-Content "$VHDLSourceLibraryDir\$VHDLSrcLibrary\$SourceFile.vhdl" -Encoding Ascii -Raw | & $GHDLFilterExecutable @('-v93') | Out-File "$SourceFile.v93" -Encoding Ascii
+
+ $GHDLParameters = @("-a", "-C", "--std=93", "-P..\std", "--work=$VHDLDestLibrary", "$SourceFile.v93")
+ if ($Script_EnableVerbose) { Write-Host (" ghdl analyse (" + ($GHDLParameters -join " ") + ")") }
+ & $GHDLExecutable $GHDLParameters
+ }
+
+ $VHDLSrcLibrary = "ieee"
+ foreach ($SourceFile in $SourceFiles['math'])
+ { Write-Host " file: v93\$SourceFile.v93"
+ if ($Script_EnableVerbose) { Write-Host " copy: $SourceFile" }
+ Copy-Item "$VHDLSourceLibraryDir\$VHDLSrcLibrary\$SourceFile.vhdl" "$SourceFile.vhd"
+
+ $GHDLParameters = @("-a", "-C", "--std=93", "-P..\std", "--work=$VHDLDestLibrary", "$SourceFile.vhd")
+ if ($Script_EnableVerbose) { Write-Host (" ghdl analyse (" + ($GHDLParameters -join " ") + ")") }
+ & $GHDLExecutable $GHDLParameters
+ }
+
+ $VHDLSrcLibrary = "vital2000"
+ foreach ($SourceFile in $SourceFiles[$VHDLSrcLibrary])
+ { Write-Host " file: v93\$SourceFile.v93"
+ if ($Script_EnableVerbose) { Write-Host " copy: $SourceFile" }
+ Copy-Item "$VHDLSourceLibraryDir\$VHDLSrcLibrary\$SourceFile.vhdl" "$SourceFile.vhd"
+
+ $GHDLParameters = @("-a", "-C", "--std=93", "-P..\std", "--work=$VHDLDestLibrary", "$SourceFile.vhd")
+ if ($Script_EnableVerbose) { Write-Host (" ghdl analyse (" + ($GHDLParameters -join " ") + ")") }
+ & $GHDLExecutable $GHDLParameters
+ }
+ }
+
+ # ----------------------------------------------------------------------
+ # v93\synopsys
+ # ----------------------------------------------------------------------
+ if ($Script_ExitCode -eq 0)
+ { $VHDLDestLibrary = "ieee"
+
+ # create 'synopsys' directory if it does not exist
+ $LocalDir2Name = "synopsys"
+ $LocalDir2 = $LocalDir + "\" + $LocalDir2Name
+
+ Write-Host " compiling library $VHDLDestLibrary"
+ if (Test-Path -Path $LocalDir2)
+ { if ($Script_EnableVerbose) { Write-Host " Directory '$LocalDir2Name' already exists." } }
+ else
+ { Write-Host " Creating directory '$LocalDir2Name'."
+ [void](New-Item -ItemType directory -Path $LocalDir2 -ErrorAction SilentlyContinue)
+ }
+
+ # change working directory to LocalDir2
+ Write-Host " cd $LocalDir2"
+ Set-Location $LocalDir2
+
+ $VHDLSrcLibrary = "ieee"
+ foreach ($SourceFile in $SourceFiles[$VHDLSrcLibrary])
+ { Write-Host " file: v93\$SourceFile.v93"
+ if ($Script_EnableVerbose) { Write-Host " ghdlfilter (-v93)" }
+ Get-Content "$VHDLSourceLibraryDir\$VHDLSrcLibrary\$SourceFile.vhdl" -Encoding Ascii -Raw | & $GHDLFilterExecutable @('-v93') | Out-File "$SourceFile.v93" -Encoding Ascii
+
+ $GHDLParameters = @("-a", "-C", "--std=93", "-P..\std", "--work=$VHDLDestLibrary", "$SourceFile.v93")
+ if ($Script_EnableVerbose) { Write-Host (" ghdl analyse (" + ($GHDLParameters -join " ") + ")") }
+ & $GHDLExecutable $GHDLParameters
+ }
+
+ $VHDLSrcLibrary = "ieee"
+ foreach ($SourceFile in $SourceFiles['math'])
+ { Write-Host " file: v93\$SourceFile.v93"
+ if ($Script_EnableVerbose) { Write-Host " copy: $SourceFile" }
+ Copy-Item "$VHDLSourceLibraryDir\$VHDLSrcLibrary\$SourceFile.vhdl" "$SourceFile.vhd"
+
+ $GHDLParameters = @("-a", "-C", "--std=93", "-P..\std", "--work=$VHDLDestLibrary", "$SourceFile.vhd")
+ if ($Script_EnableVerbose) { Write-Host (" ghdl analyse (" + ($GHDLParameters -join " ") + ")") }
+ & $GHDLExecutable $GHDLParameters
+ }
+
+ $VHDLSrcLibrary = "vital2000"
+ foreach ($SourceFile in $SourceFiles[$VHDLSrcLibrary])
+ { Write-Host " file: v93\$SourceFile.v93"
+ if ($Script_EnableVerbose) { Write-Host " copy: $SourceFile" }
+ Copy-Item "$VHDLSourceLibraryDir\$VHDLSrcLibrary\$SourceFile.vhdl" "$SourceFile.vhd"
+
+ $GHDLParameters = @("-a", "-C", "--std=93", "-P..\std", "--work=$VHDLDestLibrary", "$SourceFile.vhd")
+ if ($Script_EnableVerbose) { Write-Host (" ghdl analyse (" + ($GHDLParameters -join " ") + ")") }
+ & $GHDLExecutable $GHDLParameters
+ }
+
+ $VHDLSrcLibrary = "synopsys"
+ foreach ($SourceFile in $SourceFiles[$VHDLSrcLibrary])
+ { Write-Host " file: v93\$SourceFile.v93"
+ if ($Script_EnableVerbose) { Write-Host " copy: $SourceFile" }
+ Copy-Item "$VHDLSourceLibraryDir\$VHDLSrcLibrary\$SourceFile.vhdl" "$SourceFile.vhd"
+
+ $GHDLParameters = @("-a", "-C", "--std=93", "-P..\std", "--work=$VHDLDestLibrary", "$SourceFile.vhd")
+ if ($Script_EnableVerbose) { Write-Host (" ghdl analyse (" + ($GHDLParameters -join " ") + ")") }
+ & $GHDLExecutable $GHDLParameters
+ }
+ }
+
+ # ----------------------------------------------------------------------
+ # v93\mentor
+ # ----------------------------------------------------------------------
+ if ($Script_ExitCode -eq 0)
+ { $VHDLDestLibrary = "ieee"
+
+ # create 'mentor' directory if it does not exist
+ $LocalDir2Name = "mentor"
+ $LocalDir2 = $LocalDir + "\" + $LocalDir2Name
+
+ Write-Host " compiling library $VHDLDestLibrary"
+ if (Test-Path -Path $LocalDir2)
+ { if ($Script_EnableVerbose) { Write-Host " Directory '$LocalDir2Name' already exists." } }
+ else
+ { Write-Host " Creating directory '$LocalDir2Name'."
+ [void](New-Item -ItemType directory -Path $LocalDir2 -ErrorAction SilentlyContinue)
+ }
+
+ # change working directory to LocalDir2
+ Write-Host " cd $LocalDir2"
+ Set-Location $LocalDir2
+
+ $VHDLSrcLibrary = "ieee"
+ foreach ($SourceFile in $SourceFiles[$VHDLSrcLibrary])
+ { Write-Host " file: v93\$SourceFile.v93"
+ if ($Script_EnableVerbose) { Write-Host " ghdlfilter (-v93)" }
+ Get-Content "$VHDLSourceLibraryDir\$VHDLSrcLibrary\$SourceFile.vhdl" -Encoding Ascii -Raw | & $GHDLFilterExecutable @('-v93') | Out-File "$SourceFile.v93" -Encoding Ascii
+
+ $GHDLParameters = @("-a", "-C", "--std=93", "-P..\std", "--work=$VHDLDestLibrary", "$SourceFile.v93")
+ if ($Script_EnableVerbose) { Write-Host (" ghdl analyse (" + ($GHDLParameters -join " ") + ")") }
+ & $GHDLExecutable $GHDLParameters
+ }
+
+ $VHDLSrcLibrary = "ieee"
+ foreach ($SourceFile in $SourceFiles['math'])
+ { Write-Host " file: v93\$SourceFile.v93"
+ if ($Script_EnableVerbose) { Write-Host " copy: $SourceFile" }
+ Copy-Item "$VHDLSourceLibraryDir\$VHDLSrcLibrary\$SourceFile.vhdl" "$SourceFile.vhd"
+
+ $GHDLParameters = @("-a", "-C", "--std=93", "-P..\std", "--work=$VHDLDestLibrary", "$SourceFile.vhd")
+ if ($Script_EnableVerbose) { Write-Host (" ghdl analyse (" + ($GHDLParameters -join " ") + ")") }
+ & $GHDLExecutable $GHDLParameters
+ }
+
+ $VHDLSrcLibrary = "vital2000"
+ foreach ($SourceFile in $SourceFiles[$VHDLSrcLibrary])
+ { Write-Host " file: v93\$SourceFile.v93"
+ if ($Script_EnableVerbose) { Write-Host " copy: $SourceFile" }
+ Copy-Item "$VHDLSourceLibraryDir\$VHDLSrcLibrary\$SourceFile.vhdl" "$SourceFile.vhd"
+
+ $GHDLParameters = @("-a", "-C", "--std=93", "-P..\std", "--work=$VHDLDestLibrary", "$SourceFile.vhd")
+ if ($Script_EnableVerbose) { Write-Host (" ghdl analyse (" + ($GHDLParameters -join " ") + ")") }
+ & $GHDLExecutable $GHDLParameters
+ }
+
+ $VHDLSrcLibrary = "mentor"
+ foreach ($SourceFile in $SourceFiles[$VHDLSrcLibrary])
+ { Write-Host " file: v93\$SourceFile.v93"
+ if ($Script_EnableVerbose) { Write-Host " copy: $SourceFile" }
+ Copy-Item "$VHDLSourceLibraryDir\$VHDLSrcLibrary\$SourceFile.vhdl" "$SourceFile.vhd"
+
+ $GHDLParameters = @("-a", "-C", "--std=93", "-P..\std", "--work=$VHDLDestLibrary", "$SourceFile.vhd")
+ if ($Script_EnableVerbose) { Write-Host (" ghdl analyse (" + ($GHDLParameters -join " ") + ")") }
+ & $GHDLExecutable $GHDLParameters
+ }
+ }
+
+# ==============================================================================
+# v08
+# ==============================================================================
+ # create 'v08' directory if it does not exist
+ $LocalDirName = "v08"
+ $LocalDir = $VHDLDestLibraryDir + "\" + $LocalDirName
+ if (Test-Path -Path $LocalDir)
+ { Write-Host " Directory '$LocalDirName' already exists."}
+ else
+ { Write-Host " Creating directory '$LocalDirName'."
+ [void](New-Item -ItemType directory -Path $LocalDir -ErrorAction SilentlyContinue)
+ }
+
+ Write-Host " compiling into $LocalDirName"
+
+ # ----------------------------------------------------------------------
+ # v08\std
+ # ----------------------------------------------------------------------
+ if ($Script_ExitCode -eq 0)
+ { $VHDLDestLibrary = "std"
+
+ # create 'std' directory if it does not exist
+ $LocalDir2Name = $VHDLDestLibrary
+ $LocalDir2 = $LocalDir + "\" + $LocalDir2Name
+
+ Write-Host " compiling library $VHDLDestLibrary"
+ if (Test-Path -Path $LocalDir2)
+ { if ($Script_EnableVerbose) { Write-Host " Directory '$LocalDir2Name' already exists." } }
+ else
+ { Write-Host " Creating directory '$LocalDir2Name'."
+ [void](New-Item -ItemType directory -Path $LocalDir2 -ErrorAction SilentlyContinue)
+ }
+
+ # change working directory to LocalDir2
+ Write-Host " cd $LocalDir2"
+ Set-Location $LocalDir2
+
+ $VHDLSrcLibrary = "std"
+ foreach ($SourceFile in $SourceFiles[$VHDLSrcLibrary])
+ { Write-Host " file: v08\$SourceFile.v08"
+ if ($Script_EnableVerbose) { Write-Host " ghdlfilter (-v08)" }
+ Get-Content "$VHDLSourceLibraryDir\$VHDLSrcLibrary\$SourceFile.vhdl" -Encoding Ascii -Raw | & $GHDLFilterExecutable @('-v08') | Out-File "$SourceFile.v08" -Encoding Ascii
+
+ $GHDLParameters = @("-a", "-C", "--std=08", "--bootstrap", "--work=$VHDLDestLibrary", "$SourceFile.v08")
+ if ($Script_EnableVerbose) { Write-Host (" ghdl analyse (" + ($GHDLParameters -join " ") + ")") }
+ & $GHDLExecutable $GHDLParameters
+ }
+ }
+
+ # ----------------------------------------------------------------------
+ # v08\ieee
+ # ----------------------------------------------------------------------
+ if ($Script_ExitCode -eq 0)
+ { $VHDLDestLibrary = "ieee"
+
+ # create 'ieee' directory if it does not exist
+ $LocalDir2Name = $VHDLDestLibrary
+ $LocalDir2 = $LocalDir + "\" + $LocalDir2Name
+
+ Write-Host " compiling library $VHDLDestLibrary"
+ if (Test-Path -Path $LocalDir2)
+ { if ($Script_EnableVerbose) { Write-Host " Directory '$LocalDir2Name' already exists." } }
+ else
+ { Write-Host " Creating directory '$LocalDir2Name'."
+ [void](New-Item -ItemType directory -Path $LocalDir2 -ErrorAction SilentlyContinue)
+ }
+
+ # change working directory to LocalDir2
+ Write-Host " cd $LocalDir2"
+ Set-Location $LocalDir2
+
+ $VHDLSrcLibrary = "ieee2008"
+ foreach ($SourceFile in $SourceFiles[$VHDLSrcLibrary])
+ { Write-Host " file: v08\$SourceFile.v08"
+ if ($Script_EnableVerbose) { Write-Host " ghdlfilter (-v08)" }
+ Get-Content "$VHDLSourceLibraryDir\$VHDLSrcLibrary\$SourceFile.vhdl" -Encoding Ascii -Raw | & $GHDLFilterExecutable @('-v08') | Out-File "$SourceFile.v08" -Encoding Ascii
+
+ $GHDLParameters = @("-a", "-C", "--std=08", "-P..\std", "--work=$VHDLDestLibrary", "$SourceFile.v08")
+ if ($Script_EnableVerbose) { Write-Host (" ghdl analyse (" + ($GHDLParameters -join " ") + ")") }
+ & $GHDLExecutable $GHDLParameters
+ }
+
+ $VHDLSrcLibrary = "vital2000"
+ foreach ($SourceFile in $SourceFiles[$VHDLSrcLibrary])
+ { Write-Host " file: v08\$SourceFile.v08"
+ if ($Script_EnableVerbose) { Write-Host " copy: $SourceFile" }
+ Copy-Item "$VHDLSourceLibraryDir\$VHDLSrcLibrary\$SourceFile.vhdl" "$SourceFile.vhd"
+
+ $GHDLParameters = @("-a", "-C", "--std=08", "-P..\std", "--work=$VHDLDestLibrary", "$SourceFile.vhd")
+ if ($Script_EnableVerbose) { Write-Host (" ghdl analyse (" + ($GHDLParameters -join " ") + ")") }
+ & $GHDLExecutable $GHDLParameters
+ }
+ }
+# ==============================================================================
+# vXX
+# ==============================================================================
+ } # Compile
+else
+ { Write-Host "ERROR: missing argument(s)" -ForegroundColor Red
+ Write-Host
+ Write-Host "Usage:"
+ Write-Host " complib.ps1 [-Verbose] [-Debug] (-Help|-Compile|-Clean)" -ForegroundColor Gray
+ Write-Host
+ } # Unknown
+
+# restore working directory if changed
+Set-Location $Script_WorkingDir
+
+# return exit status
+exit $Script_ExitCode
\ No newline at end of file |