]> git.sur5r.net Git - i3/i3/blob - common.mk
first step of the big refactoring ("tree" branch).
[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 GIT_VERSION:="$(shell git describe --tags --always) ($(shell git log --pretty=format:%cd --date=short -n1))"
11 VERSION:=$(shell git describe --tags --abbrev=0)
12
13 CFLAGS += -std=c99
14 CFLAGS += -pipe
15 CFLAGS += -Wall
16 # unused-function, unused-label, unused-variable are turned on by -Wall
17 # We don’t want unused-parameter because of the use of many callbacks
18 CFLAGS += -Wunused-value
19 CFLAGS += -Iinclude
20 CFLAGS += -I/usr/local/include
21 CFLAGS += -DI3_VERSION=\"${GIT_VERSION}\"
22
23 LDFLAGS += -lm
24 LDFLAGS += -lxcb-event
25 LDFLAGS += -lxcb-property
26 LDFLAGS += -lxcb-keysyms
27 LDFLAGS += -lxcb-atom
28 LDFLAGS += -lxcb-aux
29 LDFLAGS += -lxcb-icccm
30 LDFLAGS += -lxcb-xinerama
31 LDFLAGS += -lxcb-randr
32 LDFLAGS += -lxcb
33 LDFLAGS += -lyajl
34 LDFLAGS += -lX11
35 LDFLAGS += -lev
36 LDFLAGS += -L/usr/local/lib -L/usr/pkg/lib
37
38 ifeq ($(UNAME),NetBSD)
39 # We need -idirafter instead of -I to prefer the system’s iconv over GNU libiconv
40 CFLAGS += -idirafter /usr/pkg/include
41 LDFLAGS += -Wl,-rpath,/usr/local/lib -Wl,-rpath,/usr/pkg/lib
42 endif
43
44 ifeq ($(UNAME),OpenBSD)
45 CFLAGS += -I${X11BASE}/include
46 LDFLAGS += -liconv
47 LDFLAGS += -L${X11BASE}/lib
48 endif
49
50 ifeq ($(UNAME),FreeBSD)
51 LDFLAGS += -liconv
52 endif
53
54 ifneq (,$(filter Linux GNU GNU/%, $(UNAME)))
55 CFLAGS += -D_GNU_SOURCE
56 endif
57
58 ifeq ($(DEBUG),1)
59 # Extended debugging flags, macros shall be available in gcc
60 CFLAGS += -gdwarf-2
61 CFLAGS += -g3
62 else
63 CFLAGS += -O2
64 endif
65
66 # Don’t print command lines which are run
67 .SILENT:
68
69 # Always remake the following targets
70 .PHONY: install clean dist distclean
71