2015-09-25 13:28:27 +00:00
|
|
|
NAME=zsh-syntax-highlighting
|
|
|
|
|
2015-10-19 06:44:02 +00:00
|
|
|
INSTALL?=install -c
|
2015-09-25 13:28:27 +00:00
|
|
|
PREFIX?=/usr/local
|
2015-11-16 19:14:19 +00:00
|
|
|
SHARE_DIR?=$(DESTDIR)$(PREFIX)/share/$(NAME)
|
2015-11-16 19:49:36 +00:00
|
|
|
DOC_DIR?=$(DESTDIR)$(PREFIX)/share/doc/$(NAME)
|
2015-10-26 14:18:54 +00:00
|
|
|
ZSH?=zsh # zsh binary to run tests with
|
2015-09-25 13:28:27 +00:00
|
|
|
|
2015-10-19 07:08:21 +00:00
|
|
|
all:
|
2015-11-17 05:58:42 +00:00
|
|
|
cd docs && \
|
|
|
|
cp highlighters.md all.md && \
|
|
|
|
printf '\n\nIndividual highlighters documentation\n=====================================' >> all.md && \
|
|
|
|
for doc in highlighters/*.md; do printf '\n\n'; cat "$$doc"; done >> all.md
|
2015-10-19 07:08:21 +00:00
|
|
|
|
2015-11-17 05:58:42 +00:00
|
|
|
install: all
|
2015-09-25 13:28:27 +00:00
|
|
|
$(INSTALL) -d $(SHARE_DIR)
|
2015-11-16 19:49:36 +00:00
|
|
|
$(INSTALL) -d $(DOC_DIR)
|
2015-11-18 02:14:03 +00:00
|
|
|
cp .version zsh-syntax-highlighting.zsh $(SHARE_DIR)
|
|
|
|
cp COPYING.md README.md changelog.md $(DOC_DIR)
|
2017-07-31 23:16:37 +00:00
|
|
|
sed -e '1s/ .*//' -e '/^\[build-status-[a-z]*\]: /d' < README.md > $(DOC_DIR)/README.md
|
2015-10-19 07:35:12 +00: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 19:49:36 +00: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-18 01:48:53 +00:00
|
|
|
$(INSTALL) -d $(SHARE_DIR)/"$$dirname"; \
|
2015-11-18 02:14:03 +00:00
|
|
|
for fname in "$$dirname"/*.zsh ; do [ -e "$$fname" ] && cp "$$fname" $(SHARE_DIR)"/$$dirname"; done; \
|
2015-11-16 19:49:36 +00:00
|
|
|
done
|
2015-11-17 05:58:42 +00:00
|
|
|
cp -R docs/* $(DOC_DIR)
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -f docs/all.md
|
2015-09-26 02:29:51 +00:00
|
|
|
|
|
|
|
test:
|
2017-08-09 18:42:35 +00:00
|
|
|
@$(ZSH) -fc 'echo ZSH_PATCHLEVEL=$$ZSH_PATCHLEVEL'
|
2015-10-20 00:31:40 +00:00
|
|
|
@result=0; \
|
|
|
|
for test in highlighters/*; do \
|
2015-09-26 02:29:51 +00:00
|
|
|
if [ -d $$test/test-data ]; then \
|
|
|
|
echo "Running test $${test##*/}"; \
|
2020-03-15 18:10:18 +00:00
|
|
|
env -i QUIET=$$QUIET $${TERM:+"TERM=$$TERM"} $(ZSH) -f tests/test-highlighting.zsh "$${test##*/}"; \
|
2015-10-19 06:36:42 +00:00
|
|
|
: $$(( result |= $$? )); \
|
2015-09-26 02:29:51 +00:00
|
|
|
fi \
|
2015-10-27 09:55:36 +00:00
|
|
|
done; \
|
2015-10-20 00:31:40 +00:00
|
|
|
exit $$result
|
2015-10-20 00:26:43 +00:00
|
|
|
|
2016-01-02 21:22:01 +00:00
|
|
|
quiet-test:
|
|
|
|
$(MAKE) test QUIET=y
|
|
|
|
|
2015-10-27 07:46:51 +00: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 05:58:42 +00:00
|
|
|
.PHONY: all install clean test perf
|