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}\"
23 CFLAGS += -DSYSCONFDIR=\"${SYSCONFDIR}\"
26 LDFLAGS += -lxcb-event
27 LDFLAGS += -lxcb-property
28 LDFLAGS += -lxcb-keysyms
31 LDFLAGS += -lxcb-icccm
32 LDFLAGS += -lxcb-xinerama
33 LDFLAGS += -lxcb-randr
39 LDFLAGS += -L/usr/local/lib -L/usr/pkg/lib
41 ifeq ($(UNAME),NetBSD)
42 # We need -idirafter instead of -I to prefer the system’s iconv over GNU libiconv
43 CFLAGS += -idirafter /usr/pkg/include
44 LDFLAGS += -Wl,-rpath,/usr/local/lib -Wl,-rpath,/usr/pkg/lib
47 ifeq ($(UNAME),OpenBSD)
48 CFLAGS += -I${X11BASE}/include
50 LDFLAGS += -L${X11BASE}/lib
53 ifeq ($(UNAME),FreeBSD)
57 ifneq (,$(filter Linux GNU GNU/%, $(UNAME)))
58 CFLAGS += -D_GNU_SOURCE
62 # Extended debugging flags, macros shall be available in gcc
67 CFLAGS += -freorder-blocks-and-partition
70 # Don’t print command lines which are run
73 # Always remake the following targets
74 .PHONY: install clean dist distclean