X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=common.mk;h=989ed5ea81c0800000bad75348be20bfdb9892d5;hb=4622cde7b785b522b29d66c7d9bdcc9aa1eeb452;hp=d6a7572f94fd463a6fb3844a0cdfd2f71d15267f;hpb=0b4ee7a1da6f1c76b71a690fd0f2300e212d6a95;p=i3%2Fi3 diff --git a/common.mk b/common.mk index d6a7572f..989ed5ea 100644 --- a/common.mk +++ b/common.mk @@ -14,10 +14,21 @@ ifndef SYSCONFDIR SYSCONFDIR=$(PREFIX)/etc endif endif -# The escaping is absurd, but we need to escape for shell, sed, make, define -GIT_VERSION:="$(shell git describe --tags --always) ($(shell git log --pretty=format:%cd --date=short -n1), branch $(shell [ -f $(TOPDIR)/.git/HEAD ] && sed 's/ref: refs\/heads\/\(.*\)/\\\\\\"\1\\\\\\"/g' $(TOPDIR)/.git/HEAD || echo 'unknown'))" -VERSION:=$(shell git describe --tags --abbrev=0) +# 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/::)\")' +endif + +MAJOR_VERSION := $(shell echo ${VERSION} | cut -d '.' -f 1) +MINOR_VERSION := $(shell echo ${VERSION} | cut -d '.' -f 2) +PATCH_VERSION := $(shell echo ${VERSION} | cut -d '.' -f 3) +ifeq (${PATCH_VERSION},) +PATCH_VERSION := 0 +endif ## Generic flags @@ -40,8 +51,12 @@ I3_CFLAGS += -Wall I3_CFLAGS += -Wunused-value I3_CFLAGS += -Iinclude -I3_CPPFLAGS = -DI3_VERSION=\"${GIT_VERSION}\" +I3_CPPFLAGS = -DI3_VERSION=\"${I3_VERSION}\" +I3_CPPFLAGS += -DMAJOR_VERSION=${MAJOR_VERSION} +I3_CPPFLAGS += -DMINOR_VERSION=${MINOR_VERSION} +I3_CPPFLAGS += -DPATCH_VERSION=${PATCH_VERSION} I3_CPPFLAGS += -DSYSCONFDIR=\"${SYSCONFDIR}\" +I3_CPPFLAGS += -DI3__FILE__=__FILE__ ## Libraries flags @@ -63,9 +78,6 @@ endif 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)) - -LIBS += -L $(TOPDIR) -li3 - # XCB common stuff XCB_CFLAGS := $(call cflags_for_lib, xcb) XCB_CFLAGS += $(call cflags_for_lib, xcb-event) @@ -123,6 +135,15 @@ PCRE_LIBS := $(call ldflags_for_lib, libpcre,pcre) LIBSN_CFLAGS := $(call cflags_for_lib, libstartup-notification-1.0) LIBSN_LIBS := $(call ldflags_for_lib, libstartup-notification-1.0,startup-notification-1) +# Pango +PANGO_CFLAGS := $(call cflags_for_lib, cairo) +PANGO_CFLAGS += $(call cflags_for_lib, pangocairo) +I3_CPPFLAGS += -DPANGO_SUPPORT=1 +PANGO_LIBS := $(call ldflags_for_lib, cairo) +PANGO_LIBS += $(call ldflags_for_lib, pangocairo) + +# libi3 +LIBS = -L$(TOPDIR) -li3 ## Platform-specific flags