Skip to content

Commit 07bbe4c

Browse files
committed
Merge branch 'jc/make-libpath-template'
The Makefile often had to say "-L$(path) -R$(path)" that repeats the path to the same library directory for link time and runtime. A Makefile template is used to reduce such repetition. * jc/make-libpath-template: Makefile: simplify output of the libpath_template Makefile: reduce repetitive library paths
2 parents 097c28d + 4ee286e commit 07bbe4c

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

Makefile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1590,7 +1590,7 @@ endif
15901590

15911591
ifdef LIBPCREDIR
15921592
BASIC_CFLAGS += -I$(LIBPCREDIR)/include
1593-
EXTLIBS += -L$(LIBPCREDIR)/$(lib) $(CC_LD_DYNPATH)$(LIBPCREDIR)/$(lib)
1593+
EXTLIBS += $(call libpath_template,$(LIBPCREDIR)/$(lib))
15941594
endif
15951595

15961596
ifdef HAVE_ALLOCA_H
@@ -1610,7 +1610,7 @@ else
16101610
ifdef CURLDIR
16111611
# Try "-Wl,-rpath=$(CURLDIR)/$(lib)" in such a case.
16121612
CURL_CFLAGS = -I$(CURLDIR)/include
1613-
CURL_LIBCURL = -L$(CURLDIR)/$(lib) $(CC_LD_DYNPATH)$(CURLDIR)/$(lib)
1613+
CURL_LIBCURL = $(call libpath_template,$(CURLDIR)/$(lib))
16141614
else
16151615
CURL_CFLAGS =
16161616
CURL_LIBCURL =
@@ -1646,7 +1646,7 @@ else
16461646
ifndef NO_EXPAT
16471647
ifdef EXPATDIR
16481648
BASIC_CFLAGS += -I$(EXPATDIR)/include
1649-
EXPAT_LIBEXPAT = -L$(EXPATDIR)/$(lib) $(CC_LD_DYNPATH)$(EXPATDIR)/$(lib) -lexpat
1649+
EXPAT_LIBEXPAT = $(call libpath_template,$(EXPATDIR)/$(lib)) -lexpat
16501650
else
16511651
EXPAT_LIBEXPAT = -lexpat
16521652
endif
@@ -1659,15 +1659,15 @@ IMAP_SEND_LDFLAGS += $(OPENSSL_LINK) $(OPENSSL_LIBSSL) $(LIB_4_CRYPTO)
16591659

16601660
ifdef ZLIB_PATH
16611661
BASIC_CFLAGS += -I$(ZLIB_PATH)/include
1662-
EXTLIBS += -L$(ZLIB_PATH)/$(lib) $(CC_LD_DYNPATH)$(ZLIB_PATH)/$(lib)
1662+
EXTLIBS += $(call libpath_template,$(ZLIB_PATH)/$(lib))
16631663
endif
16641664
EXTLIBS += -lz
16651665

16661666
ifndef NO_OPENSSL
16671667
OPENSSL_LIBSSL = -lssl
16681668
ifdef OPENSSLDIR
16691669
BASIC_CFLAGS += -I$(OPENSSLDIR)/include
1670-
OPENSSL_LINK = -L$(OPENSSLDIR)/$(lib) $(CC_LD_DYNPATH)$(OPENSSLDIR)/$(lib)
1670+
OPENSSL_LINK = $(call libpath_template,$(OPENSSLDIR)/$(lib))
16711671
else
16721672
OPENSSL_LINK =
16731673
endif
@@ -1694,7 +1694,7 @@ ifndef NO_ICONV
16941694
ifdef NEEDS_LIBICONV
16951695
ifdef ICONVDIR
16961696
BASIC_CFLAGS += -I$(ICONVDIR)/include
1697-
ICONV_LINK = -L$(ICONVDIR)/$(lib) $(CC_LD_DYNPATH)$(ICONVDIR)/$(lib)
1697+
ICONV_LINK = $(call libpath_template,$(ICONVDIR)/$(lib))
16981698
else
16991699
ICONV_LINK =
17001700
endif

shared.mak

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,3 +108,11 @@ endif
108108
define mkdir_p_parent_template
109109
$(if $(wildcard $(@D)),,$(QUIET_MKDIR_P_PARENT)$(shell mkdir -p $(@D)))
110110
endef
111+
112+
## Getting sick of writing -L$(SOMELIBDIR) $(CC_LD_DYNPATH)$(SOMELIBDIR)?
113+
## 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.
116+
define libpath_template
117+
-L$(1) $(if $(filter-out -L,$(CC_LD_DYNPATH)),$(CC_LD_DYNPATH)$(1))
118+
endef

0 commit comments

Comments
 (0)