]> git.sur5r.net Git - i3/i3lock/blob - Makefile
Bugfix: correctly check for errors when connecting to X11
[i3/i3lock] / Makefile
1 INSTALL=install
2 PREFIX=/usr
3
4 # Check if pkg-config is installed, we need it for building CFLAGS/LDFLAGS
5 ifeq ($(shell which pkg-config 2>/dev/null 1>/dev/null || echo 1),1)
6 $(error "pkg-config was not found")
7 endif
8
9 CFLAGS += -std=c99
10 CFLAGS += -pipe
11 CFLAGS += -Wall
12 CFLAGS += -D_GNU_SOURCE
13 ifndef NOLIBCAIRO
14 CFLAGS += $(shell pkg-config --cflags cairo xcb-keysyms xcb-dpms)
15 LDFLAGS += $(shell pkg-config --libs cairo xcb-keysyms xcb-dpms xcb-image)
16 else
17 CFLAGS += -DNOLIBCAIRO
18 CFLAGS += $(shell pkg-config --cflags xcb-keysyms xcb-dpms)
19 LDFLAGS += $(shell pkg-config --libs xcb-keysyms xcb-dpms xcb-image)
20 endif
21 LDFLAGS += -lpam
22
23 FILES:=$(wildcard *.c)
24 FILES:=$(FILES:.c=.o)
25
26 VERSION:=$(shell git describe --tags --abbrev=0)
27 GIT_VERSION:="$(shell git describe --tags --always) ($(shell git log --pretty=format:%cd --date=short -n1))"
28 CFLAGS += -DVERSION=\"${GIT_VERSION}\"
29
30 .PHONY: install clean uninstall
31
32 all: i3lock
33
34 i3lock: ${FILES}
35         $(CC) -o $@ $^ $(LDFLAGS)
36
37 clean:
38         rm -f i3lock ${FILES} i3lock-${VERSION}.tar.gz
39
40 install: all
41         $(INSTALL) -d $(DESTDIR)$(PREFIX)/bin
42         $(INSTALL) -m 755 i3lock $(DESTDIR)$(PREFIX)/bin/i3lock
43
44 uninstall:
45         rm -f $(DESTDIR)$(PREFIX)/bin/i3lock