git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Makefile: drop duplicate %.a from link recipes

From
Harald Nordgren via GitGitGadget <gitgitgadget@gmail.com>
Date
May 31, 2026, 23:16 UTC
Message-ID
<pull.2314.git.git.1780269406949.gitgitgadget@gmail.com>
From: Harald Nordgren <haraldnordgren@gmail.com>

Three link recipes list archive files twice on the link line: once via $(filter %.a,$^) and again through $(LIBS), which expands to $(filter-out %.o,$(GITLIBS)) $(EXTLIBS). On macOS the linker warns about the duplicates:

  ld: warning: ignoring duplicate libraries: 'libgit.a', 'target/release/libgitcore.a'

Drop the redundant filter from the test-helper, fuzz-program, and unit-test recipes so they match the pattern used by other link recipes in the file.

Signed-off-by: Harald Nordgren <haraldnordgren@gmail.com>
---
    Makefile: drop duplicate %.a from test-helper link rule
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2314%2FHaraldNordgren%2Fmakefile-test-helper-dedup-libs-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2314/HaraldNordgren/makefile-test-helper-dedup-libs-v1
Pull-Request: https://github.com/git/git/pull/2314
 Makefile | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/Makefile b/Makefile
index b31ecb0756..309d1d1e74 100644
--- a/Makefile
+++ b/Makefile
@@ -3392,7 +3392,7 @@ perf: all
 t/helper/test-tool$X: $(patsubst %,t/helper/%,$(TEST_BUILTINS_OBJS)) $(UNIT_TEST_DIR)/test-lib.o
 
 t/helper/test-%$X: t/helper/test-%.o GIT-LDFLAGS $(GITLIBS)
-	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(filter %.a,$^) $(LIBS)
+	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
 
 check-sha1:: t/helper/test-tool$X
 	t/helper/test-sha1.sh
@@ -4015,13 +4015,13 @@ fuzz-all: $(FUZZ_PROGRAMS)
 $(FUZZ_PROGRAMS): %: %.o oss-fuzz/dummy-cmd-main.o $(GITLIBS) GIT-LDFLAGS
 	$(QUIET_LINK)$(FUZZ_CXX) $(FUZZ_CXXFLAGS) -o $@ $(ALL_LDFLAGS) \
 		-Wl,--allow-multiple-definition \
-		$(filter %.o,$^) $(filter %.a,$^) $(LIBS) $(LIB_FUZZING_ENGINE)
+		$(filter %.o,$^) $(LIBS) $(LIB_FUZZING_ENGINE)
 
 $(UNIT_TEST_PROGS): $(UNIT_TEST_BIN)/%$X: $(UNIT_TEST_DIR)/%.o $(UNIT_TEST_OBJS) \
 	$(GITLIBS) GIT-LDFLAGS
 	$(call mkdir_p_parent_template)
 	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) \
-		$(filter %.o,$^) $(filter %.a,$^) $(LIBS)
+		$(filter %.o,$^) $(LIBS)
 
 GIT-TEST-SUITES: FORCE
 	@FLAGS='$(CLAR_TEST_SUITES)'; \

base-commit: 1666c1265231b0bc5f613fbbf3f0a9896cdef76e
-- 
gitgitgadget
Next: Junio C Hamano
Message 1 of 18 in “Makefile: drop duplicate %.a from link recipes”
  1. Makefile: drop duplicate %.a from link recipesHarald Nordgren via GitGitGadget, May 31, 2026
  2. Junio C HamanoJun 4, 2026
  3. Harald NordgrenJun 4, 2026
  4. Harald NordgrenJun 4, 2026
  5. Makefile: dedup archives in $(LIBS) so link recipes don't repeat themHarald Nordgren via GitGitGadget, Jun 4, 2026
  6. Harald NordgrenJun 10, 2026
  7. Harald NordgrenJun 19, 2026
  8. Junio C HamanoJun 19, 2026
  9. Harald NordgrenJun 19, 2026
  10. config.mak.uname: avoid macOS dup-library warningHarald Nordgren via GitGitGadget, Jun 19, 2026
  11. Junio C HamanoJun 19, 2026
  12. D. Ben KnobleJun 20, 2026
  13. D. Ben KnobleJun 22, 2026
  14. Patrick SteinhardtJun 22, 2026
  15. Junio C HamanoJun 22, 2026
  16. Paolo BonziniJun 22, 2026
  17. Patrick SteinhardtJun 22, 2026
  18. Paolo BonziniJun 22, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.