I share some modifications I've done to "--gen-makefile" command
Two features added:
1) handle the "--workdir" argument to not have to run the makefile from
the work directory
2) generate the simulation executable in the workdir too
--- vhdl/ghdldrv/ghdldrv.adb 2009-04-02 05:41:46.000000000 +0200
+++ vhdl/ghdldrv/ghdldrv.adb 2008-12-18 14:42:51.000000000 +0100
@@ -1578,6 +1578,8 @@
Dep_List : Iir_List;
Dep_File : Iir;
+ Work_Dir_Arg:String_Access:=new String'("");
+ Current_Work_Dir:String_Access:=new String'("");
begin
Set_Elab_Units ("--gen-makefile", Args);
Setup_Libraries (True);
@@ -1612,6 +1614,13 @@
Arg : constant String := Argument (I);
begin
if Arg (1) = '-' then
+ if (Arg'Length > 10 and then Arg (1 .. 10) = "--workdir=")then
+ Current_Work_Dir:= new String'(Arg(11 .. Arg'Length));
+ if Current_Work_Dir(Current_Work_Dir'Length)/='/' then
+ Current_Work_Dir:=new String'(Current_Work_Dir.all & "/");
+ end if;
+ Work_Dir_Arg:=new String'(Arg);
+ end if;
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=")
@@ -1634,6 +1643,7 @@
New_Line;
Put_Line ("# Elaboration target");
+ Put (Current_Work_Dir.all);
Put (Base_Name.all);
Put (":");
for I in Natural loop
@@ -1645,7 +1655,8 @@
end if;
end loop;
New_Line;
- Put_Line (HT & "$(GHDL) -e $(GHDLFLAGS) $@");
+ Put(HT & "$(GHDL) -e ");
+ Put(Work_Dir_Arg.all & " $(GHDLFLAGS) -o $@ " & Base_Name.all);
New_Line;
Put_Line ("# Run target");
@@ -1689,6 +1700,8 @@
else
Put (Image (Dir_Id));
end if;
+ else
+ Put(" " & Work_Dir_Arg.all & " ");
end if;
Put_Line (" $<");
end if;
_______________________________________________
Ghdl-discuss mailing list
[email protected]
https://mail.gna.org/listinfo/ghdl-discuss