aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
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 /Makefile
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 'Makefile')
-rw-r--r--Makefile12
1 files changed, 6 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index 03adcb5a48..13f256ca13 100644
--- a/Makefile
+++ b/Makefile
@@ -1575,7 +1575,7 @@ endif
ifdef LIBPCREDIR
BASIC_CFLAGS += -I$(LIBPCREDIR)/include
- EXTLIBS += -L$(LIBPCREDIR)/$(lib) $(CC_LD_DYNPATH)$(LIBPCREDIR)/$(lib)
+ EXTLIBS += $(call libpath_template,$(LIBPCREDIR)/$(lib))
endif
ifdef HAVE_ALLOCA_H
@@ -1595,7 +1595,7 @@ else
ifdef CURLDIR
# Try "-Wl,-rpath=$(CURLDIR)/$(lib)" in such a case.
CURL_CFLAGS = -I$(CURLDIR)/include
- CURL_LIBCURL = -L$(CURLDIR)/$(lib) $(CC_LD_DYNPATH)$(CURLDIR)/$(lib)
+ CURL_LIBCURL = $(call libpath_template,$(CURLDIR)/$(lib))
else
CURL_CFLAGS =
CURL_LIBCURL =
@@ -1631,7 +1631,7 @@ else
ifndef NO_EXPAT
ifdef EXPATDIR
BASIC_CFLAGS += -I$(EXPATDIR)/include
- EXPAT_LIBEXPAT = -L$(EXPATDIR)/$(lib) $(CC_LD_DYNPATH)$(EXPATDIR)/$(lib) -lexpat
+ EXPAT_LIBEXPAT = $(call libpath_template,$(EXPATDIR)/$(lib)) -lexpat
else
EXPAT_LIBEXPAT = -lexpat
endif
@@ -1644,7 +1644,7 @@ IMAP_SEND_LDFLAGS += $(OPENSSL_LINK) $(OPENSSL_LIBSSL) $(LIB_4_CRYPTO)
ifdef ZLIB_PATH
BASIC_CFLAGS += -I$(ZLIB_PATH)/include
- EXTLIBS += -L$(ZLIB_PATH)/$(lib) $(CC_LD_DYNPATH)$(ZLIB_PATH)/$(lib)
+ EXTLIBS += $(call libpath_template,$(ZLIB_PATH)/$(lib))
endif
EXTLIBS += -lz
@@ -1652,7 +1652,7 @@ ifndef NO_OPENSSL
OPENSSL_LIBSSL = -lssl
ifdef OPENSSLDIR
BASIC_CFLAGS += -I$(OPENSSLDIR)/include
- OPENSSL_LINK = -L$(OPENSSLDIR)/$(lib) $(CC_LD_DYNPATH)$(OPENSSLDIR)/$(lib)
+ OPENSSL_LINK = $(call libpath_template,$(OPENSSLDIR)/$(lib))
else
OPENSSL_LINK =
endif
@@ -1679,7 +1679,7 @@ ifndef NO_ICONV
ifdef NEEDS_LIBICONV
ifdef ICONVDIR
BASIC_CFLAGS += -I$(ICONVDIR)/include
- ICONV_LINK = -L$(ICONVDIR)/$(lib) $(CC_LD_DYNPATH)$(ICONVDIR)/$(lib)
+ ICONV_LINK = $(call libpath_template,$(ICONVDIR)/$(lib))
else
ICONV_LINK =
endif