You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
1.9 KiB

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