diff --git a/.gitignore b/.gitignore index be2436e..0c9cf5b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ -/pmake* +/pmake +/pmake.exe *.o *.lib *.a diff --git a/pmake.js b/pmake.js new file mode 100644 index 0000000..b864c1f --- /dev/null +++ b/pmake.js @@ -0,0 +1,37 @@ +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" ]; + + 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); +}