# Fallback for libyajl 1 which did not include yajl_version.h. We need
# YAJL_MAJOR from that file to decide which code path should be used.
CFLAGS += -idirafter $(TOPDIR)/yajl-fallback
-CFLAGS += $(call cflags_for_lib, libev)
LIBS += -lm
LIBS += -L $(TOPDIR) -li3
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)
+
+#libev
+LIBEV_CFLAGS := $(call cflags_for_lib, libev)
+LIBEV_LIBS := $(call ldflags_for_lib, libev,ev)
# libpcre
PCRE_CFLAGS := $(call cflags_for_lib, libpcre)
i3bar_SOURCES := $(wildcard i3bar/src/*.c)
i3bar_HEADERS := $(wildcard i3bar/include/*.h)
-i3bar_CFLAGS =
-i3bar_LIBS =
+i3bar_CFLAGS = $(LIBEV_CFLAGS)
+i3bar_LIBS = $(LIBEV_LIBS)
i3bar_OBJECTS := $(i3bar_SOURCES:.c=.o)
i3_SOURCES := $(filter-out $(i3_SOURCES_GENERATED),$(wildcard src/*.c))
i3_HEADERS_CMDPARSER := $(wildcard include/GENERATED_*.h)
i3_HEADERS := $(filter-out $(i3_HEADERS_CMDPARSER),$(wildcard include/*.h))
-i3_CFLAGS = $(PCRE_CFLAGS) $(LIBSN_CFLAGS)
-i3_LIBS = $(PCRE_LIBS) $(LIBSN_LIBS)
+i3_CFLAGS = $(LIBEV_CFLAGS) $(PCRE_CFLAGS) $(LIBSN_CFLAGS)
+i3_LIBS = $(LIBEV_LIBS) $(PCRE_LIBS) $(LIBSN_LIBS)
i3_OBJECTS := $(i3_SOURCES_GENERATED:.c=.o) $(i3_SOURCES:.c=.o)