8 SYSCONFDIR=$(PREFIX)/etc
10 GIT_VERSION:="$(shell git describe --tags --always) ($(shell git log --pretty=format:%cd --date=short -n1))"
11 VERSION:=$(shell git describe --tags --abbrev=0)
16 # unused-function, unused-label, unused-variable are turned on by -Wall
17 # We don’t want unused-parameter because of the use of many callbacks
18 CFLAGS += -Wunused-value
20 CFLAGS += -I/usr/local/include
21 CFLAGS += -DI3_VERSION=\"${GIT_VERSION}\"
23 # Check if pkg-config is installed, because without pkg-config, the following
24 # check for the version of libxcb cannot be done.
25 ifeq ($(shell which pkg-config 2>/dev/null 1>/dev/null || echo 1),1)
26 $(error "pkg-config was not found")
29 ifeq ($(shell pkg-config --exists xcb-keysyms || echo 1),1)
30 $(error "pkg-config could not find xcb-keysyms.pc")
33 ifeq ($(shell pkg-config --exact-version=0.3.3 xcb-keysyms && echo 1),1)
34 # xcb-keysyms fixed API from 0.3.3 to 0.3.4, so for some months, we will
35 # have this here. Distributions should upgrade their libxcb in the meantime.
36 CFLAGS += -DOLD_XCB_KEYSYMS_API
40 LDFLAGS += -lxcb-keysyms
41 ifeq ($(shell pkg-config --exists xcb-util || echo 1),1)
42 CFLAGS += -DXCB_COMPAT
45 LDFLAGS += -lxcb-event
49 LDFLAGS += -lxcb-icccm
50 LDFLAGS += -lxcb-xinerama
51 LDFLAGS += -lxcb-randr
56 LDFLAGS += -L/usr/local/lib -L/usr/pkg/lib
58 ifeq ($(UNAME),NetBSD)
59 # We need -idirafter instead of -I to prefer the system’s iconv over GNU libiconv
60 CFLAGS += -idirafter /usr/pkg/include
61 LDFLAGS += -Wl,-rpath,/usr/local/lib -Wl,-rpath,/usr/pkg/lib
64 ifeq ($(UNAME),OpenBSD)
65 CFLAGS += -I${X11BASE}/include
67 LDFLAGS += -L${X11BASE}/lib
70 ifeq ($(UNAME),FreeBSD)
74 # Fallback for libyajl 1 which did not include yajl_version.h. We need
75 # YAJL_MAJOR from that file to decide which code path should be used.
76 CFLAGS += -idirafter yajl-fallback
78 ifneq (,$(filter Linux GNU GNU/%, $(UNAME)))
79 CFLAGS += -D_GNU_SOURCE
83 # Extended debugging flags, macros shall be available in gcc
90 # Don’t print command lines which are run
93 # Always remake the following targets
94 .PHONY: install clean dist distclean