feat: restructure Makefile to delegate builds to script/wren.mk and output to bin/ and lib/ directories
The monolithic Makefile is replaced with a thin wrapper that invokes script/wren.mk for each configuration. Build artifacts are now placed in bin/ (executables) and lib/ (static/shared libraries) instead of the project root. The .gitignore is updated accordingly, and the getting-started documentation reflects the new output layout.
This commit is contained in:
+2
-2
@@ -56,7 +56,7 @@ static char* readModule(WrenVM* vm, const char* module)
|
||||
size_t rootLength = strlen(rootDirectory);
|
||||
size_t moduleLength = strlen(module);
|
||||
size_t pathLength = rootLength + moduleLength + 5;
|
||||
char* path = malloc(pathLength + 1);
|
||||
char* path = (char*)malloc(pathLength + 1);
|
||||
memcpy(path, rootDirectory, rootLength);
|
||||
memcpy(path + rootLength, module, moduleLength);
|
||||
memcpy(path + rootLength + moduleLength, ".wren", 5);
|
||||
@@ -107,7 +107,7 @@ static int runFile(WrenVM* vm, const char* path)
|
||||
// Use the directory where the file is as the root to resolve imports
|
||||
// relative to.
|
||||
char* lastSlash = strrchr(path, '/');
|
||||
rootDirectory = malloc(lastSlash - path + 2);
|
||||
rootDirectory = (char*)malloc(lastSlash - path + 2);
|
||||
memcpy(rootDirectory, path, lastSlash - path + 1);
|
||||
rootDirectory[lastSlash - path + 1] = '\0';
|
||||
|
||||
|
||||
+3
-3
@@ -1208,7 +1208,7 @@ WrenInterpretResult wrenInterpret(WrenVM* vm, const char* sourcePath,
|
||||
const char* source)
|
||||
{
|
||||
if (strlen(sourcePath) == 0) return loadIntoCore(vm, source);
|
||||
|
||||
|
||||
// TODO: Better module name.
|
||||
Value name = wrenNewString(vm, "main", 4);
|
||||
wrenPushRoot(vm, AS_OBJ(name));
|
||||
@@ -1345,7 +1345,7 @@ static void defineMethod(WrenVM* vm, const char* className,
|
||||
|
||||
// TODO: Need to be able to define methods in classes outside the core
|
||||
// module.
|
||||
|
||||
|
||||
// Find or create the class to bind the method to.
|
||||
ObjModule* coreModule = getCoreModule(vm);
|
||||
int classSymbol = wrenSymbolTableFind(&coreModule->variableNames,
|
||||
@@ -1460,7 +1460,7 @@ void wrenReturnString(WrenVM* vm, const char* text, int length)
|
||||
{
|
||||
ASSERT(vm->foreignCallSlot != NULL, "Must be in foreign call.");
|
||||
ASSERT(text != NULL, "String cannot be NULL.");
|
||||
|
||||
|
||||
size_t size = length;
|
||||
if (length == -1) size = strlen(text);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user