You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 lines
1.9 KiB

3 years ago
  1. NAME=zsh-syntax-highlighting
  2. INSTALL?=install -c
  3. PREFIX?=/usr/local
  4. SHARE_DIR?=$(DESTDIR)$(PREFIX)/share/$(NAME)
  5. DOC_DIR?=$(DESTDIR)$(PREFIX)/share/doc/$(NAME)
  6. ZSH?=zsh # zsh binary to run tests with
  7. all:
  8. cd docs && \
  9. cp highlighters.md all.md && \
  10. printf '\n\nIndividual highlighters documentation\n=====================================' >> all.md && \
  11. for doc in highlighters/*.md; do printf '\n\n'; cat "$$doc"; done >> all.md
  12. install: all
  13. $(INSTALL) -d $(SHARE_DIR)
  14. $(INSTALL) -d $(DOC_DIR)
  15. cp .version zsh-syntax-highlighting.zsh $(SHARE_DIR)
  16. cp COPYING.md README.md changelog.md $(DOC_DIR)
  17. sed -e '1s/ .*//' -e '/^\[build-status-[a-z]*\]: /d' < README.md > $(DOC_DIR)/README.md
  18. if [ x"true" = x"`git rev-parse --is-inside-work-tree 2>/dev/null`" ]; then \
  19. git rev-parse HEAD; \
  20. else \
  21. cat .revision-hash; \
  22. fi > $(SHARE_DIR)/.revision-hash
  23. :
  24. # The [ -e ] check below is to because sh evaluates this with (the moral
  25. # equivalent of) NONOMATCH in effect, and highlighters/*.zsh has no matches.
  26. for dirname in highlighters highlighters/*/ ; do \
  27. $(INSTALL) -d $(SHARE_DIR)/"$$dirname"; \
  28. for fname in "$$dirname"/*.zsh ; do [ -e "$$fname" ] && cp "$$fname" $(SHARE_DIR)"/$$dirname"; done; \
  29. done
  30. cp -R docs/* $(DOC_DIR)
  31. clean:
  32. rm -f docs/all.md
  33. test:
  34. @$(ZSH) -fc 'echo ZSH_PATCHLEVEL=$$ZSH_PATCHLEVEL'
  35. @result=0; \
  36. for test in highlighters/*; do \
  37. if [ -d $$test/test-data ]; then \
  38. echo "Running test $${test##*/}"; \
  39. env -i QUIET=$$QUIET $${TERM:+"TERM=$$TERM"} $(ZSH) -f tests/test-highlighting.zsh "$${test##*/}"; \
  40. : $$(( result |= $$? )); \
  41. fi \
  42. done; \
  43. exit $$result
  44. quiet-test:
  45. $(MAKE) test QUIET=y
  46. perf:
  47. @result=0; \
  48. for test in highlighters/*; do \
  49. if [ -d $$test/test-data ]; then \
  50. echo "Running test $${test##*/}"; \
  51. $(ZSH) -f tests/test-perfs.zsh "$${test##*/}"; \
  52. : $$(( result |= $$? )); \
  53. fi \
  54. done; \
  55. exit $$result
  56. .PHONY: all install clean test perf