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.

48 lines
1.3 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)
  14. LIBS += $(shell pkg-config --libs cairo xcb-keysyms xcb-dpms xcb-image)
  15. else
  16. CPPFLAGS += -DNOLIBCAIRO
  17. CFLAGS += $(shell pkg-config --cflags xcb-keysyms xcb-dpms)
  18. LIBS += $(shell pkg-config --libs xcb-keysyms xcb-dpms xcb-image)
  19. endif
  20. LIBS += -lpam
  21. FILES:=$(wildcard *.c)
  22. FILES:=$(FILES:.c=.o)
  23. VERSION:=$(shell git describe --tags --abbrev=0)
  24. GIT_VERSION:="$(shell git describe --tags --always) ($(shell git log --pretty=format:%cd --date=short -n1))"
  25. CPPFLAGS += -DVERSION=\"${GIT_VERSION}\"
  26. .PHONY: install clean uninstall
  27. all: i3lock
  28. i3lock: ${FILES}
  29. $(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
  30. clean:
  31. rm -f i3lock ${FILES} i3lock-${VERSION}.tar.gz
  32. install: all
  33. $(INSTALL) -d $(DESTDIR)$(PREFIX)/bin
  34. $(INSTALL) -d $(DESTDIR)$(SYSCONFDIR)/pam.d
  35. $(INSTALL) -m 755 i3lock $(DESTDIR)$(PREFIX)/bin/i3lock
  36. $(INSTALL) -m 644 i3lock.pam $(DESTDIR)$(SYSCONFDIR)/pam.d/i3lock
  37. uninstall:
  38. rm -f $(DESTDIR)$(PREFIX)/bin/i3lock