From ac945112ba4384fc68fea1e2ee387c5407b05bbb Mon Sep 17 00:00:00 2001 From: Andrea Bolognani Date: Tue, 5 Jul 2016 13:46:35 +0200 Subject: [PATCH] linux: Use --as-needed when linking 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 | 1 + 1 file changed, 1 insertion(+) diff --git a/linux/Makefile b/linux/Makefile index 7ad592b..60d637e 100644 --- a/linux/Makefile +++ b/linux/Makefile @@ -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}", "") -- 2.39.2