aboutsummaryrefslogtreecommitdiffstats
path: root/src/ghdldrv
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2022-03-22 19:40:15 +0100
committerTristan Gingold <tgingold@free.fr>2022-03-22 19:40:37 +0100
commit98b2cfe1367dcc9f847add559d713272d3f27183 (patch)
tree44c29b3e7ee538010d1ec9963545697e2751c137 /src/ghdldrv
parentf06253fa91cbb6d086db1b937c38c56fa5f5178c (diff)
downloadghdl-98b2cfe1367dcc9f847add559d713272d3f27183.tar.gz
ghdl-98b2cfe1367dcc9f847add559d713272d3f27183.tar.bz2
ghdl-98b2cfe1367dcc9f847add559d713272d3f27183.zip
ghdldrv: extract ghdllib from ghdlsynth
Diffstat (limited to 'src/ghdldrv')
-rw-r--r--src/ghdldrv/ghdl_gcc.adb2
-rw-r--r--src/ghdldrv/ghdl_jit.adb2
-rw-r--r--src/ghdldrv/ghdl_llvm.adb2
-rw-r--r--src/ghdldrv/ghdllib.adb90
-rw-r--r--src/ghdldrv/ghdllib.ads19
-rw-r--r--src/ghdldrv/ghdlsynth.adb63
6 files changed, 115 insertions, 63 deletions
diff --git a/src/ghdldrv/ghdl_gcc.adb b/src/ghdldrv/ghdl_gcc.adb
index 86945c7c7..ce39bc830 100644
--- a/src/ghdldrv/ghdl_gcc.adb
+++ b/src/ghdldrv/ghdl_gcc.adb
@@ -19,6 +19,7 @@ with Ghdldrv;
with Ghdlprint;
with Ghdlvpi;
with Ghdlxml;
+with Ghdllib;
with Ghdlsynth_Maybe;
procedure Ghdl_Gcc is
@@ -33,6 +34,7 @@ begin
Ghdlprint.Register_Commands;
Ghdlvpi.Register_Commands;
Ghdlxml.Register_Commands;
+ Ghdllib.Register_Commands;
Ghdlmain.Register_Commands;
Ghdlmain.Main;
end Ghdl_Gcc;
diff --git a/src/ghdldrv/ghdl_jit.adb b/src/ghdldrv/ghdl_jit.adb
index 29734acff..7bc517c04 100644
--- a/src/ghdldrv/ghdl_jit.adb
+++ b/src/ghdldrv/ghdl_jit.adb
@@ -19,6 +19,7 @@ with Ghdlprint;
with Ghdlrun;
with Ghdlvpi;
with Ghdlxml;
+with Ghdllib;
with Ghdlsynth_Maybe;
with Ortho_Jit;
@@ -34,6 +35,7 @@ begin
Ghdlvpi.Register_Commands;
Ghdlxml.Register_Commands;
Ghdlsynth_Maybe.Register_Commands;
+ Ghdllib.Register_Commands;
Ghdlmain.Register_Commands;
Ghdlmain.Main;
end Ghdl_Jit;
diff --git a/src/ghdldrv/ghdl_llvm.adb b/src/ghdldrv/ghdl_llvm.adb
index cec0a62b8..036d71c0c 100644
--- a/src/ghdldrv/ghdl_llvm.adb
+++ b/src/ghdldrv/ghdl_llvm.adb
@@ -19,6 +19,7 @@ with Ghdlprint;
with Ghdldrv;
with Ghdlvpi;
with Ghdlxml;
+with Ghdllib;
with Ghdlsynth_Maybe;
procedure Ghdl_Llvm is
@@ -33,6 +34,7 @@ begin
Ghdlprint.Register_Commands;
Ghdlvpi.Register_Commands;
Ghdlxml.Register_Commands;
+ Ghdllib.Register_Commands;
Ghdlmain.Register_Commands;
Ghdlmain.Main;
end Ghdl_Llvm;
diff --git a/src/ghdldrv/ghdllib.adb b/src/ghdldrv/ghdllib.adb
new file mode 100644
index 000000000..a96877968
--- /dev/null
+++ b/src/ghdldrv/ghdllib.adb
@@ -0,0 +1,90 @@
+-- GHDL driver for synthesis
+-- Copyright (C) 2016 Tristan Gingold
+--
+-- This program 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 of the License, or
+-- (at your option) any later version.
+--
+-- This program 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 this program. If not, see <gnu.org/licenses>.
+
+with GNAT.OS_Lib; use GNAT.OS_Lib;
+
+with Ghdllocal; use Ghdllocal;
+with Ghdlmain; use Ghdlmain;
+with Version;
+with Default_Paths;
+
+package body Ghdllib is
+
+ function Get_Libghdl_Name return String
+ is
+ Libghdl_Version : String := Version.Ghdl_Ver;
+ begin
+ for I in Libghdl_Version'Range loop
+ if Libghdl_Version (I) = '.' or Libghdl_Version (I) = '-' then
+ Libghdl_Version (I) := '_';
+ end if;
+ end loop;
+ return "libghdl-" & Libghdl_Version
+ & Default_Paths.Shared_Library_Extension;
+ end Get_Libghdl_Name;
+
+ function Get_Libghdl_Path return String is
+ begin
+ if Ghdllocal.Exec_Prefix = null then
+ -- Compute install path (only once).
+ Ghdllocal.Set_Exec_Prefix_From_Program_Name;
+ end if;
+
+ return Ghdllocal.Exec_Prefix.all & Directory_Separator
+ & Default_Paths.LibDir_Suffix
+ & Directory_Separator & Get_Libghdl_Name;
+ end Get_Libghdl_Path;
+
+ function Get_Libghdl_Include_Dir return String is
+ begin
+ -- Compute install path
+ Ghdllocal.Set_Exec_Prefix_From_Program_Name;
+
+ return Ghdllocal.Exec_Prefix.all & Directory_Separator
+ & Default_Paths.IncDir_Suffix;
+ end Get_Libghdl_Include_Dir;
+
+ procedure Register_Commands is
+ begin
+ Register_Command
+ (new Command_Str_Disp'
+ (Command_Type with
+ Cmd_Str => new String'
+ ("--libghdl-name"),
+ Help_Str => new String'
+ ("--libghdl-name"
+ & ASCII.LF & " Display libghdl name"),
+ Disp => Get_Libghdl_Name'Access));
+ Register_Command
+ (new Command_Str_Disp'
+ (Command_Type with
+ Cmd_Str => new String'
+ ("--libghdl-library-path"),
+ Help_Str => new String'
+ ("--libghdl-library-path"
+ & ASCII.LF & " Display libghdl library path"),
+ Disp => Get_Libghdl_Path'Access));
+ Register_Command
+ (new Command_Str_Disp'
+ (Command_Type with
+ Cmd_Str => new String'
+ ("--libghdl-include-dir"),
+ Help_Str => new String'
+ ("--libghdl-include-dir"
+ & ASCII.LF & " Display libghdl include directory"),
+ Disp => Get_Libghdl_Include_Dir'Access));
+ end Register_Commands;
+end Ghdllib;
diff --git a/src/ghdldrv/ghdllib.ads b/src/ghdldrv/ghdllib.ads
new file mode 100644
index 000000000..9544625e1
--- /dev/null
+++ b/src/ghdldrv/ghdllib.ads
@@ -0,0 +1,19 @@
+-- GHDL driver for synthesis
+-- Copyright (C) 2016 Tristan Gingold
+--
+-- This program 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 of the License, or
+-- (at your option) any later version.
+--
+-- This program 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 this program. If not, see <gnu.org/licenses>.
+
+package Ghdllib is
+ procedure Register_Commands;
+end Ghdllib;
diff --git a/src/ghdldrv/ghdlsynth.adb b/src/ghdldrv/ghdlsynth.adb
index cafecbb57..19b8cf9ff 100644
--- a/src/ghdldrv/ghdlsynth.adb
+++ b/src/ghdldrv/ghdlsynth.adb
@@ -25,8 +25,6 @@ with Ghdlmain; use Ghdlmain;
with Options; use Options;
with Errorout;
with Errorout.Console;
-with Version;
-with Default_Paths;
with Bug;
with Simple_IO;
@@ -561,70 +559,9 @@ package body Ghdlsynth is
end if;
end Perform_Action;
- function Get_Libghdl_Name return String
- is
- Libghdl_Version : String := Version.Ghdl_Ver;
- begin
- for I in Libghdl_Version'Range loop
- if Libghdl_Version (I) = '.' or Libghdl_Version (I) = '-' then
- Libghdl_Version (I) := '_';
- end if;
- end loop;
- return "libghdl-" & Libghdl_Version
- & Default_Paths.Shared_Library_Extension;
- end Get_Libghdl_Name;
-
- function Get_Libghdl_Path return String is
- begin
- if Ghdllocal.Exec_Prefix = null then
- -- Compute install path (only once).
- Ghdllocal.Set_Exec_Prefix_From_Program_Name;
- end if;
-
- return Ghdllocal.Exec_Prefix.all & Directory_Separator
- & Default_Paths.LibDir_Suffix
- & Directory_Separator & Get_Libghdl_Name;
- end Get_Libghdl_Path;
-
- function Get_Libghdl_Include_Dir return String is
- begin
- -- Compute install path
- Ghdllocal.Set_Exec_Prefix_From_Program_Name;
-
- return Ghdllocal.Exec_Prefix.all & Directory_Separator
- & Default_Paths.IncDir_Suffix;
- end Get_Libghdl_Include_Dir;
-
procedure Register_Commands is
begin
Ghdlmain.Register_Command (new Command_Synth);
- Register_Command
- (new Command_Str_Disp'
- (Command_Type with
- Cmd_Str => new String'
- ("--libghdl-name"),
- Help_Str => new String'
- ("--libghdl-name"
- & ASCII.LF & " Display libghdl name"),
- Disp => Get_Libghdl_Name'Access));
- Register_Command
- (new Command_Str_Disp'
- (Command_Type with
- Cmd_Str => new String'
- ("--libghdl-library-path"),
- Help_Str => new String'
- ("--libghdl-library-path"
- & ASCII.LF & " Display libghdl library path"),
- Disp => Get_Libghdl_Path'Access));
- Register_Command
- (new Command_Str_Disp'
- (Command_Type with
- Cmd_Str => new String'
- ("--libghdl-include-dir"),
- Help_Str => new String'
- ("--libghdl-include-dir"
- & ASCII.LF & " Display libghdl include directory"),
- Disp => Get_Libghdl_Include_Dir'Access));
end Register_Commands;
procedure Init_For_Ghdl_Synth is