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-event
41 LDFLAGS += -lxcb-property
42 LDFLAGS += -lxcb-keysyms
43 ifeq ($(shell pkg-config --exists xcb-util || echo 1),1)
44 CFLAGS += -DXCB_COMPAT
50 LDFLAGS += -lxcb-icccm
51 LDFLAGS += -lxcb-xinerama
52 LDFLAGS += -lxcb-randr
57 LDFLAGS += -L/usr/local/lib -L/usr/pkg/lib
59 ifeq ($(UNAME),NetBSD)
60 # We need -idirafter instead of -I to prefer the system’s iconv over GNU libiconv
61 CFLAGS += -idirafter /usr/pkg/include
62 LDFLAGS += -Wl,-rpath,/usr/local/lib -Wl,-rpath,/usr/pkg/lib
65 ifeq ($(UNAME),OpenBSD)
66 CFLAGS += -I${X11BASE}/include
68 LDFLAGS += -L${X11BASE}/lib
71 ifeq ($(UNAME),FreeBSD)
75 ifneq (,$(filter Linux GNU GNU/%, $(UNAME)))
76 CFLAGS += -D_GNU_SOURCE
80 # Extended debugging flags, macros shall be available in gcc
87 # Don’t print command lines which are run
90 # Always remake the following targets
91 .PHONY: install clean dist distclean