]> git.lizzy.rs Git - bspwm.git/blob - Makefile
By default, don't produce a debug executable
[bspwm.git] / Makefile
1 VERSION = 0.1
2
3 CC      = gcc
4 LIBS    = -lm -lxcb -lxcb-icccm -lxcb-ewmh
5 CFLAGS  = -std=c99 -pedantic -Wall -Wextra
6 LDFLAGS = $(LIBS)
7
8 PREFIX    ?= /usr/local
9 BINPREFIX = $(PREFIX)/bin
10
11 WM_SRC = bspwm.c events.c messages.c ewmh.c settings.c helpers.c tree.c types.c rules.c window.c
12 CL_SRC = bspc.c helpers.c
13
14 WM_OBJ = $(WM_SRC:.c=.o)
15 CL_OBJ = $(CL_SRC:.c=.o)
16
17 all: CFLAGS += -Os
18 all: LDFLAGS += -s
19 all: options bspwm bspc
20
21 debug: CFLAGS += -O0 -g -DDEBUG
22 debug: options bspwm bspc
23
24 options:
25         @echo "bspwm build options:"
26         @echo "CC      = $(CC)"
27         @echo "CFLAGS  = $(CFLAGS)"
28         @echo "LDFLAGS = $(LDFLAGS)"
29         @echo "PREFIX  = $(PREFIX)"
30
31 .c.o:
32         @echo "CC $<"
33         @$(CC) $(CFLAGS) -DVERSION=\"$(VERSION)\" -c -o $@ $<
34
35 bspwm: $(WM_OBJ)
36         @echo CC -o $@
37         @$(CC) -o $@ $(WM_OBJ) $(LDFLAGS)
38
39 bspc: $(CL_OBJ)
40         @echo CC -o $@
41         @$(CC) -o $@ $(CL_OBJ) $(LDFLAGS)
42
43 clean:
44         @echo "cleaning"
45         @rm -f $(WM_OBJ) $(CL_OBJ) bsp{wm,c}
46
47 install:
48         @echo "installing executable files to $(DESTDIR)$(BINPREFIX)"
49         @install -D -m 755 bspwm $(DESTDIR)$(BINPREFIX)/bspwm
50         @install -D -m 755 bspc $(DESTDIR)$(BINPREFIX)/bspc
51
52 uninstall:
53         @echo "removing executable files from $(DESTDIR)$(BINPREFIX)"
54         @rm -f $(DESTDIR)$(BINPREFIX)/bsp{wm,c}
55
56 .PHONY: all options clean install uninstall