From ff9596bb23dd3675ce061a20ab14ebbd7fe6bc96 Mon Sep 17 00:00:00 2001 From: Yinan Xu Date: Tue, 29 Nov 2022 22:02:39 +0800 Subject: [PATCH] Fix missing user objects in --lib-create mode (#3780) (#3784) --- src/V3EmitMk.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/V3EmitMk.cpp b/src/V3EmitMk.cpp index 7c1bf0094..eefba5e92 100644 --- a/src/V3EmitMk.cpp +++ b/src/V3EmitMk.cpp @@ -231,13 +231,16 @@ public: of.puts("\n### Executable rules... (from --exe)\n"); of.puts("VPATH += $(VM_USER_DIR)\n"); of.puts("\n"); - for (const string& cppfile : cppFiles) { - const string basename = V3Os::filenameNonExt(cppfile); - // NOLINTNEXTLINE(performance-inefficient-string-concatenation) - of.puts(basename + ".o: " + cppfile + "\n"); - of.puts("\t$(OBJCACHE) $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(OPT_FAST) -c -o $@ $<\n"); - } + } + for (const string& cppfile : cppFiles) { + const string basename = V3Os::filenameNonExt(cppfile); + // NOLINTNEXTLINE(performance-inefficient-string-concatenation) + of.puts(basename + ".o: " + cppfile + "\n"); + of.puts("\t$(OBJCACHE) $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(OPT_FAST) -c -o $@ $<\n"); + } + + if (v3Global.opt.exe()) { of.puts("\n### Link rules... (from --exe)\n"); of.puts(v3Global.opt.exeName() + ": $(VK_USER_OBJS) $(VK_GLOBAL_OBJS) $(VM_PREFIX)__ALL.a $(VM_HIER_LIBS)\n");