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}\"
25 LDFLAGS += -lxcb-event
26 LDFLAGS += -lxcb-property
27 LDFLAGS += -lxcb-keysyms
30 LDFLAGS += -lxcb-icccm
31 LDFLAGS += -lxcb-xinerama
32 LDFLAGS += -lxcb-randr
37 LDFLAGS += -L/usr/local/lib -L/usr/pkg/lib
39 ifeq ($(UNAME),NetBSD)
40 # We need -idirafter instead of -I to prefer the system’s iconv over GNU libiconv
41 CFLAGS += -idirafter /usr/pkg/include
42 LDFLAGS += -Wl,-rpath,/usr/local/lib -Wl,-rpath,/usr/pkg/lib
45 ifeq ($(UNAME),OpenBSD)
46 CFLAGS += -I${X11BASE}/include
48 LDFLAGS += -L${X11BASE}/lib
51 ifeq ($(UNAME),FreeBSD)
55 ifneq (,$(filter Linux GNU GNU/%, $(UNAME)))
56 CFLAGS += -D_GNU_SOURCE
60 # Extended debugging flags, macros shall be available in gcc
65 CFLAGS += -freorder-blocks-and-partition
68 # Don’t print command lines which are run
71 # Always remake the following targets
72 .PHONY: install clean dist distclean