Makefile 743B

123456789101112131415161718192021222324252627282930313233343536
  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. HELP2MAN_VERSION := $(shell help2man --version 2>/dev/null)
  8. all:
  9. ifndef HELP2MAN_VERSION
  10. $(error "help2man is not installed")
  11. endif
  12. $(CC) $(CFLAGS) -g -o light src/helpers.c src/light.c src/main.c
  13. exp:
  14. $(CC) $(CFLAGS) -E src/helpers.c src/light.c
  15. man:
  16. help2man $(MANFLAGS) ./light | gzip - > light.1.gz
  17. install: all man
  18. mkdir -p $(BINDIR)
  19. cp -f ./light $(BINDIR)/light
  20. chown root $(BINDIR)/light
  21. chmod 4755 $(BINDIR)/light
  22. mkdir -p $(MANDIR)
  23. mv light.1.gz $(MANDIR)
  24. uninstall:
  25. rm $(BINDIR)/light
  26. rm -rf /etc/light
  27. rm $(MANDIR)/light.1.gz
  28. clean:
  29. rm -vfr *~ light light.1.gz