X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;ds=inline;f=Makefile;h=c13b887075f076a11e7eec612b3da9c481ad97e4;hb=3059978fc156a16bfaa1372ac8c9404e4abe4b0b;hp=61ca9224b1af0d6b6249392001908abf470c9ad4;hpb=705709276ad9ef9bc5b0aae078ef654c070952db;p=bspwm.git diff --git a/Makefile b/Makefile index 61ca922..c13b887 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,59 @@ -# CFLAGS=-Wall -g -pendantic +VERSION = 0.7 -all: - gcc -std=c99 -Wall -g -pedantic -llua -lxcb -o bspwm main.c utils.c settings.c luautils.c messages.c events.c +CC = gcc +LIBS = -lm -lxcb -lxcb-icccm -lxcb-ewmh -lxcb-randr +CFLAGS += -std=c99 -pedantic -Wall -Wextra -I$(PREFIX)/include +CFLAGS += -D_POSIX_C_SOURCE=200112L -DVERSION=\"$(VERSION)\" +LDFLAGS += -L$(PREFIX)/lib + +PREFIX ?= /usr/local +BINPREFIX = $(PREFIX)/bin +MANPREFIX = $(PREFIX)/share/man +CPLPREFIX = $(PREFIX)/share/bash-completion/completions + +WM_SRC = bspwm.c events.c messages.c ewmh.c settings.c helpers.c tree.c types.c rules.c window.c +WM_OBJ = $(WM_SRC:.c=.o) +CL_SRC = bspc.c helpers.c +CL_OBJ = $(CL_SRC:.c=.o) + +all: CFLAGS += -Os +all: LDFLAGS += -s +all: bspwm bspc + +debug: CFLAGS += -O0 -g -DDEBUG +debug: bspwm bspc + +include Sourcedeps + +$(WM_OBJ) $(CL_OBJ): Makefile + +.c.o: + $(CC) $(CFLAGS) -c -o $@ $< + +bspwm: $(WM_OBJ) + $(CC) -o $@ $(WM_OBJ) $(LDFLAGS) $(LIBS) + +bspc: $(CL_OBJ) + $(CC) -o $@ $(CL_OBJ) $(LDFLAGS) $(LIBS) + +install: + mkdir -p "$(DESTDIR)$(BINPREFIX)" + cp -p bsp{wm,c} "$(DESTDIR)$(BINPREFIX)" + mkdir -p "$(DESTDIR)$(MANPREFIX)"/man1 + cp -Pp doc/bsp{wm,c}.1 "$(DESTDIR)$(MANPREFIX)"/man1 + mkdir -p "$(DESTDIR)$(CPLPREFIX)" + cp -p bash_completion "$(DESTDIR)$(CPLPREFIX)"/bspc + +uninstall: + rm -f "$(DESTDIR)$(BINPREFIX)"/bsp{wm,c} + rm -f "$(DESTDIR)$(MANPREFIX)"/man1/bsp{wm,c}.1 + rm -f "$(DESTDIR)$(CPLPREFIX)"/bspc + +doc: + a2x -v -d manpage -f manpage -a revnumber=$(VERSION) doc/bspwm.1.txt + cat doc/header.txt doc/bspwm.1.txt > README.asciidoc clean: - rm -f bspwm + rm -f $(WM_OBJ) $(CL_OBJ) bsp{wm,c} + +.PHONY: all debug install uninstall doc clean