diff options
author | Tristan Gingold <tgingold@free.fr> | 2021-10-04 04:42:33 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2021-10-04 04:42:33 +0200 |
commit | af7c36fb9d32653e08fc99550b5eddce080202a7 (patch) | |
tree | ae0b4f946412d7edb869d547bd5e5287ba2d806e | |
parent | bd7df2697ac927ff200c1d3af4035cb8572d0dcf (diff) | |
download | ghdl-af7c36fb9d32653e08fc99550b5eddce080202a7.tar.gz ghdl-af7c36fb9d32653e08fc99550b5eddce080202a7.tar.bz2 ghdl-af7c36fb9d32653e08fc99550b5eddce080202a7.zip |
elab-order command: add an option to display libraries. Fix #1736
-rw-r--r-- | doc/using/InvokingGHDL.rst | 20 | ||||
-rw-r--r-- | src/ghdldrv/ghdllocal.adb | 31 |
2 files changed, 39 insertions, 12 deletions
diff --git a/doc/using/InvokingGHDL.rst b/doc/using/InvokingGHDL.rst index f7ea85418..b50f98626 100644 --- a/doc/using/InvokingGHDL.rst +++ b/doc/using/InvokingGHDL.rst @@ -232,14 +232,18 @@ Elab-order [``--elab-order``] .. option:: --elab-order <[options...] [libray.]top_unit [arch]> -Print the list of sources required for elaborating a unit, in order for them to be analyzed without dependency issues. -This is expected to be used after :option:`-i`, or for retrieving the order for some unit analyzed through third-party -scripts. - -.. ATTENTION:: - Currently, the list does not include information about the logical library names where each source needs to be - analyzed. - Hence, it is mostly useful when all sources belong to the same ``WORK`` library. +Print the list of sources required for elaborating a unit, in order +for them to be analyzed without dependency issues. This is expected +to be used after :option:`-i`, or for retrieving the order for some +unit analyzed through third-party scripts. + +With the :option:`--libraries` option, each line contains first the +library name followed by the file name. + +Without the :option:`--libraries` option, the list does not include +information about the logical library names where each source needs +to be analyzed. Hence, it is useful when all sources belong +to the same ``WORK`` library. .. index:: cmd make diff --git a/src/ghdldrv/ghdllocal.adb b/src/ghdldrv/ghdllocal.adb index 47758d2d1..4e0b0b05b 100644 --- a/src/ghdldrv/ghdllocal.adb +++ b/src/ghdldrv/ghdllocal.adb @@ -1856,9 +1856,15 @@ package body Ghdllocal is end Expect_Filenames; -- Command Elab_Order. - type Command_Elab_Order is new Command_Lib with null record; + type Command_Elab_Order is new Command_Lib with record + Flag_Libraries : Boolean := False; + end record; function Decode_Command (Cmd : Command_Elab_Order; Name : String) return Boolean; + procedure Decode_Option (Cmd : in out Command_Elab_Order; + Option : String; + Arg : String; + Res : out Option_State); function Get_Short_Help (Cmd : Command_Elab_Order) return String; procedure Perform_Action (Cmd : in out Command_Elab_Order; Args : Argument_List); @@ -1876,11 +1882,26 @@ package body Ghdllocal is is pragma Unreferenced (Cmd); begin - return "elab-order [OPTS] UNIT [ARCH]" + return "elab-order [--libraries] [OPTS] UNIT [ARCH]" & ASCII.LF & " Display ordered source files" & ASCII.LF & " alias: --elab-order"; end Get_Short_Help; + procedure Decode_Option (Cmd : in out Command_Elab_Order; + Option : String; + Arg : String; + Res : out Option_State) + is + pragma Assert (Option'First = 1); + begin + if Option = "--libraries" then + Cmd.Flag_Libraries := True; + Res := Option_Ok; + else + Decode_Option (Command_Lib (Cmd), Option, Arg, Res); + end if; + end Decode_Option; + function Is_Makeable_File (File : Iir_Design_File) return Boolean is begin if File = Vhdl.Std_Package.Std_Standard_File then @@ -1892,7 +1913,6 @@ package body Ghdllocal is procedure Perform_Action (Cmd : in out Command_Elab_Order; Args : Argument_List) is - pragma Unreferenced (Cmd); use Name_Table; Lib_Id : Name_Id; @@ -1925,7 +1945,10 @@ package body Ghdllocal is -- Builtin file. null; else - -- Lib := Get_Library (File); + if Cmd.Flag_Libraries then + Put (Image (Get_Identifier (Get_Library (File)))); + Put (' '); + end if; Put (Image (Get_Design_File_Filename (File))); New_Line; end if; |