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@xxxxxxxxx> --- * 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