4 GIT_VERSION:="$(shell git describe --tags --always) ($(shell git log --pretty=format:%cd --date=short -n1))"
5 VERSION:=$(shell git describe --tags --abbrev=0)
10 # unused-function, unused-label, unused-variable are turned on by -Wall
11 # We don’t want unused-parameter because of the use of many callbacks
12 CFLAGS += -Wunused-value
14 CFLAGS += -I/usr/local/include
15 CFLAGS += -DI3_VERSION=\"${GIT_VERSION}\"
17 # Check if pkg-config is installed, because without pkg-config, the following
18 # check for the version of libxcb cannot be done.
19 ifeq ($(shell which pkg-config 2>/dev/null 1>/dev/null || echo 1),1)
20 $(error "pkg-config was not found")
23 ifeq ($(shell pkg-config --exists xcb-keysyms || echo 1),1)
24 $(error "pkg-config could not find xcb-keysyms.pc")
27 ifeq ($(shell pkg-config --exact-version=0.3.3 xcb-keysyms && echo 1),1)
28 # xcb-keysyms fixed API from 0.3.3 to 0.3.4, so for some months, we will
29 # have this here. Distributions should upgrade their libxcb in the meantime.
30 CFLAGS += -DOLD_XCB_KEYSYMS_API
34 LDFLAGS += -lxcb-event
35 LDFLAGS += -lxcb-property
36 LDFLAGS += -lxcb-keysyms
39 LDFLAGS += -lxcb-icccm
40 LDFLAGS += -lxcb-xinerama
41 LDFLAGS += -lxcb-randr
45 LDFLAGS += -L/usr/local/lib -L/usr/pkg/lib
47 ifeq ($(UNAME),NetBSD)
48 # We need -idirafter instead of -I to prefer the system’s iconv over GNU libiconv
49 CFLAGS += -idirafter /usr/pkg/include
50 LDFLAGS += -Wl,-rpath,/usr/local/lib -Wl,-rpath,/usr/pkg/lib
53 ifeq ($(UNAME),OpenBSD)
54 CFLAGS += -I${X11BASE}/include
56 LDFLAGS += -L${X11BASE}/lib
59 ifeq ($(UNAME),FreeBSD)
63 ifneq (,$(filter Linux GNU GNU/%, $(UNAME)))
64 CFLAGS += -D_GNU_SOURCE
68 # Extended debugging flags, macros shall be available in gcc
75 # Don’t print command lines which are run
78 # Always remake the following targets
79 .PHONY: install clean dist distclean