X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=common.mk;h=2bd879d45a709241bd73b10c0fa879d6d87d5f6b;hb=9bf346c7a00f0783e3754d45dda331ff91ec9a64;hp=878aeac10293c3af148e3f9bda91233572f4cc9d;hpb=dc463077d62fc7f900b61f228042380623b39cf1;p=i3%2Fi3 diff --git a/common.mk b/common.mk index 878aeac1..2bd879d4 100644 --- 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) @@ -85,15 +93,10 @@ XCB_CFLAGS := $(call cflags_for_lib, xcb) XCB_CFLAGS += $(call cflags_for_lib, xcb-event) XCB_LIBS := $(call ldflags_for_lib, xcb,xcb) XCB_LIBS += $(call ldflags_for_lib, xcb-event,xcb-event) -ifeq ($(shell $(PKG_CONFIG) --exists xcb-util 2>/dev/null || echo 1),1) -XCB_CFLAGS += $(call cflags_for_lib, xcb-atom) -XCB_CFLAGS += $(call cflags_for_lib, xcb-aux) -XCB_LIBS += $(call ldflags_for_lib, xcb-atom,xcb-atom) -XCB_LIBS += $(call ldflags_for_lib, xcb-aux,xcb-aux) -XCB_CPPFLAGS+= -DXCB_COMPAT -else XCB_CFLAGS += $(call cflags_for_lib, xcb-util) XCB_LIBS += $(call ldflags_for_lib, xcb-util) +ifneq ($(shell $(PKG_CONFIG) --atleast-version=0.3.8 xcb-util 2>/dev/null && echo 1),1) +$(error "xcb-util >= 0.3.8 not found") endif XCB_XKB_LIBS := $(call ldflags_for_lib, xcb-xkb,xcb-xkb) @@ -118,6 +121,10 @@ 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) +# 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) YAJL_LIBS := $(call ldflags_for_lib, yajl,yajl)