]> git.sur5r.net Git - i3/i3/blobdiff - common.mk
Deleting VERSION and extracting it from I3_VERSION instead (#2419)
[i3/i3] / common.mk
index d28750426bd4864bf9830d7485dadbc3bed4e1b1..e99f93c8bd90dad1357e1c712cd45f91c8569df4 100644 (file)
--- a/common.mk
+++ b/common.mk
@@ -1,5 +1,6 @@
 UNAME=$(shell uname)
 DEBUG=1
+ASAN=0
 INSTALL=install
 LN=ln
 PKG_CONFIG=pkg-config
@@ -17,12 +18,14 @@ ifndef SYSCONFDIR
   endif
 endif
 
-# In dist tarballs, the version is stored in the I3_VERSION and VERSION files.
-I3_VERSION := '$(shell [ -f $(TOPDIR)/I3_VERSION ] && cat $(TOPDIR)/I3_VERSION)'
-VERSION := '$(shell [ -f $(TOPDIR)/VERSION ] && cat $(TOPDIR)/VERSION)'
-ifeq ('',$(I3_VERSION))
-VERSION := $(shell git describe --tags --abbrev=0)
-I3_VERSION := '$(shell git describe --tags --always) ($(shell git log --pretty=format:%cd --date=short -n1), branch \"$(shell git describe --tags --always --all | sed s:heads/::)\")'
+# In dist and snapshot tarballs, use the I3_VERSION and VERSION files. Otherwise use git information.
+ifeq ($(wildcard .git),)
+  # not in git repository
+  VERSION := $(shell [ -f $(TOPDIR)/I3_VERSION ] && cat $(TOPDIR)/I3_VERSION | cut -d '-' -f 1)
+  I3_VERSION := $(shell [ -f $(TOPDIR)/I3_VERSION ] && cat $(TOPDIR)/I3_VERSION)
+else
+  VERSION := $(shell git describe --tags --abbrev=0)
+  I3_VERSION := '$(shell git describe --tags --always) ($(shell git log --pretty=format:%cd --date=short -n1), branch \"$(shell git describe --tags --always --all | sed s:heads/::)\")'
 endif
 
 MAJOR_VERSION := $(shell echo ${VERSION} | cut -d '.' -f 1)
@@ -42,6 +45,11 @@ else
 CFLAGS ?= -pipe -O2 -freorder-blocks-and-partition
 endif
 
+ifeq ($(ASAN),1)
+CFLAGS += -fsanitize=address -DI3_ASAN_ENABLED
+LDFLAGS += -fsanitize=address
+endif
+
 # Default LDFLAGS that users should be able to override
 LDFLAGS ?= $(as_needed_LDFLAG)
 
@@ -109,14 +117,18 @@ XCB_WM_LIBS   := $(call ldflags_for_lib, xcb-icccm,xcb-icccm)
 XCB_WM_LIBS   += $(call ldflags_for_lib, xcb-xinerama,xcb-xinerama)
 XCB_WM_LIBS   += $(call ldflags_for_lib, xcb-randr,xcb-randr)
 
+# XCB cursor
+XCB_CURSOR_CFLAGS := $(call cflags_for_lib, xcb-cursor)
+XCB_CURSOR_LIBS   := $(call ldflags_for_lib, xcb-cursor,xcb-cursor)
+
 XKB_COMMON_CFLAGS := $(call cflags_for_lib, xkbcommon,xkbcommon)
 XKB_COMMON_LIBS := $(call ldflags_for_lib, xkbcommon,xkbcommon)
 XKB_COMMON_X11_CFLAGS := $(call cflags_for_lib, xkbcommon-x11,xkbcommon-x11)
 XKB_COMMON_X11_LIBS := $(call ldflags_for_lib, xkbcommon-x11,xkbcommon-x11)
 
-# Xcursor
-XCURSOR_CFLAGS := $(call cflags_for_lib, xcb-cursor)
-XCURSOR_LIBS   := $(call ldflags_for_lib, xcb-cursor,xcb-cursor)
+# XCB xrm
+XCB_XRM_CFLAGS := $(call cflags_for_lib, xcb-xrm)
+XCB_XRM_LIBS   := $(call ldflags_for_lib, xcb-xrm,xcb-xrm)
 
 # yajl
 YAJL_CFLAGS := $(call cflags_for_lib, yajl)
@@ -141,6 +153,9 @@ LIBSN_LIBS   := $(call ldflags_for_lib, libstartup-notification-1.0,startup-noti
 PANGO_CFLAGS := $(call cflags_for_lib, cairo)
 PANGO_CFLAGS += $(call cflags_for_lib, pangocairo)
 I3_CPPFLAGS  += -DPANGO_SUPPORT=1
+ifeq ($(shell $(PKG_CONFIG) --atleast-version=1.14.4 cairo 2>/dev/null && echo 1),1)
+I3_CPPFLAGS  += -DCAIRO_SUPPORT=1
+endif
 PANGO_LIBS   := $(call ldflags_for_lib, cairo)
 PANGO_LIBS   += $(call ldflags_for_lib, pangocairo)