works for gcc
This commit is contained in:
parent
ae7ff555d9
commit
f5e4e6990b
3 changed files with 45 additions and 11 deletions
|
|
@ -4,5 +4,38 @@ const Watcom = new pmake.Compiler();
|
||||||
Watcom.target = "Watcom";
|
Watcom.target = "Watcom";
|
||||||
Watcom.description = "Open Watcom";
|
Watcom.description = "Open Watcom";
|
||||||
|
|
||||||
pmake.register(Watcom);
|
Watcom.compile = function(target, obj, src) {
|
||||||
|
function add_i(x) {
|
||||||
|
return "-i=" + x;
|
||||||
|
}
|
||||||
|
|
||||||
|
const includes = pmake.includes(target).map(add_i).join(" ");
|
||||||
|
const flags = "-bt=nt -q " + includes + " -fo=" + obj + " " + src;
|
||||||
|
|
||||||
|
if(src.endsWith(".c")) {
|
||||||
|
return "wcc386 " + flags;
|
||||||
|
} else {
|
||||||
|
return "wpp386 " + flags;
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
};
|
||||||
|
|
||||||
|
Watcom.link = function(target, files) {
|
||||||
|
if(target instanceof pmake.LibraryProject) {
|
||||||
|
} else if(target instanceof pmake.ExecutableProject) {
|
||||||
|
function add_file(x) {
|
||||||
|
return "file \"" + x + "\"";
|
||||||
|
}
|
||||||
|
|
||||||
|
function add_library(x) {
|
||||||
|
return "library \"" + x + "\"";
|
||||||
|
}
|
||||||
|
|
||||||
|
return "wlink option quiet system nt name " + this.output(target) + " " + files.map(add_file).join(" ") + " " + pmake.libs(target).map(add_library).join(" ");
|
||||||
|
}
|
||||||
|
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
pmake.register(Watcom);
|
||||||
})();
|
})();
|
||||||
|
|
|
||||||
|
|
@ -130,17 +130,19 @@ function make(output) {
|
||||||
mk.write("\n");
|
mk.write("\n");
|
||||||
|
|
||||||
mk.write(pmake.compiler.output(self) + ": " + objs.join(" ") + "\n");
|
mk.write(pmake.compiler.output(self) + ": " + objs.join(" ") + "\n");
|
||||||
mk.write(" " + pmake.compiler.link(self, objs) + "\n");
|
mk.write(" @echo LINK " + pmake.compiler.output(self) + "\n");
|
||||||
|
mk.write(" $(SILENT)" + pmake.compiler.link(self, objs) + "\n");
|
||||||
mk.write("\n");
|
mk.write("\n");
|
||||||
|
|
||||||
for(var i = 0; i < objs.length; i++) {
|
for(var i = 0; i < objs.length; i++) {
|
||||||
mk.write(objs[i] + ": " + self.sources[i] + "\n");
|
mk.write(objs[i] + ": " + self.sources[i] + "\n");
|
||||||
mk.write(" " + pmake.compiler.compile(self, objs[i], self.sources[i]) + "\n");
|
mk.write(" @echo CC/CXX " + self.sources[i] + "\n");
|
||||||
|
mk.write(" $(SILENT)" + pmake.compiler.compile(self, objs[i], self.sources[i]) + "\n");
|
||||||
mk.write("\n");
|
mk.write("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
mk.write("clean: \n");
|
mk.write("clean: \n");
|
||||||
mk.write(" $(SILENT)$(RM) " + pmake.compiler.output(self) + " *.o *.exe *.a *.lib *.so *.dll\n");
|
mk.write(" $(SILENT)$(RM) " + pmake.compiler.output(self) + " " + objs.join(" ") + "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
mk.close();
|
mk.close();
|
||||||
|
|
|
||||||
|
|
@ -146,20 +146,19 @@ POSIXCompiler.prototype.compile = function(target, obj, src) {
|
||||||
return "-I" + x;
|
return "-I" + x;
|
||||||
}
|
}
|
||||||
|
|
||||||
const includes = pmake.includes(target).map(add_i)
|
const includes = pmake.includes(target).map(add_i).join(" ");
|
||||||
|
const flags = includes + " -c -o " + obj + " " + src;
|
||||||
if(includes.length > 0) includes = " " + includes.join(" ");
|
|
||||||
|
|
||||||
if(src.endsWith(".c")) {
|
if(src.endsWith(".c")) {
|
||||||
return this.prefix + this.cc + includes + " -c -o " + obj + " " + src;
|
return this.prefix + this.cc + " " + flags;
|
||||||
} else if(is_cxx(src)) {
|
} else if(is_cxx(src)) {
|
||||||
return this.prefix + this.cxx + includes + " -c -o " + obj + " " + src;
|
return this.prefix + this.cxx + " " + flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
}
|
};
|
||||||
|
|
||||||
POSIXCompiler.prototype.link = function(target, files) {
|
POSIXCompiler.prototype.link = function(target, files) {
|
||||||
if(target instanceof pmake.LibraryProject) {
|
if(target instanceof pmake.LibraryProject) {
|
||||||
return this.prefix + this.ar + " rcs " + this.output(target) + " " + files.join(" ");
|
return this.prefix + this.ar + " rcs " + this.output(target) + " " + files.join(" ");
|
||||||
} else if(target instanceof pmake.ExecutableProject) {
|
} else if(target instanceof pmake.ExecutableProject) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue