]> git.sur5r.net Git - i3/i3/blob - common.mk
Remove -ftrampolines as we don’t have nested functions anymore
[i3/i3] / common.mk
1 UNAME=$(shell uname)
2 DEBUG=1
3 INSTALL=install
4 GIT_VERSION:="$(shell git describe --tags --always) ($(shell git log --pretty=format:%cd --date=short -n1))"
5 VERSION:=$(shell git describe --tags --abbrev=0)
6
7 CFLAGS += -std=c99
8 CFLAGS += -pipe
9 CFLAGS += -Wall
10 # unused-function, unused-label, unused-variable are turned on by -Wall
11 # We don’t want unused-parameter because of the use of many callbacks
12 CFLAGS += -Wunused-value
13 CFLAGS += -Iinclude
14 CFLAGS += -I/usr/local/include
15 CFLAGS += -DI3_VERSION=\"${GIT_VERSION}\"
16
17 # Check if pkg-config is installed, because without pkg-config, the following
18 # check for the version of libxcb cannot be done.
19 ifeq ($(shell which pkg-config 2>/dev/null 1>/dev/null || echo 1),1)
20 $(error "pkg-config was not found")
21 endif
22
23 ifeq ($(shell pkg-config --exists xcb-keysyms || echo 1),1)
24 $(error "pkg-config could not find xcb-keysyms.pc")
25 endif
26
27 ifeq ($(shell pkg-config --exact-version=0.3.3 xcb-keysyms && echo 1),1)
28 # xcb-keysyms fixed API from 0.3.3 to 0.3.4, so for some months, we will
29 # have this here. Distributions should upgrade their libxcb in the meantime.
30 CFLAGS += -DOLD_XCB_KEYSYMS_API
31 endif
32
33 LDFLAGS += -lm
34 LDFLAGS += -lxcb-event
35 LDFLAGS += -lxcb-property
36 LDFLAGS += -lxcb-keysyms
37 LDFLAGS += -lxcb-atom
38 LDFLAGS += -lxcb-aux
39 LDFLAGS += -lxcb-icccm
40 LDFLAGS += -lxcb-xinerama
41 LDFLAGS += -lxcb-randr
42 LDFLAGS += -lxcb
43 LDFLAGS += -lX11
44 LDFLAGS += -lev
45 LDFLAGS += -L/usr/local/lib -L/usr/pkg/lib
46
47 ifeq ($(UNAME),NetBSD)
48 # We need -idirafter instead of -I to prefer the system’s iconv over GNU libiconv
49 CFLAGS += -idirafter /usr/pkg/include
50 LDFLAGS += -Wl,-rpath,/usr/local/lib -Wl,-rpath,/usr/pkg/lib
51 endif
52
53 ifeq ($(UNAME),OpenBSD)
54 CFLAGS += -I${X11BASE}/include
55 LDFLAGS += -liconv
56 LDFLAGS += -L${X11BASE}/lib
57 endif
58
59 ifeq ($(UNAME),FreeBSD)
60 LDFLAGS += -liconv
61 endif
62
63 ifneq (,$(filter Linux GNU GNU/%, $(UNAME)))
64 CFLAGS += -D_GNU_SOURCE
65 endif
66
67 ifeq ($(DEBUG),1)
68 # Extended debugging flags, macros shall be available in gcc
69 CFLAGS += -gdwarf-2
70 CFLAGS += -g3
71 else
72 CFLAGS += -O2
73 endif
74
75 # Don’t print command lines which are run
76 .SILENT:
77
78 # Always remake the following targets
79 .PHONY: install clean dist distclean
80