12345678910111213141516171819202122232425262728293031
  1. PREFIX=$(DESTDIR)/usr
  2. BINDIR=$(PREFIX)/bin
  3. MANDIR=/usr/share/man/man1
  4. CC=gcc
  5. CFLAGS=-std=c89 -O2 -pedantic -Wall -I"./include"
  6. MANFLAGS=-h -h -v -V
  7. all:
  8. $(CC) $(CFLAGS) -g -o light src/helpers.c src/light.c src/main.c
  9. exp:
  10. $(CC) $(CFLAGS) -E src/helpers.c src/light.c
  11. man:
  12. help2man $(MANFLAGS) ./light | gzip - > light.1.gz
  13. install: all man
  14. mkdir -p $(BINDIR)
  15. cp -f ./light $(BINDIR)/light
  16. chown root $(BINDIR)/light
  17. chmod 4755 $(BINDIR)/light
  18. mkdir -p $(MANDIR)
  19. mv light.1.gz $(MANDIR)
  20. uninstall:
  21. rm $(BINDIR)/light
  22. rm -rf /etc/light
  23. rm $(MANDIR)/light.1.gz
  24. clean:
  25. rm -vfr *~ light light.1.gz