8 SYSCONFDIR=$(PREFIX)/etc
10 # The escaping is absurd, but we need to escape for shell, sed, make, define
11 GIT_VERSION:="$(shell git describe --tags --always) ($(shell git log --pretty=format:%cd --date=short -n1), branch $(shell [ -f .git/HEAD ] && sed 's/ref: refs\/heads\/\(.*\)/\\\\\\"\1\\\\\\"/g' .git/HEAD || echo 'unknown'))"
12 VERSION:=$(shell git describe --tags --abbrev=0)
17 # unused-function, unused-label, unused-variable are turned on by -Wall
18 # We don’t want unused-parameter because of the use of many callbacks
19 CFLAGS += -Wunused-value
21 CFLAGS += -I/usr/local/include
22 CFLAGS += -DI3_VERSION=\"${GIT_VERSION}\"
24 # Check if pkg-config is installed, because without pkg-config, the following
25 # check for the version of libxcb cannot be done.
26 ifeq ($(shell which pkg-config 2>/dev/null 1>/dev/null || echo 1),1)
27 $(error "pkg-config was not found")
30 ifeq ($(shell pkg-config --exists xcb-keysyms || echo 1),1)
31 $(error "pkg-config could not find xcb-keysyms.pc")
34 ifeq ($(shell pkg-config --exact-version=0.3.3 xcb-keysyms && echo 1),1)
35 # xcb-keysyms fixed API from 0.3.3 to 0.3.4, so for some months, we will
36 # have this here. Distributions should upgrade their libxcb in the meantime.
37 CFLAGS += -DOLD_XCB_KEYSYMS_API
41 LDFLAGS += -lxcb-event
42 LDFLAGS += -lxcb-property
43 LDFLAGS += -lxcb-keysyms
46 LDFLAGS += -lxcb-icccm
47 LDFLAGS += -lxcb-xinerama
48 LDFLAGS += -lxcb-randr
53 LDFLAGS += -L/usr/local/lib -L/usr/pkg/lib
55 ifeq ($(UNAME),NetBSD)
56 # We need -idirafter instead of -I to prefer the system’s iconv over GNU libiconv
57 CFLAGS += -idirafter /usr/pkg/include
58 LDFLAGS += -Wl,-rpath,/usr/local/lib -Wl,-rpath,/usr/pkg/lib
61 ifeq ($(UNAME),OpenBSD)
62 CFLAGS += -I${X11BASE}/include
64 LDFLAGS += -L${X11BASE}/lib
67 ifeq ($(UNAME),FreeBSD)
71 ifneq (,$(filter Linux GNU GNU/%, $(UNAME)))
72 CFLAGS += -D_GNU_SOURCE
76 # Extended debugging flags, macros shall be available in gcc
83 # Don’t print command lines which are run
86 # Always remake the following targets
87 .PHONY: install clean dist distclean