]> git.sur5r.net Git - i3/i3/blob - Makefile
bdbd55264f5eb8076583175c0cd773f6b135f1f3
[i3/i3] / Makefile
1 UNAME=$(shell uname)
2 DEBUG=1
3 INSTALL=install
4
5 CFLAGS += -std=c99
6 CFLAGS += -pipe
7 CFLAGS += -Wall
8 CFLAGS += -Iinclude
9 CFLAGS += -I/usr/local/include
10
11 LDFLAGS += -lxcb-wm
12 LDFLAGS += -lxcb-keysyms
13 LDFLAGS += -lxcb-xinerama
14 LDFLAGS += -lX11
15 LDFLAGS += -L/usr/local/lib -L/usr/pkg/lib
16 ifeq ($(UNAME),NetBSD)
17 CFLAGS += -I/usr/pkg/include
18 LDFLAGS += -Wl,-rpath,/usr/local/lib -Wl,-rpath,/usr/pkg/lib
19 endif
20
21 ifeq ($(UNAME),Linux)
22 CFLAGS += -D_GNU_SOURCE
23 endif
24
25 ifeq ($(DEBUG),1)
26 # Extended debugging flags, macros shall be available in gcc
27 CFLAGS += -gdwarf-2
28 CFLAGS += -g3
29 else
30 CFLAGS += -O2
31 endif
32
33 FILES=$(patsubst %.c,%.o,$(wildcard src/*.c))
34 HEADERS=$(wildcard include/*.h)
35
36 src/%.o: src/%.c ${HEADERS}
37         $(CC) $(CFLAGS) -c -o $@ $<
38
39 all: ${FILES}
40         $(CC) -o i3 ${FILES} $(LDFLAGS)
41
42 install: all
43         $(INSTALL) -d -m 0755 $(DESTDIR)/usr/bin
44         $(INSTALL) -m 0755 i3 $(DESTDIR)/usr/bin/
45
46 clean:
47         rm -f src/*.o
48
49 distclean: clean
50         rm -f i3