From 831c207d25ffc2a6db45d67e8566a809591b622e Mon Sep 17 00:00:00 2001 From: Nishi Date: Tue, 12 May 2026 08:36:20 +0900 Subject: [PATCH] fix --- src/js/cmdline.js | 4 +++- src/js/core.js | 7 ++++--- src/js_fs.c | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/js/cmdline.js b/src/js/cmdline.js index fda5d4a..16d0300 100644 --- a/src/js/cmdline.js +++ b/src/js/cmdline.js @@ -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"); diff --git a/src/js/core.js b/src/js/core.js index 7cf4000..4b947c2 100644 --- a/src/js/core.js +++ b/src/js/core.js @@ -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 ]; } diff --git a/src/js_fs.c b/src/js_fs.c index 1be98c1..3f88260 100644 --- a/src/js_fs.c +++ b/src/js_fs.c @@ -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++;