]> git.sur5r.net Git - i3/i3/blobdiff - common.mk
Implement a new parser for commands. (+test)
[i3/i3] / common.mk
index 08d26b7172d27426f5cd0f2af5ae25ce6a231c3f..537d4dda5d43e492a144a5a0fc19290206ab1c00 100644 (file)
--- a/common.mk
+++ b/common.mk
@@ -2,6 +2,8 @@ UNAME=$(shell uname)
 DEBUG=1
 COVERAGE=0
 INSTALL=install
+FLEX=flex
+BISON=bison
 ifndef PREFIX
   PREFIX=/usr
 endif
@@ -22,12 +24,16 @@ endif
 
 # An easier way to get CFLAGS and LDFLAGS falling back in case there's
 # no pkg-config support for certain libraries.
+#
 # NOTE that you must not use a blank after comma when calling this:
 #     $(call ldflags_for_lib name, fallback) # bad
 #     $(call ldflags_for_lib name,fallback) # good
 # Otherwise, the compiler will get -l foo instead of -lfoo
-cflags_for_lib = $(shell pkg-config --silence-errors --cflags $(1))
-ldflags_for_lib = $(shell pkg-config --exists $(1) && pkg-config --libs $(1) || echo -l$(2))
+#
+# We redirect stderr to /dev/null because pkg-config prints an error if support
+# for gnome-config was enabled but gnome-config is not actually installed.
+cflags_for_lib = $(shell pkg-config --silence-errors --cflags $(1) 2>/dev/null)
+ldflags_for_lib = $(shell pkg-config --exists 2>/dev/null $(1) && pkg-config --libs $(1) 2>/dev/null || echo -l$(2))
 
 CFLAGS += -std=c99
 CFLAGS += -pipe
@@ -37,7 +43,7 @@ CFLAGS += -Wall
 CFLAGS += -Wunused-value
 CFLAGS += -Iinclude
 CFLAGS += $(call cflags_for_lib, xcb-keysyms)
-ifeq ($(shell pkg-config --exists xcb-util || echo 1),1)
+ifeq ($(shell pkg-config --exists xcb-util 2>/dev/null || echo 1),1)
 CPPFLAGS += -DXCB_COMPAT
 CFLAGS += $(call cflags_for_lib, xcb-atom)
 CFLAGS += $(call cflags_for_lib, xcb-aux)
@@ -53,19 +59,20 @@ CFLAGS += $(call cflags_for_lib, x11)
 CFLAGS += $(call cflags_for_lib, yajl)
 CFLAGS += $(call cflags_for_lib, libev)
 CFLAGS += $(call cflags_for_lib, libpcre)
+CFLAGS += $(call cflags_for_lib, libstartup-notification-1.0)
 CPPFLAGS += -DI3_VERSION=\"${GIT_VERSION}\"
 CPPFLAGS += -DSYSCONFDIR=\"${SYSCONFDIR}\"
-CPPFLAGS += -DTERM_EMU=\"$(TERM_EMU)\"
 
-ifeq ($(shell pkg-config --atleast-version=8.10 libpcre && echo 1),1)
+ifeq ($(shell pkg-config --atleast-version=8.10 libpcre 2>/dev/null && echo 1),1)
 CPPFLAGS += -DPCRE_HAS_UCP=1
 endif
 
 LIBS += -lm
+LIBS += -lrt
 LIBS += -L $(TOPDIR)/libi3 -li3
 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)
+ifeq ($(shell pkg-config --exists xcb-util 2>/dev/null || echo 1),1)
 LIBS += $(call ldflags_for_lib, xcb-atom,xcb-atom)
 LIBS += $(call ldflags_for_lib, xcb-aux,xcb-aux)
 else
@@ -80,6 +87,7 @@ LIBS += $(call ldflags_for_lib, x11,X11)
 LIBS += $(call ldflags_for_lib, yajl,yajl)
 LIBS += $(call ldflags_for_lib, libev,ev)
 LIBS += $(call ldflags_for_lib, libpcre,pcre)
+LIBS += $(call ldflags_for_lib, libstartup-notification-1.0,startup-notification-1)
 
 # Please test if -Wl,--as-needed works on your platform and send me a patch.
 # it is known not to work on Darwin (Mac OS X)