Makefile 765B

123456789101112131415161718192021222324252627282930313233343536
  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. mkdir -p $(BINDIR)
  17. cp -f ./light $(BINDIR)/light
  18. chown root $(BINDIR)/light
  19. chmod 4755 $(BINDIR)/light
  20. mkdir -p $(MANDIR)
  21. mv light.1.gz $(MANDIR)
  22. uninstall:
  23. rm $(BINDIR)/light
  24. rm -rf /etc/light
  25. rm $(MANDIR)/light.1.gz
  26. clean:
  27. rm -vfr *~ light light.1.gz
  28. .PHONY: man install uninstall clean