]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Makefile: simplify output of the libpath_template
authorJunio C Hamano <gitster@pobox.com>
Wed, 31 Jan 2024 17:42:20 +0000 (09:42 -0800)
committerJunio C Hamano <gitster@pobox.com>
Wed, 31 Jan 2024 22:43:00 +0000 (14:43 -0800)
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_template,$(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>
shared.mak

index f33cab8a4ead12e90f6c59820c8afe04087e8572..29bebd30d8acbce9f50661cef48ecdbae1e41f5a 100644 (file)
@@ -111,6 +111,8 @@ endef
 
 ## Getting sick of writing -L$(SOMELIBDIR) $(CC_LD_DYNPATH)$(SOMELIBDIR)?
 ## Write $(call libpath_template,$(SOMELIBDIR)) instead, perhaps?
+## With CC_LD_DYNPATH set to either an empty string or to "-L", the
+## the directory is not shown the second time.
 define libpath_template
--L$(1) $(CC_LD_DYNPATH)$(1)
+-L$(1) $(if $(filter-out -L,$(CC_LD_DYNPATH)),$(CC_LD_DYNPATH)$(1))
 endef