diff options
author | Junio C Hamano <gitster@pobox.com> | 2024-01-31 18:42:19 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-01-31 19:01:56 +0100 |
commit | 354dbf7d649ef75c2f83d0f1d7cc03d1e84279dc (patch) | |
tree | 41754a1857bf5e10f7da1a19f438c607b5032566 /shared.mak | |
parent | Git 2.43 (diff) | |
download | git-354dbf7d649ef75c2f83d0f1d7cc03d1e84279dc.tar.xz git-354dbf7d649ef75c2f83d0f1d7cc03d1e84279dc.zip |
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.mak | 6 |
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 |