]> git.sur5r.net Git - i3/i3lock/blob - Makefile
print version number when invoked with -v
[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 CFLAGS += $(shell pkg-config --cflags cairo xcb-keysyms xcb-dpms)
14 LDFLAGS += $(shell pkg-config --libs cairo xcb-keysyms xcb-dpms xcb-image)
15 LDFLAGS += -lpam
16
17 FILES:=$(wildcard *.c)
18 FILES:=$(FILES:.c=.o)
19
20 VERSION:=$(shell git describe --tags --abbrev=0)
21 GIT_VERSION:="$(shell git describe --tags --always) ($(shell git log --pretty=format:%cd --date=short -n1))"
22 CFLAGS += -DVERSION=\"${GIT_VERSION}\"
23
24 .PHONY: install clean uninstall
25
26 all: i3lock
27
28 i3lock: ${FILES}
29         $(CC) -o $@ $^ $(LDFLAGS)
30
31 clean:
32         rm -f i3lock ${FILES} i3lock-${VERSION}.tar.gz
33
34 install: all
35         $(INSTALL) -d $(DESTDIR)$(PREFIX)/bin
36         $(INSTALL) -m 755 i3lock $(DESTDIR)$(PREFIX)/bin/i3lock
37
38 uninstall:
39         rm -f $(DESTDIR)$(PREFIX)/bin/i3lock