aboutsummaryrefslogtreecommitdiffstats
path: root/shared.mak
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2024-01-31 09:42:19 -0800
committerJunio C Hamano <gitster@pobox.com>2024-01-31 10:01:56 -0800
commit354dbf7d649ef75c2f83d0f1d7cc03d1e84279dc (patch)
tree41754a1857bf5e10f7da1a19f438c607b5032566 /shared.mak
parent564d0252ca632e0264ed670534a51d18a689ef5d (diff)
downloadgit-354dbf7d649ef75c2f83d0f1d7cc03d1e84279dc.tar.gz
Makefile: reduce repetitive library paths
When we take a library package we depend on (e.g., LIBPCRE) from a directory other than the default location of the system, we add the same directory twice on the linker command like, like so: EXTLIBS += -L$(LIBPCREDIR)/$(lib) $(CC_LD_DYNPATH)$(LIBPCREDIR)/$(lib) Introduce a template "libpath_template" that takes the path to the directory, which can be used like so: EXTLIBS += $(call libpath_template,$(LIBPCREDIR)/$(lib)) and expand it into the "-L$(DIR) $(CC_LD_DYNPATH)$(DIR)" form. Hopefully we can reduce the chance of typoes this way. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'shared.mak')
-rw-r--r--shared.mak6
1 files changed, 6 insertions, 0 deletions
diff --git a/shared.mak b/shared.mak
index aeb80fc4d5..f33cab8a4e 100644
--- a/shared.mak
+++ b/shared.mak
@@ -108,3 +108,9 @@ endif
define mkdir_p_parent_template
$(if $(wildcard $(@D)),,$(QUIET_MKDIR_P_PARENT)$(shell mkdir -p $(@D)))
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)
+endef