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.

39 lines
1000 B

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