]> git.sur5r.net Git - i3/i3lock/blob - Makefile
add CHANGELOG file
[i3/i3lock] / Makefile
1 INSTALL=install
2 PREFIX=/usr
3 SYSCONFDIR=/etc
4
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")
8 endif
9
10 CFLAGS += -std=c99
11 CFLAGS += -pipe
12 CFLAGS += -Wall
13 CPPFLAGS += -D_GNU_SOURCE
14 ifndef NOLIBCAIRO
15 CFLAGS += $(shell pkg-config --cflags cairo xcb-keysyms xcb-dpms xcb-xinerama)
16 LIBS += $(shell pkg-config --libs cairo xcb-keysyms xcb-dpms xcb-xinerama xcb-image)
17 else
18 CPPFLAGS += -DNOLIBCAIRO
19 CFLAGS += $(shell pkg-config --cflags xcb-keysyms xcb-dpms xcb-xinerama)
20 LIBS += $(shell pkg-config --libs xcb-keysyms xcb-dpms xcb-image xcb-xinerama)
21 endif
22 LIBS += -lpam
23 LIBS += -lev
24 LIBS += -lX11
25
26 FILES:=$(wildcard *.c)
27 FILES:=$(FILES:.c=.o)
28
29 VERSION:=$(shell git describe --tags --abbrev=0)
30 GIT_VERSION:="$(shell git describe --tags --always) ($(shell git log --pretty=format:%cd --date=short -n1))"
31 CPPFLAGS += -DVERSION=\"${GIT_VERSION}\"
32
33 .PHONY: install clean uninstall
34
35 all: i3lock
36
37 i3lock: ${FILES}
38         $(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
39
40 clean:
41         rm -f i3lock ${FILES} i3lock-${VERSION}.tar.gz
42
43 install: all
44         $(INSTALL) -d $(DESTDIR)$(PREFIX)/bin
45         $(INSTALL) -d $(DESTDIR)$(SYSCONFDIR)/pam.d
46         $(INSTALL) -m 755 i3lock $(DESTDIR)$(PREFIX)/bin/i3lock
47         $(INSTALL) -m 644 i3lock.pam $(DESTDIR)$(SYSCONFDIR)/pam.d/i3lock
48
49 uninstall:
50         rm -f $(DESTDIR)$(PREFIX)/bin/i3lock
51
52 dist: clean
53         [ ! -d i3lock-${VERSION} ] || rm -rf i3lock-${VERSION}
54         [ ! -e i3lock-${VERSION}.tar.bz2 ] || rm i3lock-${VERSION}.tar.bz2
55         mkdir i3lock-${VERSION}
56         cp *.c *.h i3lock.1 i3lock.pam Makefile LICENSE README CHANGELOG i3lock-${VERSION}
57         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
58         tar cfj i3lock-${VERSION}.tar.bz2 i3lock-${VERSION}
59         rm -rf i3lock-${VERSION}