diff options
author | Junio C Hamano <gitster@pobox.com> | 2024-01-31 18:42:20 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-01-31 23:43:00 +0100 |
commit | 4ee286e8e6f7a7d03134ab16389013ad5d14ed07 (patch) | |
tree | 7dd13704af668693a61653c8912331282e3260ed /shared.mak | |
parent | Makefile: reduce repetitive library paths (diff) | |
download | git-4ee286e8e6f7a7d03134ab16389013ad5d14ed07.tar.xz git-4ee286e8e6f7a7d03134ab16389013ad5d14ed07.zip |
Makefile: simplify output of the libpath_template
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>
Diffstat (limited to 'shared.mak')
-rw-r--r-- | shared.mak | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/shared.mak b/shared.mak index f33cab8a4e..29bebd30d8 100644 --- a/shared.mak +++ b/shared.mak @@ -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 |