]> git.lizzy.rs Git - bspwm.git/blob - Makefile
Generate documentation via `pandoc`
[bspwm.git] / Makefile
1 NAME = bspwm
2 VERSION = 0.7
3
4 CC      = gcc
5 LIBS    = -lm -lxcb -lxcb-icccm -lxcb-ewmh -lxcb-randr
6 CFLAGS  += -std=c99 -pedantic -Wall -Wextra -I$(PREFIX)/include
7 CFLAGS  += -D_POSIX_C_SOURCE=200112L -DVERSION=\"$(VERSION)\"
8 LDFLAGS += -L$(PREFIX)/lib
9
10 PREFIX    ?= /usr/local
11 BINPREFIX = $(PREFIX)/bin
12 MANPREFIX = $(PREFIX)/share/man
13 CPLPREFIX = $(PREFIX)/share/bash-completion/completions
14
15 WM_SRC = bspwm.c events.c messages.c ewmh.c settings.c helpers.c tree.c types.c rules.c window.c
16 WM_OBJ = $(WM_SRC:.c=.o)
17 CL_SRC = bspc.c helpers.c
18 CL_OBJ = $(CL_SRC:.c=.o)
19
20 all: CFLAGS += -Os
21 all: LDFLAGS += -s
22 all: bspwm bspc
23
24 debug: CFLAGS += -O0 -g -DDEBUG
25 debug: bspwm bspc
26
27 include Sourcedeps
28
29 $(WM_OBJ) $(CL_OBJ): Makefile
30
31 .c.o:
32         $(CC) $(CFLAGS) -c -o $@ $<
33
34 bspwm: $(WM_OBJ)
35         $(CC) -o $@ $(WM_OBJ) $(LDFLAGS) $(LIBS)
36
37 bspc: $(CL_OBJ)
38         $(CC) -o $@ $(CL_OBJ) $(LDFLAGS) $(LIBS)
39
40 install:
41         mkdir -p "$(DESTDIR)$(BINPREFIX)"
42         cp -p bsp{wm,c} "$(DESTDIR)$(BINPREFIX)"
43         mkdir -p "$(DESTDIR)$(MANPREFIX)"/man1
44         cp -Pp bsp{wm,c}.1 "$(DESTDIR)$(MANPREFIX)"/man1
45         mkdir -p "$(DESTDIR)$(CPLPREFIX)"
46         cp -p bash_completion "$(DESTDIR)$(CPLPREFIX)"/bspc
47
48 uninstall:
49         rm -f "$(DESTDIR)$(BINPREFIX)"/bsp{wm,c}
50         rm -f "$(DESTDIR)$(MANPREFIX)"/man1/bsp{wm,c}.1
51         rm -f "$(DESTDIR)$(CPLPREFIX)"/bspc
52
53 doc:
54         pandoc --no-wrap -t json doc/README.md | runhaskell doc/man_filter.hs | pandoc --no-wrap -f json -t man --template doc/man.template -V name=$(NAME) -o $(NAME).1
55         pandoc --no-wrap -f markdown -t asciidoc doc/README.md -o README.asciidoc
56         patch -p 1 -i doc/quirks.patch
57
58 clean:
59         rm -f $(WM_OBJ) $(CL_OBJ) bsp{wm,c}
60
61 .PHONY: all debug install uninstall doc clean