From 17450f134e39ffa345eab48dd9aec6127a893946 Mon Sep 17 00:00:00 2001 From: gingold Date: Mon, 2 Oct 2006 04:18:48 +0000 Subject: support of GHDL_PREFIX env variable, use ghdl_release instead of ghdl_version --- translate/ghdldrv/ghdlcomp.adb | 22 +++++++++++++++++++--- translate/ghdldrv/ghdldrv.adb | 20 +++++++++++++++++++- translate/ghdldrv/ghdllocal.adb | 17 +++++++++++++++-- translate/ghdldrv/ghdllocal.ads | 3 +++ translate/ghdldrv/ghdlmain.adb | 2 +- translate/ghdldrv/ghdlprint.adb | 2 +- 6 files changed, 58 insertions(+), 8 deletions(-) (limited to 'translate/ghdldrv') diff --git a/translate/ghdldrv/ghdlcomp.adb b/translate/ghdldrv/ghdlcomp.adb index eb8990856..a3895f9a0 100644 --- a/translate/ghdldrv/ghdlcomp.adb +++ b/translate/ghdldrv/ghdlcomp.adb @@ -33,6 +33,7 @@ with Libraries; with Std_Package; with Files_Map; with Version; +with Default_Pathes; package body Ghdlcomp is @@ -465,9 +466,24 @@ package body Ghdlcomp is raise Errorout.Option_Error; end if; + Put ("command line prefix (--PREFIX): "); + if Prefix_Path = null then + Put_Line ("(not set)"); + else + Put_Line (Prefix_Path.all); + end if; Setup_Libraries (False); - Put ("library directory: "); - Put_Line (Prefix_Path.all); + + Put ("environment prefix (GHDL_PREFIX): "); + if Prefix_Env = null then + Put_Line ("(not set)"); + else + Put_Line (Prefix_Env.all); + end if; + + Put_Line ("default prefix: " & Default_Pathes.Prefix); + Put_Line ("actual prefix: " & Prefix_Path.all); + Put_Line ("command_name: " & Ada.Command_Line.Command_Name); Put_Line ("default library pathes:"); for I in 2 .. Get_Nbr_Pathes loop Put (' '); @@ -596,7 +612,7 @@ package body Ghdlcomp is Put_Line ("# Makefile automatically generated by ghdl"); Put ("# Version: "); - Put (Version.Ghdl_Version); + Put (Version.Ghdl_Release); Put (" - "); if Version_String /= null then Put (Version_String.all); diff --git a/translate/ghdldrv/ghdldrv.adb b/translate/ghdldrv/ghdldrv.adb index 14e61299a..52b7e5aa3 100644 --- a/translate/ghdldrv/ghdldrv.adb +++ b/translate/ghdldrv/ghdldrv.adb @@ -741,7 +741,25 @@ package body Ghdldrv is end if; Put ("linker command: "); Put_Line (Linker_Cmd); + + Put ("command line prefix (--PREFIX): "); + if Prefix_Path = null then + Put_Line ("(not set)"); + else + Put_Line (Prefix_Path.all); + end if; Setup_Libraries (False); + + Put ("environment prefix (GHDL_PREFIX): "); + if Prefix_Env = null then + Put_Line ("(not set)"); + else + Put_Line (Prefix_Env.all); + end if; + + Put_Line ("default prefix: " & Default_Pathes.Prefix); + Put_Line ("actual prefix: " & Prefix_Path.all); + Put ("library directory: "); Put_Line (Get_Machine_Path_Prefix); Locate_Tools; @@ -1572,7 +1590,7 @@ package body Ghdldrv is Put_Line ("# Makefile automatically generated by ghdl"); Put ("# Version: "); - Put (Version.Ghdl_Version); + Put (Version.Ghdl_Release); Put (" - "); if Version_String /= null then Put (Version_String.all); diff --git a/translate/ghdldrv/ghdllocal.adb b/translate/ghdldrv/ghdllocal.adb index 9eccdcf5d..fb8f5f6d0 100644 --- a/translate/ghdldrv/ghdllocal.adb +++ b/translate/ghdldrv/ghdllocal.adb @@ -177,7 +177,7 @@ package body Ghdllocal is function Get_Machine_Path_Prefix return String is begin if Flag_32bit then - return Prefix_Path.all & "32" & Directory_Separator; + return Prefix_Path.all & "32"; else return Prefix_Path.all; end if; @@ -187,13 +187,26 @@ package body Ghdllocal is is begin Libraries.Add_Library_Path - (Get_Machine_Path_Prefix & Get_Version_Path & Directory_Separator + (Get_Machine_Path_Prefix & Directory_Separator + & Get_Version_Path & Directory_Separator & Name & Directory_Separator); end Add_Library_Path; procedure Setup_Libraries (Load : Boolean) is begin + -- Get environment variable. + Prefix_Env := GNAT.OS_Lib.Getenv ("GHDL_PREFIX"); + if Prefix_Env = null or else Prefix_Env.all = "" then + Prefix_Env := null; + end if; + + -- Set prefix path. + -- If not set by command line, try environment variable. + if Prefix_Path = null then + Prefix_Path := Prefix_Env; + end if; + -- Else try default path. if Prefix_Path = null then Prefix_Path := new String'(Default_Pathes.Prefix); else diff --git a/translate/ghdldrv/ghdllocal.ads b/translate/ghdldrv/ghdllocal.ads index 817cc8fd5..f55503a5d 100644 --- a/translate/ghdldrv/ghdllocal.ads +++ b/translate/ghdldrv/ghdllocal.ads @@ -53,6 +53,9 @@ package Ghdllocal is -- Path prefix for libraries. Prefix_Path : String_Access := null; + -- getenv ("GHDL_PREFIX"). Set by Setup_Libraries. + Prefix_Env : String_Access := null; + Nul : constant Character := Character'Val (0); -- Return FILENAME without the extension. diff --git a/translate/ghdldrv/ghdlmain.adb b/translate/ghdldrv/ghdlmain.adb index 88752795c..0c2f39ae0 100644 --- a/translate/ghdldrv/ghdlmain.adb +++ b/translate/ghdldrv/ghdlmain.adb @@ -216,7 +216,7 @@ package body Ghdlmain is pragma Unreferenced (Cmd); use Ada.Text_IO; begin - Put_Line (Version.Ghdl_Version); + Put_Line (Version.Ghdl_Release); Put_Line (" Compiled with " & Bug.Get_Gnat_Version); if Version_String /= null then Put (" "); diff --git a/translate/ghdldrv/ghdlprint.adb b/translate/ghdldrv/ghdlprint.adb index d9de2df86..45750efeb 100644 --- a/translate/ghdldrv/ghdlprint.adb +++ b/translate/ghdldrv/ghdlprint.adb @@ -475,7 +475,7 @@ package body Ghdlprint is Put_Line ("

"); Put ("This page was generated using "); Put (""); - Put (Version.Ghdl_Version); + Put (Version.Ghdl_Release); Put (", a program written by"); Put (" Tristan Gingold"); New_Line; -- cgit v1.2.3