12345678910111213141516171819202122232425262728293031323334
  1. PREFIX=$(DESTDIR)/usr
  2. BINDIR=$(PREFIX)/bin
  3. MANDIR=$(PREFIX)/share/man/man1
  4. CC=gcc
  5. CFLAGS=-std=c89 -O2 -pedantic -Wall -I"./include" -D_XOPEN_SOURCE=500
  6. MANFLAGS=-h -h -v -V -N
  7. HELP2MAN_VERSION := $(shell help2man --version 2>/dev/null)
  8. light: src/helpers.c src/light.c src/main.c
  9. $(CC) $(CFLAGS) -g -o $@ $^
  10. man: light
  11. ifndef HELP2MAN_VERSION
  12. $(error "help2man is not installed")
  13. endif
  14. help2man $(MANFLAGS) ./light | gzip - > light.1.gz
  15. install: light man
  16. install -dZ $(BINDIR)
  17. install -DZ -m 4755 ./light -t $(BINDIR)
  18. install -dZ $(MANDIR)
  19. install -DZ light.1.gz -t $(MANDIR)
  20. uninstall:
  21. rm -f $(BINDIR)/light
  22. rm -rf /etc/light
  23. rm -f $(MANDIR)/light.1.gz
  24. clean:
  25. rm -vfr *~ light light.1.gz
  26. .PHONY: man install uninstall clean