From 3749ed2fbe3115fb2409567a338763dd1b53d0b7 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Wed, 13 Jul 2011 13:28:31 +0200 Subject: [PATCH] Makefile: respect and use LIBS (Thanks Kacper) --- Makefile | 2 +- common.mk | 34 +++++++++++++++++----------------- i3-config-wizard/Makefile | 2 +- i3-input/Makefile | 2 +- i3-msg/Makefile | 2 +- i3-nagbar/Makefile | 2 +- 6 files changed, 22 insertions(+), 22 deletions(-) diff --git a/Makefile b/Makefile index d628eaf7..fccb0690 100644 --- a/Makefile +++ b/Makefile @@ -25,7 +25,7 @@ src/%.o: src/%.c ${HEADERS} all: src/cfgparse.y.o src/cfgparse.yy.o src/cmdparse.y.o src/cmdparse.yy.o ${FILES} echo "LINK i3" - $(CC) -o i3 $^ $(LDFLAGS) + $(CC) $(LDFLAGS) -o i3 $^ $(LIBS) loglevels.h: echo "LOGLEVELS" diff --git a/common.mk b/common.mk index c7131f22..76813264 100644 --- a/common.mk +++ b/common.mk @@ -49,23 +49,23 @@ CPPFLAGS += -DI3_VERSION=\"${GIT_VERSION}\" CPPFLAGS += -DSYSCONFDIR=\"${SYSCONFDIR}\" CPPFLAGS += -DTERM_EMU=\"$(TERM_EMU)\" -LDFLAGS += -lm -LDFLAGS += $(call ldflags_for_lib, xcb-event, xcb-event) -LDFLAGS += $(call ldflags_for_lib, xcb-keysyms, xcb-keysyms) +LIBS += -lm +LIBS += $(call ldflags_for_lib, xcb-event, xcb-event) +LIBS += $(call ldflags_for_lib, xcb-keysyms, xcb-keysyms) ifeq ($(shell pkg-config --exists xcb-util || echo 1),1) -LDFLAGS += $(call ldflags_for_lib, xcb-atom, xcb-atom) -LDFLAGS += $(call ldflags_for_lib, xcb-aux, xcb-aux) +LIBS += $(call ldflags_for_lib, xcb-atom, xcb-atom) +LIBS += $(call ldflags_for_lib, xcb-aux, xcb-aux) else -LDFLAGS += $(call ldflags_for_lib, xcb-util) +LIBS += $(call ldflags_for_lib, xcb-util) endif -LDFLAGS += $(call ldflags_for_lib, xcb-icccm, xcb-icccm) -LDFLAGS += $(call ldflags_for_lib, xcb-xinerama, xcb-xinerama) -LDFLAGS += $(call ldflags_for_lib, xcb-randr, xcb-randr) -LDFLAGS += $(call ldflags_for_lib, xcb, xcb) -LDFLAGS += $(call ldflags_for_lib, xcursor, Xcursor) -LDFLAGS += $(call ldflags_for_lib, x11, X11) -LDFLAGS += $(call ldflags_for_lib, yajl, yajl) -LDFLAGS += $(call ldflags_for_lib, libev, ev) +LIBS += $(call ldflags_for_lib, xcb-icccm, xcb-icccm) +LIBS += $(call ldflags_for_lib, xcb-xinerama, xcb-xinerama) +LIBS += $(call ldflags_for_lib, xcb-randr, xcb-randr) +LIBS += $(call ldflags_for_lib, xcb, xcb) +LIBS += $(call ldflags_for_lib, xcursor, Xcursor) +LIBS += $(call ldflags_for_lib, x11, X11) +LIBS += $(call ldflags_for_lib, yajl, yajl) +LIBS += $(call ldflags_for_lib, libev, ev) ifeq ($(UNAME),NetBSD) # We need -idirafter instead of -I to prefer the system’s iconv over GNU libiconv @@ -75,12 +75,12 @@ endif ifeq ($(UNAME),OpenBSD) CFLAGS += -I${X11BASE}/include -LDFLAGS += -liconv +LIBS += -liconv LDFLAGS += -L${X11BASE}/lib endif ifeq ($(UNAME),FreeBSD) -LDFLAGS += -liconv +LIBS += -liconv endif # Fallback for libyajl 1 which did not include yajl_version.h. We need @@ -102,7 +102,7 @@ endif ifeq ($(COVERAGE),1) CFLAGS += -fprofile-arcs -ftest-coverage -LDFLAGS += -lgcov +LIBS += -lgcov endif # Don’t print command lines which are run diff --git a/i3-config-wizard/Makefile b/i3-config-wizard/Makefile index 51b030f2..688df11a 100644 --- a/i3-config-wizard/Makefile +++ b/i3-config-wizard/Makefile @@ -15,7 +15,7 @@ HEADERS:=$(wildcard *.h) all: cfgparse.y.o cfgparse.yy.o ${FILES} echo "LINK i3-config-wizard" - $(CC) -o i3-config-wizard $^ $(LDFLAGS) + $(CC) $(LDFLAGS) -o i3-config-wizard $^ $(LIBS) cfgparse.yy.o: cfgparse.l cfgparse.y.o ${HEADERS} echo "LEX $<" diff --git a/i3-input/Makefile b/i3-input/Makefile index 12658dcd..498cfb50 100644 --- a/i3-input/Makefile +++ b/i3-input/Makefile @@ -14,7 +14,7 @@ HEADERS=$(wildcard *.h) all: ${FILES} echo "LINK i3-input" - $(CC) -o i3-input ${FILES} $(LDFLAGS) + $(CC) $(LDFLAGS) -o i3-input ${FILES} $(LIBS) install: all echo "INSTALL" diff --git a/i3-msg/Makefile b/i3-msg/Makefile index 29de9263..7ea19e60 100644 --- a/i3-msg/Makefile +++ b/i3-msg/Makefile @@ -16,7 +16,7 @@ HEADERS=$(wildcard *.h) all: ${FILES} echo "LINK i3-msg" - $(CC) -o i3-msg ${FILES} $(LDFLAGS) + $(CC) $(LDFLAGS) -o i3-msg ${FILES} $(LIBS) install: all echo "INSTALL" diff --git a/i3-nagbar/Makefile b/i3-nagbar/Makefile index 76b1ca4c..c9eec446 100644 --- a/i3-nagbar/Makefile +++ b/i3-nagbar/Makefile @@ -14,7 +14,7 @@ HEADERS=$(wildcard *.h) all: ${FILES} echo "LINK i3-nagbar" - $(CC) -o i3-nagbar ${FILES} $(LDFLAGS) + $(CC) $(LDFLAGS) -o i3-nagbar ${FILES} $(LIBS) install: all echo "INSTALL" -- 2.39.5