2015-09-25 09:28:27 -04:00
|
|
|
NAME=zsh-syntax-highlighting
|
|
|
|
|
2015-10-19 02:44:02 -04:00
|
|
|
INSTALL?=install -c
|
2015-09-25 09:28:27 -04:00
|
|
|
PREFIX?=/usr/local
|
2015-11-16 14:14:19 -05:00
|
|
|
SHARE_DIR?=$(DESTDIR)$(PREFIX)/share/$(NAME)
|
2015-11-16 14:49:36 -05:00
|
|
|
DOC_DIR?=$(DESTDIR)$(PREFIX)/share/doc/$(NAME)
|
2015-10-26 10:18:54 -04:00
|
|
|
ZSH?=zsh # zsh binary to run tests with
|
2015-09-25 09:28:27 -04:00
|
|
|
|
2015-10-19 03:08:21 -04:00
|
|
|
# Have the default target do nothing.
|
|
|
|
all:
|
|
|
|
@ :
|
|
|
|
|
2015-09-25 09:28:27 -04:00
|
|
|
install:
|
|
|
|
$(INSTALL) -d $(SHARE_DIR)
|
2015-11-16 14:49:36 -05:00
|
|
|
$(INSTALL) -d $(DOC_DIR)
|
|
|
|
$(INSTALL) .version zsh-syntax-highlighting.zsh $(SHARE_DIR)
|
|
|
|
$(INSTALL) COPYING.md README.md changelog.md $(DOC_DIR)
|
2015-10-19 03:35:12 -04:00
|
|
|
if [ x"true" = x"`git rev-parse --is-inside-work-tree 2>/dev/null`" ]; then \
|
|
|
|
git rev-parse HEAD; \
|
|
|
|
else \
|
|
|
|
cat .revision-hash; \
|
|
|
|
fi > $(SHARE_DIR)/.revision-hash
|
2015-11-16 14:49:36 -05:00
|
|
|
:
|
|
|
|
# The [ -e ] check below is to because sh evaluates this with (the moral
|
|
|
|
# equivalent of) NONOMATCH in effect, and highlighters/*.zsh has no matches.
|
|
|
|
for dirname in highlighters highlighters/*/ ; do \
|
2015-11-17 20:48:53 -05:00
|
|
|
$(INSTALL) -d $(SHARE_DIR)/"$$dirname"; \
|
|
|
|
$(INSTALL) -d $(DOC_DIR)/"$$dirname"; \
|
|
|
|
for fname in "$$dirname"/*.zsh ; do [ -e "$$fname" ] && $(INSTALL) "$$fname" $(SHARE_DIR)"/$$dirname"; done; \
|
|
|
|
for fname in "$$dirname"/*.md ; do [ -e "$$fname" ] && $(INSTALL) "$$fname" $(DOC_DIR)"/$$dirname"; done; \
|
2015-11-16 14:49:36 -05:00
|
|
|
done
|
2015-09-25 22:29:51 -04:00
|
|
|
|
|
|
|
test:
|
2015-10-19 20:31:40 -04:00
|
|
|
@result=0; \
|
|
|
|
for test in highlighters/*; do \
|
2015-09-25 22:29:51 -04:00
|
|
|
if [ -d $$test/test-data ]; then \
|
|
|
|
echo "Running test $${test##*/}"; \
|
2015-10-26 10:18:54 -04:00
|
|
|
$(ZSH) -f tests/test-highlighting.zsh "$${test##*/}"; \
|
2015-10-19 02:36:42 -04:00
|
|
|
: $$(( result |= $$? )); \
|
2015-09-25 22:29:51 -04:00
|
|
|
fi \
|
2015-10-27 05:55:36 -04:00
|
|
|
done; \
|
2015-10-19 20:31:40 -04:00
|
|
|
exit $$result
|
2015-10-19 20:26:43 -04:00
|
|
|
|
2015-10-27 03:46:51 -04:00
|
|
|
perf:
|
|
|
|
@result=0; \
|
|
|
|
for test in highlighters/*; do \
|
|
|
|
if [ -d $$test/test-data ]; then \
|
|
|
|
echo "Running test $${test##*/}"; \
|
|
|
|
$(ZSH) -f tests/test-perfs.zsh "$${test##*/}"; \
|
|
|
|
: $$(( result |= $$? )); \
|
|
|
|
fi \
|
|
|
|
done; \
|
|
|
|
exit $$result
|
|
|
|
|
2015-11-17 12:50:14 -05:00
|
|
|
.PHONY: all install test perf
|