libdirs
This commit is contained in:
parent
e344b69e93
commit
7ce5bd3cf3
3 changed files with 36 additions and 6 deletions
1
pmake.js
1
pmake.js
|
|
@ -20,6 +20,7 @@ function main() {
|
||||||
Duktape.output = "duktape";
|
Duktape.output = "duktape";
|
||||||
Duktape.sources = fs.glob("external/duktape/*.c");
|
Duktape.sources = fs.glob("external/duktape/*.c");
|
||||||
Duktape.includes = [ "external/duktape" ];
|
Duktape.includes = [ "external/duktape" ];
|
||||||
|
Duktape.libdirs = ["a"];
|
||||||
|
|
||||||
if(pmake.system.target == "Unix") {
|
if(pmake.system.target == "Unix") {
|
||||||
Duktape.libraries = [ "m" ];
|
Duktape.libraries = [ "m" ];
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,11 @@ Watcom.link = function(target, files) {
|
||||||
return "library \"" + x + "\"";
|
return "library \"" + x + "\"";
|
||||||
}
|
}
|
||||||
|
|
||||||
return "wlink option quiet system nt name " + this.output(target) + " " + files.map(add_file).join(" ") + " " + pmake.libs(target, add_lib).map(add_library).join(" ");
|
function add_libpath(x) {
|
||||||
|
return "libpath \"" + x + "\"";
|
||||||
|
}
|
||||||
|
|
||||||
|
return "wlink option quiet system nt name " + this.output(target) + " " + files.map(add_file).join(" ") + " " + pmake.libdirs(target).map(add_libpath).join(" ") + " " + pmake.libs(target, add_lib).map(add_library).join(" ");
|
||||||
}
|
}
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ pmake.resolveProjects = function(arr, if_str) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(proj instanceof pmake.Project) {
|
if(proj instanceof pmake.Project) {
|
||||||
r = r.concat(pmake.resolveProjects(proj.libraries));
|
r = r.concat(pmake.resolveProjects(proj.libraries, if_str));
|
||||||
r.push(proj);
|
r.push(proj);
|
||||||
} else if((typeof proj) == "string" && if_str) {
|
} else if((typeof proj) == "string" && if_str) {
|
||||||
r.push(if_str(proj));
|
r.push(if_str(proj));
|
||||||
|
|
@ -105,12 +105,10 @@ pmake.includes = function(target) {
|
||||||
return targets.map(includes).flat();
|
return targets.map(includes).flat();
|
||||||
};
|
};
|
||||||
|
|
||||||
pmake.libs = function(target, if_str) {
|
pmake.libdirs = function(target, if_str) {
|
||||||
function libs(x) {
|
function libdirs(x) {
|
||||||
if(x instanceof pmake.LibraryProject) {
|
if(x instanceof pmake.LibraryProject) {
|
||||||
return x.libraries.concat([ pmake.compiler.output(x) ]);
|
return x.libdirs;
|
||||||
} else if((typeof x) == "string") {
|
|
||||||
return [ x ];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return [];
|
return [];
|
||||||
|
|
@ -118,7 +116,29 @@ pmake.libs = function(target, if_str) {
|
||||||
|
|
||||||
const targets = pmake.resolveProjects(target.libraries, if_str);
|
const targets = pmake.resolveProjects(target.libraries, if_str);
|
||||||
|
|
||||||
return targets.map(libs).flat();
|
return target.libdirs.concat(targets.map(libdirs).flat());
|
||||||
|
};
|
||||||
|
|
||||||
|
pmake.libs = function(target, if_str) {
|
||||||
|
function libs(x) {
|
||||||
|
if(x instanceof pmake.LibraryProject) {
|
||||||
|
const r = pmake.resolveProjects(x.libraries, if_str).concat([ pmake.compiler.output(x) ]);
|
||||||
|
|
||||||
|
return r;
|
||||||
|
} else if((typeof x) == "string") {
|
||||||
|
return [ x ];
|
||||||
|
}
|
||||||
|
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
const targets = pmake.resolveProjects(target.libraries, if_str).map(libs).flat();
|
||||||
|
|
||||||
|
targets = targets.filter(function(item, pos) {
|
||||||
|
return targets.indexOf(item) == pos;
|
||||||
|
});
|
||||||
|
|
||||||
|
return targets;
|
||||||
};
|
};
|
||||||
|
|
||||||
pmake.setSystem = function(target) {
|
pmake.setSystem = function(target) {
|
||||||
|
|
@ -192,7 +212,11 @@ POSIXCompiler.prototype.link = function(target, files) {
|
||||||
return "-l" + x;
|
return "-l" + x;
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.prefix + c + " -o " + this.output(target) + " " + files.join(" ") + " " + pmake.libs(target, add_l).join(" ");
|
function add_L(x) {
|
||||||
|
return "-L" + x;
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.prefix + c + " " + pmake.libdirs(target).map(add_L).join(" ") + " -o " + this.output(target) + " " + files.join(" ") + " " + pmake.libs(target, add_l).join(" ");
|
||||||
}
|
}
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
|
|
@ -209,6 +233,7 @@ const Project = function(target) {
|
||||||
this.target = target;
|
this.target = target;
|
||||||
this.sources = [];
|
this.sources = [];
|
||||||
this.includes = [];
|
this.includes = [];
|
||||||
|
this.libdirs = [];
|
||||||
this.libraries = [];
|
this.libraries = [];
|
||||||
this.output = target;
|
this.output = target;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue