aboutsummaryrefslogtreecommitdiffstats
path: root/src/ghdldrv/ghdllocal.adb
diff options
context:
space:
mode:
Diffstat (limited to 'src/ghdldrv/ghdllocal.adb')
-rw-r--r--src/ghdldrv/ghdllocal.adb58
1 files changed, 58 insertions, 0 deletions
diff --git a/src/ghdldrv/ghdllocal.adb b/src/ghdldrv/ghdllocal.adb
index b2df3769f..bf9176b16 100644
--- a/src/ghdldrv/ghdllocal.adb
+++ b/src/ghdldrv/ghdllocal.adb
@@ -27,6 +27,8 @@ with Default_Paths;
with Errorout;
with Files_Map;
with Libraries;
+with Version;
+
with Vhdl.Sem_Lib;
with Vhdl.Std_Package;
with Vhdl.Scanner;
@@ -1789,6 +1791,62 @@ package body Ghdllocal is
end loop;
end Perform_Action;
+ -- Used by --gen-makefile
+ procedure Gen_Makefile_Disp_Header
+ is
+ use Ada.Command_Line;
+ begin
+ Put_Line ("# Makefile automatically generated by ghdl");
+ Put ("# Version: GHDL ");
+ Put (Version.Ghdl_Ver);
+ Put (' ');
+ Put (Version.Ghdl_Release);
+ Put (" - ");
+ if Version_String /= null then
+ Put (Version_String.all);
+ end if;
+ New_Line;
+ Put_Line ("# Command used to generate this makefile:");
+ Put ("# ");
+ Put (Command_Name);
+ for I in 1 .. Argument_Count loop
+ Put (' ');
+ Put (Argument (I));
+ end loop;
+ New_Line;
+ end Gen_Makefile_Disp_Header;
+
+ procedure Gen_Makefile_Disp_Variables
+ is
+ use Ada.Command_Line;
+ begin
+ Put ("GHDL=");
+ Put_Line (Command_Name);
+
+ -- Extract options for command line.
+ Put ("GHDLFLAGS=");
+ for I in 2 .. Argument_Count loop
+ declare
+ Arg : constant String := Argument (I);
+ begin
+ if Arg (1) = '-' then
+ if (Arg'Length > 10 and then Arg (1 .. 10) = "--workdir=")
+ or else (Arg'Length > 7 and then Arg (1 .. 7) = "--ieee=")
+ or else (Arg'Length > 6 and then Arg (1 .. 6) = "--std=")
+ or else (Arg'Length > 7 and then Arg (1 .. 7) = "--work=")
+ or else (Arg'Length > 2 and then Arg (1 .. 2) = "-P")
+ or else (Arg'Length > 2 and then Arg (1 .. 2) = "-f")
+ or else (Arg'Length > 6 and then Arg (1 .. 6) = "--std=")
+ then
+ Put (" ");
+ Put (Arg);
+ end if;
+ end if;
+ end;
+ end loop;
+ New_Line;
+ end Gen_Makefile_Disp_Variables;
+
procedure Register_Commands is
begin
Register_Command (new Command_Import);