6 # Check if pkg-config is installed, we need it for building CFLAGS/LIBS
7 ifeq ($(shell which $(PKG_CONFIG) 2>/dev/null 1>/dev/null || echo 1),1)
8 $(error "$(PKG_CONFIG) was not found")
14 CPPFLAGS += -D_GNU_SOURCE
15 CFLAGS += $(shell $(PKG_CONFIG) --cflags cairo xcb-dpms xcb-xinerama xcb-atom xcb-image xcb-xkb xkbcommon xkbcommon-x11)
16 LIBS += $(shell $(PKG_CONFIG) --libs cairo xcb-dpms xcb-xinerama xcb-atom xcb-image xcb-xkb xkbcommon xkbcommon-x11)
21 FILES:=$(wildcard *.c)
24 VERSION:=$(shell git describe --tags --abbrev=0)
25 GIT_VERSION:="$(shell git describe --tags --always) ($(shell git log --pretty=format:%cd --date=short -n1))"
26 CPPFLAGS += -DVERSION=\"${GIT_VERSION}\"
28 .PHONY: install clean uninstall
33 $(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
36 rm -f i3lock ${FILES} i3lock-${VERSION}.tar.gz
39 $(INSTALL) -d $(DESTDIR)$(PREFIX)/bin
40 $(INSTALL) -d $(DESTDIR)$(SYSCONFDIR)/pam.d
41 $(INSTALL) -m 755 i3lock $(DESTDIR)$(PREFIX)/bin/i3lock
42 $(INSTALL) -m 644 i3lock.pam $(DESTDIR)$(SYSCONFDIR)/pam.d/i3lock
45 rm -f $(DESTDIR)$(PREFIX)/bin/i3lock
48 [ ! -d i3lock-${VERSION} ] || rm -rf i3lock-${VERSION}
49 [ ! -e i3lock-${VERSION}.tar.bz2 ] || rm i3lock-${VERSION}.tar.bz2
50 mkdir i3lock-${VERSION}
51 cp *.c *.h i3lock.1 i3lock.pam Makefile LICENSE README CHANGELOG i3lock-${VERSION}
52 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
53 tar cfj i3lock-${VERSION}.tar.bz2 i3lock-${VERSION}
54 rm -rf i3lock-${VERSION}