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 /src/ghdldrv | |
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
Diffstat (limited to 'src/ghdldrv')
-rw-r--r-- | src/ghdldrv/ghdllocal.adb | 31 |
1 files changed, 27 insertions, 4 deletions
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; |