From: Andrea Bolognani Date: Sat, 2 Jul 2016 10:05:09 +0000 (+0200) Subject: linux: Reduce linking for libswmhack X-Git-Url: https://code.delx.au/spectrwm/commitdiff_plain/c85236d67f5fb639c4bcea50bce2a944e6ce4916 linux: Reduce linking for libswmhack The libswmhack library uses dlopen() and friends, so it needs to link against libdl; on the other hand, it doesn't use nearly as many library as spectrwm itself, so linking against them is pointless. Split MAINT_LDLIBS into BIN_LDLIBS and LIB_LDLIBS, and use them for spectrwm and libswmhack respectively. --- diff --git a/linux/Makefile b/linux/Makefile index 0a830e9..0570030 100644 --- a/linux/Makefile +++ b/linux/Makefile @@ -11,16 +11,18 @@ LIBMAJORVERSION = $(shell . $(CURDIR)/../lib/shlib_version; echo $$major) MAINT_CFLAGS = -std=c99 -Wmissing-prototypes -Wall -Wextra -Wshadow -Wno-uninitialized -g MAINT_CPPFLAGS = -D_GNU_SOURCE -I. -I/usr/include/freetype2 -DSWM_LIB=\"$(LIBDIR)/libswmhack.so.$(LIBVERSION)\" -MAINT_LDLIBS = -lX11 -lX11-xcb -lxcb -lxcb-icccm -lxcb-randr -lxcb-keysyms -lxcb-util -lxcb-xtest -lXft -lXcursor ifneq ("${BUILDVERSION}", "") MAINT_CPPFLAGS += -DSPECTRWM_BUILDSTR=\"$(BUILDVERSION)\" endif +BIN_LDLIBS = -lX11 -lX11-xcb -lxcb -lxcb-icccm -lxcb-randr -lxcb-keysyms -lxcb-util -lxcb-xtest -lXft -lXcursor +LIB_LDLIBS = -lX11 -ldl + all: spectrwm libswmhack.so.$(LIBVERSION) spectrwm: spectrwm.o linux.o - $(CC) $(MAINT_LDFLAGS) $(LDFLAGS) -o $@ $+ $(MAINT_LDLIBS) $(LDLIBS) + $(CC) $(MAINT_LDFLAGS) $(LDFLAGS) -o $@ $+ $(BIN_LDLIBS) $(LDLIBS) spectrwm.o: ../spectrwm.c ../version.h tree.h util.h $(CC) $(MAINT_CFLAGS) $(CFLAGS) $(MAINT_CPPFLAGS) $(CPPFLAGS) -c -o $@ $< @@ -29,7 +31,7 @@ linux.o: linux.c util.h $(CC) $(MAINT_CFLAGS) $(CFLAGS) $(MAINT_CPPFLAGS) $(CPPFLAGS) -c -o $@ $< libswmhack.so.$(LIBVERSION): swm_hack.so - $(CC) $(MAINT_LDFLAGS) $(LDFLAGS) -Wl,-soname,$@ -shared -fpic -o $@ $+ $(MAINT_LDLIBS) $(LDLIBS) + $(CC) $(MAINT_LDFLAGS) $(LDFLAGS) -Wl,-soname,$@ -shared -fpic -o $@ $+ $(LIB_LDLIBS) $(LDLIBS) swm_hack.so: ../lib/swm_hack.c $(CC) $(MAINT_CFLAGS) $(CFLAGS) $(MAINT_CPPFLAGS) $(CPPFLAGS) -fpic -DPIC -c -o $@ $<