forked from pyrite-dev/pmake
add pmake.js
This commit is contained in:
parent
0192d0a2fd
commit
e344b69e93
2 changed files with 39 additions and 1 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -1,4 +1,5 @@
|
|||
/pmake*
|
||||
/pmake
|
||||
/pmake.exe
|
||||
*.o
|
||||
*.lib
|
||||
*.a
|
||||
|
|
|
|||
37
pmake.js
Normal file
37
pmake.js
Normal file
|
|
@ -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);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue