mirror of
https://github.com/vishapoberon/compiler.git
synced 2026-04-06 12:12:25 +00:00
initial of OpenBSD changes for voc on X86_64
Former-commit-id: 0170d2b442
This commit is contained in:
parent
5305dbaa89
commit
7d3258c2f2
12 changed files with 3413 additions and 0 deletions
88
src/voc/openbsd/gcc/extTools.Mod
Normal file
88
src/voc/openbsd/gcc/extTools.Mod
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
MODULE extTools;
|
||||
IMPORT Args, Unix, Strings, Console, version;
|
||||
(*
|
||||
INCLUDEPATH = -Isrc/lib/system/gnuc/x86_64
|
||||
CCOPT = -fPIC $(INCLUDEPATH) -g
|
||||
CLOBERONOPTS = -fPIC $(INCLUDEPATH) -L. -L/usr/lib -lOberon -static -g
|
||||
CC = cc $(CCOPT) -c
|
||||
*)
|
||||
CONST compiler="gcc";
|
||||
|
||||
VAR incPath0, incPath1, ccOpt, ccString, CFLAGS, tmp0, tmp1 : ARRAY 1023 OF CHAR;
|
||||
|
||||
PROCEDURE Assemble*(m : ARRAY OF CHAR);
|
||||
VAR cmd : ARRAY 1023 OF CHAR;
|
||||
cc : ARRAY 1023 OF CHAR;
|
||||
ext : ARRAY 5 OF CHAR;
|
||||
BEGIN
|
||||
COPY (ccString, cc);
|
||||
Strings.Append (" -c ", cc);
|
||||
COPY(cc, cmd);
|
||||
Strings.Append (" ", cmd);
|
||||
Strings.Append (ccOpt, cmd);
|
||||
ext := ".c";
|
||||
Strings.Append (ext, m);
|
||||
Strings.Append(m, cmd);
|
||||
(*Console.Ln; Console.String (cmd); Console.Ln;*)
|
||||
Unix.system(cmd);
|
||||
END Assemble;
|
||||
|
||||
|
||||
PROCEDURE LinkMain*(VAR m : ARRAY OF CHAR; statically : BOOLEAN; additionalopts : ARRAY OF CHAR);
|
||||
VAR lpath : ARRAY 1023 OF CHAR;
|
||||
cc : ARRAY 1023 OF CHAR;
|
||||
ccopt : ARRAY 1023 OF CHAR;
|
||||
cmd : ARRAY 1023 OF CHAR;
|
||||
ext : ARRAY 5 OF CHAR;
|
||||
BEGIN
|
||||
(*
|
||||
gcc -g -o hello hello.c -I $RPATH/src/lib/system/gnuc/x86_64 -I. -I$RPATH -lOberon -L. -L$RPATH -static
|
||||
*)
|
||||
cmd := "";
|
||||
cc := "";
|
||||
ext := ".c";
|
||||
COPY(ccString, cc);
|
||||
COPY (cc, cmd);
|
||||
Strings.Append(" ", cmd);
|
||||
Strings.Append(m, cmd);
|
||||
Strings.Append(ext, cmd);
|
||||
Strings.Append(additionalopts, cmd);
|
||||
IF statically THEN Strings.Append(" -static ", cmd) END;
|
||||
Strings.Append(" -o ", cmd);
|
||||
Strings.Append(m, cmd);
|
||||
Strings.Append(" ", cmd);
|
||||
|
||||
Strings.Append (" -lVishapOberon -L. -L", ccOpt);
|
||||
Strings.Append (version.prefix, ccOpt);
|
||||
Strings.Append ("/lib ", ccOpt);
|
||||
|
||||
Strings.Append(ccOpt, cmd);
|
||||
Console.Ln; Console.String(cmd); Console.Ln; (* may be it's feasible to add debug mode later *)
|
||||
Unix.system(cmd);
|
||||
END LinkMain;
|
||||
|
||||
BEGIN
|
||||
|
||||
incPath0 := "src/lib/system/linux/";
|
||||
Strings.Append (compiler, incPath0);
|
||||
incPath1 := "lib/voc/obj ";
|
||||
ccOpt := " -fPIC -g ";
|
||||
|
||||
COPY ("-I ", tmp1);
|
||||
Strings.Append (version.prefix, tmp1);
|
||||
Strings.Append("/", tmp1);
|
||||
Strings.Append(incPath0, tmp1);
|
||||
Strings.Append("/", tmp1);
|
||||
Strings.Append(version.arch, tmp1);
|
||||
Strings.Append(" -I ", tmp1);
|
||||
Strings.Append(version.prefix, tmp1);
|
||||
Strings.Append("/", tmp1);
|
||||
Strings.Append(incPath1, tmp1);
|
||||
Strings.Append(tmp1, ccOpt);
|
||||
Args.GetEnv("CFLAGS", CFLAGS);
|
||||
Strings.Append (CFLAGS, ccOpt);
|
||||
Strings.Append (" ", ccOpt);
|
||||
ccString := compiler;
|
||||
Strings.Append (" ", ccString);
|
||||
|
||||
END extTools.
|
||||
Loading…
Add table
Add a link
Reference in a new issue