Skip to content

Commit 4ee286e

Browse files
committed
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 <[email protected]>
1 parent 354dbf7 commit 4ee286e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

shared.mak

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@ endef
111111

112112
## Getting sick of writing -L$(SOMELIBDIR) $(CC_LD_DYNPATH)$(SOMELIBDIR)?
113113
## Write $(call libpath_template,$(SOMELIBDIR)) instead, perhaps?
114+
## With CC_LD_DYNPATH set to either an empty string or to "-L", the
115+
## the directory is not shown the second time.
114116
define libpath_template
115-
-L$(1) $(CC_LD_DYNPATH)$(1)
117+
-L$(1) $(if $(filter-out -L,$(CC_LD_DYNPATH)),$(CC_LD_DYNPATH)$(1))
116118
endef

0 commit comments

Comments
 (0)