From 3f821eb1e52c95225265e9fbcaa099fe06535dc8 Mon Sep 17 00:00:00 2001 From: Sanel Zukan Date: Sun, 10 Aug 2008 18:18:16 +0000 Subject: [PATCH] Programs will be, by default, linke with "-Wl,--as-needed" to reduce unused library dependencies. --- Jamrules | 7 +++++-- build/Program.jam | 5 +++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Jamrules b/Jamrules index 9cf3fdb..a7661bd 100644 --- a/Jamrules +++ b/Jamrules @@ -29,14 +29,17 @@ EDEDESKTOPDIR ?= "$(PREFIX)/data/desktop" ; GLOBALFLAGS ?= -Wall -pedantic -g3 -D_DEBUG -I$(TOP) ; STDLIB ?= -lstdc++ ; +# some options +REMOVE_UNUSED_DEPENDENCIES_TRICK = 1 ; + # edelib libraries path EDELIBINCLUDE ?= -I/opt/ede/include ; EDELIBLIB ?= -L/opt/ede/lib -ledelib ; # fltk libraries path FLTKINCLUDE ?= -I/usr/local/include ; -FLTKLIB ?= -L/usr/local/lib -lfltk_images -lpng -lz -ljpeg -lfltk -ldl -lm -lXext -lX11 -lXpm ; -FLTKLIB_NOIMAGES ?= -L/usr/local/lib -lfltk -ldl -lm -lXext -lX11 ; +FLTKLIB ?= -L/usr/local/lib -lfltk_images -lpng -lz -ljpeg -lfltk -ldl -lm -lXext -lXft -lX11 -lXpm ; +FLTKLIB_NOIMAGES ?= -L/usr/local/lib -lfltk -ldl -lm -lXext -lXft -lX11 ; # backward; efltk libraries path EFLTKINCLUDE ?= -I/usr/local/include ; diff --git a/build/Program.jam b/build/Program.jam index aa19772..12bdffa 100644 --- a/build/Program.jam +++ b/build/Program.jam @@ -32,6 +32,11 @@ rule MakeProgramPrivate CFLAGS on $(objects) += $(4) ; C++FLAGS on $(objects) += $(4) ; + if $(REMOVE_UNUSED_DEPENDENCIES_TRICK) = 1 { + # remove unused dependencies in binaries, as U.Drepper prescribed ;-) + LINKFLAGS on $(target) = -Wl,--as-needed [ on $(target) return $(LINKFLAGS) ] ; + } + LINKLIBS on $(target) = $(3) [ on $(target) return $(LINKLIBS) ] ; MainFromObjects $(target) : $(objects) ;