This commit is contained in:
Nishi 2026-05-09 16:57:33 +09:00
commit fac750a2b3
Signed by: nishi
GPG key ID: 27EF69B208EB9343
4 changed files with 31 additions and 4 deletions

1
.gitignore vendored
View file

@ -1,5 +1,6 @@
/pmake*
*.o
*.lib
*.a
/Makefile
/*.make

View file

@ -4,7 +4,15 @@ const Watcom = new pmake.Compiler();
Watcom.target = "Watcom";
Watcom.description = "Open Watcom";
Watcom.compile = function(target, obj, src) {
Watcom.output = function(target) {
if(target instanceof pmake.LibraryProject) {
return target.output + ".lib";
}
return pmake.Compiler.prototype.output.call(this, target);
}
Watcom.compile = function(target, obj, src) {
function add_i(x) {
return "-i=" + x;
}
@ -22,6 +30,7 @@ Watcom.compile = function(target, obj, src) {
Watcom.link = function(target, files) {
if(target instanceof pmake.LibraryProject) {
return "wlib -q -b -n -fo " + this.output(target) + " " + files.join(" ");
} else if(target instanceof pmake.ExecutableProject) {
function add_file(x) {
return "file \"" + x + "\"";
@ -35,7 +44,7 @@ Watcom.link = function(target, files) {
}
return "";
}
};
pmake.register(Watcom);
pmake.register(Watcom);
})();

View file

@ -97,7 +97,7 @@ function make(output) {
mk.write(".PHONY: all clean\n");
if(output == "Makefile") {
mk.write(".PHONY: " + targets.map(target_map).join(" ") + "\n");
mk.write(".PHONY: " + targets.map(target_map).join(" ") + " distclean\n");
mk.write("\n");
mk.write("MAKEARGS$(.TARGET) = --no-print-directory");
@ -116,6 +116,10 @@ function make(output) {
for(var i = 0; i < targets.length; i++) {
mk.write(" @$(MAKE) $(MAKEARGS) -f " + targets[i].target + ".make clean\n");
}
mk.write("\n");
mk.write("distclean: clean\n");
mk.write(" $(SILENT)rm -f *.make Makefile\n");
} else {
function target_filter(x) {
return x.target == output.replace(/\.make$/, "");

View file

@ -15,6 +15,16 @@ static duk_ret_t js_process_exit(duk_context* self) {
}
exit(ex);
return 0;
}
static duk_ret_t js_process_system(duk_context* self) {
int n = system(duk_get_string(self, 0));
duk_push_number(self, n);
return 1;
}
void js_process_init(void) {
@ -26,6 +36,9 @@ void js_process_init(void) {
duk_push_c_function(js_ctx, js_process_exit, DUK_VARARGS);
duk_put_prop_string(js_ctx, obj, "exit");
duk_push_c_function(js_ctx, js_process_system, 1);
duk_put_prop_string(js_ctx, obj, "system");
duk_put_prop_string(js_ctx, 0, "process");
duk_pop(js_ctx);