pmake/pmake.js

38 lines
998 B
JavaScript
Raw Normal View History

2026-05-09 17:46:10 +09:00
function main() {
function generate(x) {
const g = fs.glob(x);
for(var i = 0; i < g.length; i++) {
var name = g[i].split("/");
const out = g[i].replace(/\.js$/, ".c");
name = name[1] + "_" + name[2].split(".")[0];
process.system("xxd -n " + name + " -i " + g[i] + " > " + out);
}
}
generate("src/compiler/*.js");
generate("src/system/*.js");
generate("src/js/*.js");
const Duktape = new pmake.LibraryProject("Duktape");
Duktape.output = "duktape";
Duktape.sources = fs.glob("external/duktape/*.c");
Duktape.includes = [ "external/duktape" ];
2026-05-09 19:19:44 +09:00
Duktape.libdirs = ["a"];
2026-05-09 17:46:10 +09:00
if(pmake.system.target == "Unix") {
Duktape.libraries = [ "m" ];
}
const stb = new pmake.InterfaceProject("stb");
stb.includes = [ "external/stb" ];
const PMake = new pmake.ExecutableProject("PMake");
PMake.output = "pmake";
PMake.sources = fs.glob("src/*.c", "src/compiler/*.c", "src/system/*.c", "src/js/*.c");
PMake.libraries = [ Duktape, stb ];
pmake.register(PMake);
}