]> code.delx.au - spectrwm/commitdiff
linux: Use --as-needed when linking
authorAndrea Bolognani <eof@kiyuko.org>
Tue, 5 Jul 2016 11:46:35 +0000 (13:46 +0200)
committerAndrea Bolognani <eof@kiyuko.org>
Tue, 5 Jul 2016 14:40:48 +0000 (16:40 +0200)
Using this flag will cause the linker to ignore any libraries
that have been listed on the command line but whose symbols are
not actually used.

Right now, it just gets rid of the unnecessary linking against
xcb-render (see https://bugs.debian.org/829709), but it might
catch missing dependencies in the future, and it will generally
keep the resulting binaries nice and tidy.

Ubuntu and Arch are both using --as-needed by default already,
and other distributions will probably switch at some point.

linux/Makefile

index 7ad592bef69f251564b07f478db7dea9ce954f62..60d637ec63c28dbf656f282f1909241840777061 100644 (file)
@@ -10,6 +10,7 @@ LIBVERSION      = $(shell .  $(CURDIR)/../lib/shlib_version; echo $$major.$$mino
 LIBMAJORVERSION = $(shell .  $(CURDIR)/../lib/shlib_version; echo $$major)
 
 MAINT_CFLAGS   = -std=c99 -Wmissing-prototypes -Wall -Wextra -Wshadow -Wno-uninitialized -g
+MAINT_LDFLAGS  = -Wl,--as-needed
 MAINT_CPPFLAGS = -I. -D_GNU_SOURCE -DSWM_LIB=\"$(LIBDIR)/libswmhack.so.$(LIBVERSION)\"
 
 ifneq ("${BUILDVERSION}", "")