Makefile 782B

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