Add support for Watcom
Some checks are pending
pyrite-dev/pmake/pipeline/head Build started...

This commit is contained in:
Hedy88 2026-08-11 12:36:42 +01:00
commit 7411425f85
No known key found for this signature in database

View file

@ -241,59 +241,35 @@ function ninja(output) {
const objs = self.sources.map(pmake.compiler.output).map(function(x) { return self.base + "/" + x; });
const sources = self.sources.map(function(x) { return self.base + "/" + x; });
function add_I(x) {
return "-I" + x;
}
function add_L(x) {
return "-L" + x;
}
function add_l(x) {
return "-l" + x;
}
const incflags = pmake.includes(self).map(add_I).join(" ");
nk.write("rule cc\n");
nk.write(" command = $cc $incs -c -o $out $in\n");
nk.write(" deps = gcc\n");
nk.write(" depfile = $out.d\n");
nk.write("\n");
nk.write("rule cxx\n");
nk.write(" command = $cxx $incs -c -o $out $in\n");
nk.write(" deps = gcc\n");
nk.write(" depfile = $out.d\n");
nk.write("\n");
if(pmake.compiler.rc) {
nk.write("rule rc\n");
nk.write(" command = $rc -O coff $in $out\n");
function rule(name, dep) {
nk.write("rule " + name + "\n");
nk.write(" command = $command\n");
if(dep) {
nk.write(" deps = gcc\n");
nk.write(" depfile = $out.d\n");
}
nk.write("\n");
}
nk.write("rule ar\n");
nk.write(" command = $ar rcs $out $in\n");
nk.write("\n");
rule("cc", pmake.compiler instanceof pmake.POSIXCompiler);
rule("cxx", pmake.compiler instanceof pmake.POSIXCompiler);
nk.write("rule link\n");
nk.write(" command = $cxx $libdirs -o $out $in $libs\n");
nk.write("\n");
if(self.sources.some(function(x) { return x.endsWith(".rc"); })) {
rule("rc");
}
rule("ar");
rule("link");
for(var i = 0; i < objs.length; i++) {
if(self.sources[i].endsWith(".rc")) {
nk.write("build " + objs[i] + ": rc " + sources[i] + "\n");
nk.write(" rc = " + pmake.compiler.rc + "\n");
} else if(pmake.isCxx(self.sources[i])) {
nk.write("build " + objs[i] + ": cxx " + sources[i] + "\n");
nk.write(" cc = " + pmake.compiler.cxx + "\n");
nk.write(" incs = " + incflags + "\n");
} else {
nk.write("build " + objs[i] + ": cc " + sources[i] + "\n");
nk.write(" cc = " + pmake.compiler.cc + "\n");
nk.write(" incs = " + incflags + "\n");
}
nk.write(" command = " + pmake.compiler.compile(self, objs[i], sources[i]) + "\n");
nk.write("\n");
}
@ -301,17 +277,13 @@ function ninja(output) {
if(!(self instanceof pmake.InterfaceProject)) {
const libpaths = pmake.libs(self, null, true);
const libs = pmake.libs(self, add_l, true);
if(self instanceof pmake.LibraryProject) {
nk.write("build " + output_path + ": ar " + objs.join(" ") + "\n");
nk.write(" ar = " + pmake.compiler.ar + "\n");
} else {
nk.write("build " + output_path + ": link " + objs.join(" ") + (libpaths.length ? " | " + libpaths.join(" ") : "") + "\n");
nk.write(" cxx = " + pmake.compiler.cxx + "\n");
nk.write(" libdirs = " + pmake.libdirs(self).map(add_L).join(" ") + "\n");
nk.write(" libs = " + libs.join(" ") + "\n");
}
nk.write(" command = " + pmake.compiler.link(self, objs) + "\n");
nk.write("\n");
}
}