5 # Check if pkg-config is installed, we need it for building CFLAGS/LIBS
6 ifeq ($(shell which pkg-config 2>/dev/null 1>/dev/null || echo 1),1)
7 $(error "pkg-config was not found")
13 CPPFLAGS += -D_GNU_SOURCE
14 CFLAGS += $(shell pkg-config --cflags xcb-dpms xcb-xinerama xkbcommon xkbfile x11 x11-xcb)
15 LIBS += $(shell pkg-config --libs xcb-dpms xcb-xinerama xcb-image xkbcommon xkbfile x11 x11-xcb)
17 CFLAGS += $(shell pkg-config --cflags cairo)
18 LIBS += $(shell pkg-config --libs cairo)
20 CPPFLAGS += -DNOLIBCAIRO
25 FILES:=$(wildcard *.c)
28 VERSION:=$(shell git describe --tags --abbrev=0)
29 GIT_VERSION:="$(shell git describe --tags --always) ($(shell git log --pretty=format:%cd --date=short -n1))"
30 CPPFLAGS += -DVERSION=\"${GIT_VERSION}\"
32 .PHONY: install clean uninstall
37 $(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
40 rm -f i3lock ${FILES} i3lock-${VERSION}.tar.gz
43 $(INSTALL) -d $(DESTDIR)$(PREFIX)/bin
44 $(INSTALL) -d $(DESTDIR)$(SYSCONFDIR)/pam.d
45 $(INSTALL) -m 755 i3lock $(DESTDIR)$(PREFIX)/bin/i3lock
46 $(INSTALL) -m 644 i3lock.pam $(DESTDIR)$(SYSCONFDIR)/pam.d/i3lock
49 rm -f $(DESTDIR)$(PREFIX)/bin/i3lock
52 [ ! -d i3lock-${VERSION} ] || rm -rf i3lock-${VERSION}
53 [ ! -e i3lock-${VERSION}.tar.bz2 ] || rm i3lock-${VERSION}.tar.bz2
54 mkdir i3lock-${VERSION}
55 cp *.c *.h i3lock.1 i3lock.pam Makefile LICENSE README CHANGELOG i3lock-${VERSION}
56 sed -e 's/^GIT_VERSION:=\(.*\)/GIT_VERSION:=$(shell /bin/echo '${GIT_VERSION}' | sed 's/\\/\\\\/g')/g;s/^VERSION:=\(.*\)/VERSION:=${VERSION}/g' Makefile > i3lock-${VERSION}/Makefile
57 tar cfj i3lock-${VERSION}.tar.bz2 i3lock-${VERSION}
58 rm -rf i3lock-${VERSION}