Makefile (1101B)
1 OUT = sxhkd 2 VERCMD ?= git describe --tags 2> /dev/null 3 VERSION := $(shell $(VERCMD) || cat VERSION) 4 5 CPPFLAGS += -D_POSIX_C_SOURCE=200112L -DVERSION=\"$(VERSION)\" 6 CFLAGS += -std=c99 -pedantic -Wall -Wextra 7 LDFLAGS ?= 8 LDLIBS = $(LDFLAGS) -lxcb -lxcb-keysyms 9 10 PREFIX ?= /usr/local 11 BINPREFIX ?= $(PREFIX)/bin 12 MANPREFIX ?= $(PREFIX)/share/man 13 DOCPREFIX ?= $(PREFIX)/share/doc/$(OUT) 14 15 all: $(OUT) 16 17 debug: CFLAGS += -O0 -g 18 debug: CPPFLAGS += -DDEBUG 19 debug: $(OUT) 20 21 VPATH = src 22 OBJ = 23 24 include sourcedeps.mk 25 26 $(OBJ): Makefile 27 28 $(OUT): $(OBJ) 29 30 install: 31 mkdir -p "$(DESTDIR)$(BINPREFIX)" 32 cp -pf $(OUT) "$(DESTDIR)$(BINPREFIX)" 33 mkdir -p "$(DESTDIR)$(MANPREFIX)"/man1 34 cp -p doc/$(OUT).1 "$(DESTDIR)$(MANPREFIX)"/man1 35 mkdir -p "$(DESTDIR)$(DOCPREFIX)" 36 cp -pr examples "$(DESTDIR)$(DOCPREFIX)"/examples 37 38 uninstall: 39 rm -f "$(DESTDIR)$(BINPREFIX)"/$(OUT) 40 rm -f "$(DESTDIR)$(MANPREFIX)"/man1/$(OUT).1 41 rm -rf "$(DESTDIR)$(DOCPREFIX)" 42 43 doc: 44 a2x -v -d manpage -f manpage -a revnumber=$(VERSION) doc/$(OUT).1.asciidoc 45 46 clean: 47 rm -f $(OBJ) $(OUT) 48 49 .PHONY: all debug install uninstall doc clean