...
This commit is contained in:
4
example/.gitignore
vendored
4
example/.gitignore
vendored
@@ -1,2 +1,2 @@
|
|||||||
bin
|
out
|
||||||
bin-int
|
out.a
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
CFLAGS = -Wall -Werror -Wextra -g
|
CFLAGS = -Wall -Werror -Wextra -g
|
||||||
|
|
||||||
OBJECTS := $(shell dotnet run --project ../src/compiler/CLI/CLI.csproj src/main.nub src/c.nub)
|
OBJECTS := $(shell )
|
||||||
|
|
||||||
example:
|
example:
|
||||||
mkdir -p bin
|
dotnet run --project ../src/compiler/CLI/CLI.csproj src/main.nub src/c.nub
|
||||||
gcc $(CFLAGS) -o bin/out lib/libruntime_x64.a $(OBJECTS)
|
gcc $(CFLAGS) -o out lib/libruntime_x64.a out.a
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -r bin bin-int
|
rm -r out.a out
|
||||||
|
|||||||
@@ -5,14 +5,13 @@ using Syntax.Diagnostics;
|
|||||||
using Syntax.Parsing;
|
using Syntax.Parsing;
|
||||||
using Syntax.Tokenization;
|
using Syntax.Tokenization;
|
||||||
using Syntax.Typing;
|
using Syntax.Typing;
|
||||||
using Binder = Syntax.Typing.Binder;
|
|
||||||
|
|
||||||
const string OUT_DIR = "bin-int";
|
// const string OUT_DIR = "bin-int";
|
||||||
|
//
|
||||||
if (Directory.Exists(OUT_DIR))
|
// if (Directory.Exists(OUT_DIR))
|
||||||
{
|
// {
|
||||||
Directory.Delete(OUT_DIR, true);
|
// Directory.Delete(OUT_DIR, true);
|
||||||
}
|
// }
|
||||||
|
|
||||||
var files = new List<string>();
|
var files = new List<string>();
|
||||||
|
|
||||||
@@ -84,18 +83,21 @@ foreach (var file in files)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
var fileName = $"{StringRandomizer.GenerateUniqueHexString(8)}_{Path.GetFileNameWithoutExtension(file)}.o";
|
var fileName = Path.GetTempFileName();
|
||||||
var objPath = Path.Combine(OUT_DIR, fileName);
|
var asmSuccess = await GCC.Assemble(asm, fileName);
|
||||||
var asmSuccess = await GCC.Assemble(asm, objPath);
|
|
||||||
if (!asmSuccess)
|
if (!asmSuccess)
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
objectFiles.Add(objPath);
|
objectFiles.Add(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
Console.Out.WriteLine(string.Join('\t', objectFiles));
|
var archiveResult = await Archive.Invoke("out.a", objectFiles);
|
||||||
|
if (!archiveResult)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user