mirror of
https://github.com/vishapoberon/compiler.git
synced 2026-04-06 15:42:25 +00:00
fixed issue with multiple modules compilation.
now voc adds dependency modules object files to the main module
compiling command line.
for example, if MM0 imports MM1 then if we call voc like:
voc -l MM1.Mod -s MM0.Mod -M
the commandline will look like
cc MM0.c MM1.o -static -o MM0 -fPIC -g -I /opt/voc-1.0/src/lib/system/gnuc/x86_64 -I /opt/voc-1.0/lib/voc/obj -lVishapOberon -L. -L/opt/voc-1.0/lib
Former-commit-id: a3214b8154
This commit is contained in:
parent
d858f133f8
commit
745b4851ca
4 changed files with 32 additions and 18 deletions
|
|
@ -4,7 +4,7 @@ MODULE voc; (* J. Templ 3.2.95 *)
|
|||
SYSTEM, Unix, Kernel,
|
||||
OPP, OPB, OPT,
|
||||
OPV, OPC, OPM,
|
||||
extTools;
|
||||
extTools, Strings := oocOakStrings;
|
||||
|
||||
VAR mname : ARRAY 256 OF CHAR; (* noch *)
|
||||
|
||||
|
|
@ -62,26 +62,15 @@ VAR mname : ARRAY 256 OF CHAR; (* noch *)
|
|||
OPM.CloseFiles; OPT.Close;
|
||||
OPM.LogWLn; done := OPM.noerr;
|
||||
|
||||
(* noch *)
|
||||
IF done THEN
|
||||
IF ~OPM.dontAsm THEN
|
||||
(*IF ~(OPM.mainProg OR OPM.mainLinkStat) THEN*)
|
||||
extTools.Assemble(OPM.modName);
|
||||
(*ELSE*)
|
||||
IF ~OPM.dontLink & (OPM.mainProg OR OPM.mainLinkStat) THEN
|
||||
extTools.LinkMain (OPM.modName, OPM.mainLinkStat);
|
||||
END;
|
||||
(*END;*)
|
||||
END;
|
||||
END
|
||||
|
||||
|
||||
|
||||
END Module;
|
||||
|
||||
PROCEDURE Translate*;
|
||||
VAR done: BOOLEAN;
|
||||
VAR modulesobj: ARRAY 2048 OF CHAR; (* here we hold all modules name given on the command line, to add corresponding .o files to the external compiler options *)
|
||||
BEGIN
|
||||
modulesobj := "";
|
||||
OPM.OpenPar; (* gclock(); slightly faste rtranslation but may lead to opening "too many files" *)
|
||||
OPT.bytetyp.size := OPM.ByteSize;
|
||||
OPT.sysptrtyp.size := OPM.PointerSize;
|
||||
|
|
@ -99,8 +88,24 @@ VAR mname : ARRAY 256 OF CHAR; (* noch *)
|
|||
OPM.InitOptions;
|
||||
Kernel.GC(FALSE);
|
||||
Module(done);
|
||||
IF ~done THEN Unix.Exit(1) END
|
||||
END
|
||||
IF ~done THEN Unix.Exit(1) END;
|
||||
|
||||
(* noch *)
|
||||
IF done THEN
|
||||
IF ~OPM.dontAsm THEN
|
||||
extTools.Assemble(OPM.modName);
|
||||
IF ~(OPM.mainProg OR OPM.mainLinkStat) THEN Strings.Append(" ",modulesobj); Strings.Append(OPM.modName, modulesobj); Strings.Append(".o ", modulesobj) END;
|
||||
|
||||
IF ~OPM.dontLink & (OPM.mainProg OR OPM.mainLinkStat) THEN
|
||||
extTools.LinkMain (OPM.modName, OPM.mainLinkStat, modulesobj);
|
||||
END;
|
||||
END;
|
||||
END
|
||||
|
||||
|
||||
|
||||
|
||||
END (* loop *)
|
||||
END Translate;
|
||||
|
||||
BEGIN
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue