From c86ddbe61323e371f6ac88728581481a1aa6f0e6 Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Fri, 5 Feb 2016 11:47:14 +0100 Subject: Enhance and clear the support of linker flags Some time ago, we had a ex_libs configuration setting that could be divided into lflags and ex_libs. These got divided in two settings, lflags and ex_libs, and the former was interpreted to be general linking flags. Unfortunately, that conclusion wasn't entirely accurate. Most of those linking were meant to end up in a very precise position on the linking command line, just before the spec of libraries the linking depends on. Back to the drawing board, we're diving things further, now having lflags, which are linking flags that aren't depending on command line position, plib_lflags, which are linking flags that should show up just before the spec of libraries to depend on, and finally ex_libs, which is the spec of extra libraries to depend on. Also, documentation is changed in Configurations/README. This was previously forgotten. Reviewed-by: Kurt Roeckx --- Makefile.shared | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'Makefile.shared') diff --git a/Makefile.shared b/Makefile.shared index 70980ad..d8bd9ed 100644 --- a/Makefile.shared +++ b/Makefile.shared @@ -11,8 +11,8 @@ CFLAGS=$(CFLAG) # LDFLAGS contains flags to be used when temporary object files (when building # shared libraries) are created, or when an application is linked. # SHARED_LDFLAGS contains flags to be used when the shared library is created. -LDFLAGS= -SHARED_LDFLAGS= +LDFLAGS=$(LDFLAG) +SHARED_LDFLAGS=$(SHARED_LDFLAG) NM=nm @@ -92,7 +92,7 @@ CALC_VERSIONS= \ LINK_APP= \ ( $(SET_X); \ LIBDEPS="$${LIBDEPS:-$(LIBDEPS)}"; \ - LDCMD="$${LDCMD:-$(CC)}"; LDFLAGS="$${LDFLAGS:-$(CFLAGS)}"; \ + LDCMD="$${LDCMD:-$(CC)}"; LDFLAGS="$${LDFLAGS:-$(CFLAGS) $(LDFLAGS)}"; \ LIBPATH=`for x in $$LIBDEPS; do echo $$x; done | sed -e 's/^ *-L//;t' -e d | uniq`; \ LIBPATH=`echo $$LIBPATH | sed -e 's/ /:/g'`; \ LD_LIBRARY_PATH=$$LIBPATH:$$LD_LIBRARY_PATH \ @@ -153,7 +153,7 @@ DO_GNU_SO=$(CALC_VERSIONS); \ NOALLSYMSFLAGS='-Wl,--no-whole-archive'; \ SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -Wl,-Bsymbolic -Wl,-soname=$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX" -DO_GNU_APP=LDFLAGS="$(CFLAGS) -Wl,-rpath,$(LIBRPATH)" +DO_GNU_APP=LDFLAGS="$(CFLAGS) $(LDFLAGS) -Wl,-rpath,$(LIBRPATH)" #This is rather special. It's a special target with which one can link #applications without bothering with any features that have anything to @@ -203,7 +203,7 @@ link_a.bsd: fi; $(LINK_SO_A) link_app.bsd: @if $(DETECT_GNU_LD); then $(DO_GNU_APP); else \ - LDFLAGS="$(CFLAGS) -Wl,-rpath,$(LIBPATH)"; \ + LDFLAGS="$(CFLAGS) $(LDFLAGS) -Wl,-rpath,$(LIBPATH)"; \ fi; $(LINK_APP) # For Darwin AKA Mac OS/X (dyld) @@ -357,7 +357,7 @@ link_app.alpha-osf1: @if $(DETECT_GNU_LD); then \ $(DO_GNU_APP); \ else \ - LDFLAGS="$(CFLAGS) -rpath $(LIBRPATH)"; \ + LDFLAGS="$(CFLAGS) $(LDFLAGS) -rpath $(LIBRPATH)"; \ fi; \ $(LINK_APP) @@ -398,7 +398,7 @@ link_app.solaris: @ if $(DETECT_GNU_LD); then \ $(DO_GNU_APP); \ else \ - LDFLAGS="$(CFLAGS) -R $(LIBRPATH)"; \ + LDFLAGS="$(CFLAGS) $(LDFLAGS) -R $(LIBRPATH)"; \ fi; \ $(LINK_APP) @@ -493,7 +493,7 @@ link_a.irix: fi; \ $(LINK_SO_A) link_app.irix: - @LDFLAGS="$(CFLAGS) -Wl,-rpath,$(LIBRPATH)"; \ + @LDFLAGS="$(CFLAGS) $(LDFLAGS) -Wl,-rpath,$(LIBRPATH)"; \ $(LINK_APP) # 32-bit PA-RISC HP-UX embeds the -L pathname of libs we link with, so @@ -532,7 +532,7 @@ link_a.hpux: $(LINK_SO_A) && chmod a=rx $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX link_app.hpux: @if $(DETECT_GNU_LD); then $(DO_GNU_APP); else \ - LDFLAGS="$(CFLAGS) -Wl,+s,+cdp,../:,+cdp,./:,+b,$(LIBRPATH)"; \ + LDFLAGS="$(CFLAGS) $(LDFLAGS) -Wl,+s,+cdp,../:,+cdp,./:,+b,$(LIBRPATH)"; \ fi; \ $(LINK_APP) @@ -557,7 +557,7 @@ link_a.aix: SHAREDFLAGS='$(CFLAGS) $(SHARED_LDFLAGS) -Wl,-bexpall,-bnolibpath,-bM:SRE'; \ $(LINK_SO_A_VIA_O) link_app.aix: - LDFLAGS="$(CFLAGS) -Wl,-brtl,-blibpath:$(LIBRPATH):$${LIBPATH:-/usr/lib:/lib}"; \ + LDFLAGS="$(CFLAGS) $(LDFLAGS) -Wl,-brtl,-blibpath:$(LIBRPATH):$${LIBPATH:-/usr/lib:/lib}"; \ $(LINK_APP) -- cgit v1.1