better stuff
This commit is contained in:
parent
a523a42e6e
commit
c89f96ce8a
5 changed files with 41 additions and 12 deletions
|
|
@ -0,0 +1,6 @@
|
|||
const gmake = pmake.inherit(pmake.Action);
|
||||
|
||||
gmake.target = "gmake";
|
||||
gmake.description = "GNU Make";
|
||||
|
||||
pmake.register(gmake);
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
const GCC = pmake.inherit(Compiler);
|
||||
const GCC = pmake.inherit(pmake.Compiler);
|
||||
|
||||
GCC.name = "GCC";
|
||||
GCC.target = "GCC";
|
||||
GCC.description = "GCC/Clang";
|
||||
|
||||
pmake.register(GCC);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
const Watcom = pmake.inherit(Compiler);
|
||||
const Watcom = pmake.inherit(pmake.Compiler);
|
||||
|
||||
Watcom.name = "Watcom";
|
||||
Watcom.target = "Watcom";
|
||||
Watcom.description = "Open Watcom";
|
||||
|
||||
pmake.register(Watcom);
|
||||
|
|
|
|||
|
|
@ -1,19 +1,34 @@
|
|||
if(ARGV.length == 1) {
|
||||
console.log("Type '" + ARGV[0] + " --help' for help");
|
||||
process.exit(1);
|
||||
}
|
||||
const PADDING = 16;
|
||||
var action;
|
||||
|
||||
for(var i = 1; i < ARGV.length; i++) {
|
||||
if(ARGV[i] == "--help") {
|
||||
var keys;
|
||||
|
||||
console.log("PMake " + pmake.VERSION + " - Pyrite's build script generator");
|
||||
console.log("");
|
||||
console.log("Usage: " + ARGV[0] + " [options] action [arguments]");
|
||||
console.log("");
|
||||
console.log("ACTIONS");
|
||||
|
||||
keys = Object.keys(pmake.actions);
|
||||
for(var i = 0; i < keys.length; i++) {
|
||||
console.log(" " + keys[i] + " ".repeat(PADDING - keys[i].length) + pmake.actions[keys[i]].description);
|
||||
}
|
||||
process.exit(0);
|
||||
} else if(ARGV[i].startsWith("--")) {
|
||||
console.log("Error: invalid option '" + ARGV[i].substr(2) + "'");
|
||||
process.exit(1);
|
||||
} else if(pmake.actions[ARGV[i]]) {
|
||||
action = ARGV[i];
|
||||
break;
|
||||
} else {
|
||||
console.log("Error: no such action '" + ARGV[i] + "'");
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
if(!action) {
|
||||
console.log("Type '" + ARGV[0] + " --help' for help");
|
||||
process.exit(1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
const pmake = {
|
||||
VERSION : "0.0"
|
||||
VERSION : "0.0",
|
||||
actions : {},
|
||||
compilers : {}
|
||||
};
|
||||
|
||||
pmake.inherit = function(base) {
|
||||
|
|
@ -23,9 +25,15 @@ pmake.inherited = function(base, parent) {
|
|||
};
|
||||
|
||||
pmake.register = function(base) {
|
||||
if(pmake.inherited(base, Compiler)) {
|
||||
if(pmake.inherited(base, pmake.Compiler)) {
|
||||
pmake.compilers[base.target] = base;
|
||||
} else if(pmake.inherited(base, pmake.Action)) {
|
||||
pmake.actions[base.target] = base;
|
||||
}
|
||||
};
|
||||
|
||||
function Compiler() {
|
||||
}
|
||||
pmake.Compiler = function() {
|
||||
};
|
||||
|
||||
pmake.Action = function() {
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue