]> git.sur5r.net Git - i3/i3/blob - common.mk
libXcursor support (themed cursors).
[i3/i3] / common.mk
1 UNAME=$(shell uname)
2 DEBUG=1
3 INSTALL=install
4 PREFIX=/usr
5 ifeq ($(PREFIX),/usr)
6 SYSCONFDIR=/etc
7 else
8 SYSCONFDIR=$(PREFIX)/etc
9 endif
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)
13
14 CFLAGS += -std=c99
15 CFLAGS += -pipe
16 CFLAGS += -Wall
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
20 CFLAGS += -Iinclude
21 CFLAGS += -I/usr/local/include
22 CFLAGS += -DI3_VERSION=\"${GIT_VERSION}\"
23 CFLAGS += -DSYSCONFDIR=\"${SYSCONFDIR}\"
24
25 LDFLAGS += -lm
26 LDFLAGS += -lxcb-event
27 LDFLAGS += -lxcb-property
28 LDFLAGS += -lxcb-keysyms
29 LDFLAGS += -lxcb-atom
30 LDFLAGS += -lxcb-aux
31 LDFLAGS += -lxcb-icccm
32 LDFLAGS += -lxcb-xinerama
33 LDFLAGS += -lxcb-randr
34 LDFLAGS += -lxcb
35 LDFLAGS += -lyajl
36 LDFLAGS += -lXcursor
37 LDFLAGS += -lX11
38 LDFLAGS += -lev
39 LDFLAGS += -L/usr/local/lib -L/usr/pkg/lib
40
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
45 endif
46
47 ifeq ($(UNAME),OpenBSD)
48 CFLAGS += -I${X11BASE}/include
49 LDFLAGS += -liconv
50 LDFLAGS += -L${X11BASE}/lib
51 endif
52
53 ifeq ($(UNAME),FreeBSD)
54 LDFLAGS += -liconv
55 endif
56
57 ifneq (,$(filter Linux GNU GNU/%, $(UNAME)))
58 CFLAGS += -D_GNU_SOURCE
59 endif
60
61 ifeq ($(DEBUG),1)
62 # Extended debugging flags, macros shall be available in gcc
63 CFLAGS += -gdwarf-2
64 CFLAGS += -g3
65 else
66 CFLAGS += -O2
67 CFLAGS += -freorder-blocks-and-partition
68 endif
69
70 # Don’t print command lines which are run
71 .SILENT:
72
73 # Always remake the following targets
74 .PHONY: install clean dist distclean
75