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.

45 lines
1.2 KiB

  1. INSTALL=install
  2. PREFIX=/usr
  3. # Check if pkg-config is installed, we need it for building CFLAGS/LDFLAGS
  4. ifeq ($(shell which pkg-config 2>/dev/null 1>/dev/null || echo 1),1)
  5. $(error "pkg-config was not found")
  6. endif
  7. CFLAGS += -std=c99
  8. CFLAGS += -pipe
  9. CFLAGS += -Wall
  10. CFLAGS += -D_GNU_SOURCE
  11. ifndef NOLIBCAIRO
  12. CFLAGS += $(shell pkg-config --cflags cairo xcb-keysyms xcb-dpms)
  13. LDFLAGS += $(shell pkg-config --libs cairo xcb-keysyms xcb-dpms xcb-image)
  14. else
  15. CFLAGS += -DNOLIBCAIRO
  16. CFLAGS += $(shell pkg-config --cflags xcb-keysyms xcb-dpms)
  17. LDFLAGS += $(shell pkg-config --libs xcb-keysyms xcb-dpms xcb-image)
  18. endif
  19. LDFLAGS += -lpam
  20. FILES:=$(wildcard *.c)
  21. FILES:=$(FILES:.c=.o)
  22. VERSION:=$(shell git describe --tags --abbrev=0)
  23. GIT_VERSION:="$(shell git describe --tags --always) ($(shell git log --pretty=format:%cd --date=short -n1))"
  24. CFLAGS += -DVERSION=\"${GIT_VERSION}\"
  25. .PHONY: install clean uninstall
  26. all: i3lock
  27. i3lock: ${FILES}
  28. $(CC) -o $@ $^ $(LDFLAGS)
  29. clean:
  30. rm -f i3lock ${FILES} i3lock-${VERSION}.tar.gz
  31. install: all
  32. $(INSTALL) -d $(DESTDIR)$(PREFIX)/bin
  33. $(INSTALL) -m 755 i3lock $(DESTDIR)$(PREFIX)/bin/i3lock
  34. uninstall:
  35. rm -f $(DESTDIR)$(PREFIX)/bin/i3lock