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

[PATCH 2/2] Makefile: simplify output of the libpath_template

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 31, 2024, 17:42 UTC
Message-ID
<20240131174220.4160560-3-gitster@pobox.com>
In-Reply-To
<20240131174220.4160560-1-gitster@pobox.com>

If a platform lacks the support to specify the dynamic library path, there is no suitable value to give to the CC_LD_DYNPATH variable. Allow them to be set to an empty string to signal that they do not need to add the usual -Wl,-rpath, or -R or whatever option followed by a directory name. This way,

    $(call libpath_tempate,$(SOMELIBDIR))
would expand to just a single mention of that directory, i.e.
    -L$(SOMELIBDIR)

when CC_LD_DYNPATH is set to an empty string (or a "-L", which would have repeated the same "-L$(SOMELIBDIR)" twice without any ill effect).

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 * This obviously makes it impossible to set CC_LD_DYNPATH to an
   empty string to say "-L /usr/local/lib /usr/local/lib" on the
   linker's command line.  I do not think it would serve any useful
   purpose to be able to have just a directory name on the command
   line of the linker there, so it would not regress anything on
   exotic platforms, I hope ;-).
 shared.mak | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/shared.mak b/shared.mak
index f33cab8a4e..c59cea75a1 100644
--- a/shared.mak
+++ b/shared.mak
@@ -112,5 +112,5 @@ endef
 ## Getting sick of writing -L$(SOMELIBDIR) $(CC_LD_DYNPATH)$(SOMELIBDIR)?
 ## Write $(call libpath_template,$(SOMELIBDIR)) instead, perhaps?
 define libpath_template
--L$(1) $(CC_LD_DYNPATH)$(1)
+-L$(1) $(if $(filter-out -L,$(CC_LD_DYNPATH)),$(CC_LD_DYNPATH)$(1))
 endef
-- 
2.43.0-493-gbc7ee2e5e1
Previous: Junio C HamanoNext: Junio C Hamano
Message 2 of 4 in “CC_LD_DYNPATH improvements”
  1. 0/2 CC_LD_DYNPATH improvementsJunio C Hamano, Jan 31, 2024
  2. 2/2 Makefile: simplify output of the libpath_templateJunio C Hamano, Jan 31, 2024
  3. Junio C HamanoJan 31, 2024
  4. 1/2 Makefile: reduce repetitive library pathsJunio C Hamano, Jan 31, 2024

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.