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.

52 lines
1.7 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. CFLAGS += $(shell pkg-config --cflags cairo xcb-dpms xcb-xinerama xkbcommon xkbfile x11 x11-xcb)
  13. LIBS += $(shell pkg-config --libs cairo xcb-dpms xcb-xinerama xcb-image xkbcommon xkbfile x11 x11-xcb)
  14. LIBS += -lpam
  15. LIBS += -lev
  16. FILES:=$(wildcard *.c)
  17. FILES:=$(FILES:.c=.o)
  18. VERSION:=$(shell git describe --tags --abbrev=0)
  19. GIT_VERSION:="$(shell git describe --tags --always) ($(shell git log --pretty=format:%cd --date=short -n1))"
  20. CPPFLAGS += -DVERSION=\"${GIT_VERSION}\"
  21. .PHONY: install clean uninstall
  22. all: i3lock
  23. i3lock: ${FILES}
  24. $(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
  25. clean:
  26. rm -f i3lock ${FILES} i3lock-${VERSION}.tar.gz
  27. install: all
  28. $(INSTALL) -d $(DESTDIR)$(PREFIX)/bin
  29. $(INSTALL) -d $(DESTDIR)$(SYSCONFDIR)/pam.d
  30. $(INSTALL) -m 755 i3lock $(DESTDIR)$(PREFIX)/bin/i3lock
  31. $(INSTALL) -m 644 i3lock.pam $(DESTDIR)$(SYSCONFDIR)/pam.d/i3lock
  32. uninstall:
  33. rm -f $(DESTDIR)$(PREFIX)/bin/i3lock
  34. dist: clean
  35. [ ! -d i3lock-${VERSION} ] || rm -rf i3lock-${VERSION}
  36. [ ! -e i3lock-${VERSION}.tar.bz2 ] || rm i3lock-${VERSION}.tar.bz2
  37. mkdir i3lock-${VERSION}
  38. cp *.c *.h i3lock.1 i3lock.pam Makefile LICENSE README CHANGELOG i3lock-${VERSION}
  39. 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
  40. tar cfj i3lock-${VERSION}.tar.bz2 i3lock-${VERSION}
  41. rm -rf i3lock-${VERSION}