All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: git@vger.kernel.org
Subject: [PATCH 2/2] Makefile: simplify output of the libpath_template
Date: Wed, 31 Jan 2024 09:42:20 -0800	[thread overview]
Message-ID: <20240131174220.4160560-3-gitster@pobox.com> (raw)
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


  parent reply	other threads:[~2024-01-31 17:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-31 17:42 [PATCH 0/2] CC_LD_DYNPATH improvements Junio C Hamano
2024-01-31 17:42 ` [PATCH 1/2] Makefile: reduce repetitive library paths Junio C Hamano
2024-01-31 17:42 ` Junio C Hamano [this message]
2024-01-31 22:59   ` [PATCH 2/2] Makefile: simplify output of the libpath_template Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240131174220.4160560-3-gitster@pobox.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.