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* /pmake*
*.o *.o
*.lib
*.a *.a
/Makefile /Makefile
/*.make /*.make

View file

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

View file

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

View file

@ -15,6 +15,16 @@ static duk_ret_t js_process_exit(duk_context* self) {
} }
exit(ex); 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) { 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_push_c_function(js_ctx, js_process_exit, DUK_VARARGS);
duk_put_prop_string(js_ctx, obj, "exit"); 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_put_prop_string(js_ctx, 0, "process");
duk_pop(js_ctx); duk_pop(js_ctx);