From 63116a7008706988136785ffa011cefee0355193 Mon Sep 17 00:00:00 2001 From: David Lamparter Date: Wed, 21 Jul 2021 11:04:23 +0200 Subject: build: fix `AM_LDFLAGS` usage (and gcov) like the other automake variables, setting `xyz_LDFLAGS` causes `AM_LDFLAGS` to be ignored for `xyz`. For some reason I had in my mind that automake doesn't do this for LDFLAGS, but... it does. (Which is consistent with `_CFLAGS` and co.) So, all the libraries and modules have been ignoring `AM_LDFLAGS` (which includes `SAN_FLAGS` too). Set up new `LIB_LDFLAGS` and `MODULE_LDFLAGS` to handle all of this correctly (and move these bits to a central location.) Fixes: #9034 Fixes: 0c4285d77eb ("build: properly split CFLAGS from AC_CFLAGS") Signed-off-by: David Lamparter --- Makefile.am | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'Makefile.am') diff --git a/Makefile.am b/Makefile.am index 9bc5dd7d2..ce0f70a1a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -29,11 +29,33 @@ AM_CPPFLAGS = \ -I$(top_srcdir)/lib/assert \ $(CPPFLAGS_BASE) \ # end + +# AM_LDFLAGS is used for executables (daemons). LDFLAGS can be left alone, +# but if it is changed it should include $(AM_LDFLAGS) AM_LDFLAGS = \ + -export-dynamic \ + $(AC_LDFLAGS) \ + $(AC_LDFLAGS_EXEC) \ + $(SAN_FLAGS) \ + # end + +# libraries need to use libxxx_LDFLAGS = $(LIB_LDFLAGS) -version-info X:Y:Z +LIB_LDFLAGS = \ -export-dynamic \ $(AC_LDFLAGS) \ $(SAN_FLAGS) \ # end + +# modules need to use xxx_LDFLAGS = $(MODULE_LDFLAGS) +MODULE_LDFLAGS = \ + -export-dynamic \ + -avoid-version \ + -module \ + -shared \ + $(AC_LDFLAGS) \ + $(SAN_FLAGS) \ + # end + DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\" -DCONFDATE=$(CONFDATE) AR_FLAGS = @AR_FLAGS@ -- cgit v1.2.3