This commit is contained in:
Nishi 2026-05-12 08:36:20 +09:00
commit 831c207d25
3 changed files with 8 additions and 5 deletions

View file

@ -140,7 +140,9 @@ function make(output) {
const self = targets.filter(target_filter)[0];
const objs = self.sources.map(pmake.compiler.output);
const libs = pmake.libs(self).join(" ");
const libs = pmake.libs(self, null, true).join(" ");
console.log(libs);
mk.write("\n");

View file

@ -133,21 +133,22 @@ pmake.libdirs = function(target) {
return target.libdirs.concat(targets.map(libdirs).flat());
};
pmake.libs = function(target, if_str) {
pmake.libs = function(target, if_str, nostr) {
function libs(x) {
if(x instanceof pmake.LibraryProject) {
function recursion(x) {
if(x instanceof pmake.LibraryProject) {
return pmake.libs(x, if_str);
} else {
} else if(!nostr) {
return [ x ];
}
return [];
}
const r = x.libraries.map(recursion).flat().concat([ x.base + "/" + pmake.compiler.output(x) ]);
return r;
} else if((typeof x) == "string") {
} else if((typeof x) == "string" && !nostr) {
return [ x ];
}

View file

@ -52,7 +52,7 @@ static duk_ret_t js_fs_glob(duk_context* self) {
if(glob(duk_to_string(self, i), 0, NULL, &g) == 0) {
int j;
for(j = 0; j < g.gl_matchc; j++) {
for(j = 0; j < g.gl_pathc; j++) {
duk_push_string(self, g.gl_pathv[j]);
duk_put_prop_index(self, arr, c);
c++;