From 2b79a85b97530e44ad50020bcf8304bda21f817c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Domenic=20W=C3=BCthrich?= Date: Thu, 11 Dec 2025 14:31:14 +0100 Subject: [PATCH] Fix link library change automatic rebuild --- src/V3EmitMk.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/V3EmitMk.cpp b/src/V3EmitMk.cpp index dbcc43315..32d96a146 100644 --- a/src/V3EmitMk.cpp +++ b/src/V3EmitMk.cpp @@ -690,10 +690,19 @@ public: for (const string& i : cFlags) of.puts(" " + i + " \\\n"); of.puts("\n"); - of.puts("# User LDLIBS (from -LDFLAGS on Verilator command line)\n"); + of.puts("# User LDLIBS '-l*' (from -LDFLAGS on Verilator command line)\n"); of.puts("VM_USER_LDLIBS = \\\n"); const VStringList& ldLibs = v3Global.opt.ldLibs(); - for (const string& i : ldLibs) of.puts(" " + i + " \\\n"); + for (const string& i : ldLibs) { + if (i.front() == '-' || V3Os::filenameExt(i) == "") of.puts(" " + i + " \\\n"); + } + of.puts("\n"); + + of.puts("# User LDLIBS files '*.a,*.so' (from -LDFLAGS on Verilator command line)\n"); + of.puts("VM_USER_LDLIBS_FILES = \\\n"); + for (const string& i : ldLibs) { + if (i.front() != '-' && V3Os::filenameExt(i) != "") of.puts(" " + i + " \\\n"); + } of.puts("\n"); VStringSet dirs; @@ -749,7 +758,7 @@ public: of.puts("\n### Link rules... (from --exe)\n"); // '{prefix}__ALL.a', contains all hierarchical libraries of.puts(v3Global.opt.exeName() - + ": $(VK_USER_OBJS) $(VK_GLOBAL_OBJS) $(VM_PREFIX)__ALL.a\n"); + + ": $(VK_USER_OBJS) $(VK_GLOBAL_OBJS) $(VM_USER_LDLIBS_FILES) $(VM_PREFIX)__ALL.a\n"); of.puts("\t$(LINK) $(LDFLAGS) $^ $(LOADLIBES) $(LDLIBS) $(LIBS) $(SC_LIBS) -o $@\n"); of.puts("\n"); } else if (!v3Global.opt.libCreate().empty()) {