| 
									
										
										
										
											2015-09-25 21:28:27 +08:00
										 |  |  | NAME=zsh-syntax-highlighting | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-10-19 14:44:02 +08:00
										 |  |  | INSTALL?=install -c | 
					
						
							| 
									
										
										
										
											2015-09-25 21:28:27 +08:00
										 |  |  | PREFIX?=/usr/local | 
					
						
							| 
									
										
										
										
											2015-11-17 03:14:19 +08:00
										 |  |  | SHARE_DIR?=$(DESTDIR)$(PREFIX)/share/$(NAME) | 
					
						
							| 
									
										
										
										
											2015-10-26 22:18:54 +08:00
										 |  |  | ZSH?=zsh # zsh binary to run tests with | 
					
						
							| 
									
										
										
										
											2015-09-25 21:28:27 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-10-19 15:08:21 +08:00
										 |  |  | # Have the default target do nothing.
 | 
					
						
							|  |  |  | all: | 
					
						
							|  |  |  | 	@ : | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-09-25 21:28:27 +08:00
										 |  |  | install: | 
					
						
							|  |  |  | 	$(INSTALL) -d $(SHARE_DIR) | 
					
						
							| 
									
										
										
										
											2015-10-19 15:35:12 +08:00
										 |  |  | 	cp -r .version zsh-syntax-highlighting.zsh highlighters $(SHARE_DIR) | 
					
						
							|  |  |  | 	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-09-26 10:29:51 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | test: | 
					
						
							| 
									
										
										
										
											2015-10-20 08:31:40 +08:00
										 |  |  | 	@result=0; \
 | 
					
						
							|  |  |  | 	for test in highlighters/*; do \
 | 
					
						
							| 
									
										
										
										
											2015-09-26 10:29:51 +08:00
										 |  |  | 		if [ -d $$test/test-data ]; then \
 | 
					
						
							|  |  |  | 			echo "Running test $${test##*/}"; \
 | 
					
						
							| 
									
										
										
										
											2015-10-26 22:18:54 +08:00
										 |  |  | 			$(ZSH) -f tests/test-highlighting.zsh "$${test##*/}"; \
 | 
					
						
							| 
									
										
										
										
											2015-10-19 14:36:42 +08:00
										 |  |  | 			: $$(( result |= $$? )); \
 | 
					
						
							| 
									
										
										
										
											2015-09-26 10:29:51 +08:00
										 |  |  | 		fi \
 | 
					
						
							| 
									
										
										
										
											2015-10-27 17:55:36 +08:00
										 |  |  | 	done; \
 | 
					
						
							| 
									
										
										
										
											2015-10-20 08:31:40 +08:00
										 |  |  | 	exit $$result | 
					
						
							| 
									
										
										
										
											2015-10-20 08:26:43 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-10-27 15:46:51 +08: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-10-20 08:26:43 +08:00
										 |  |  | .PHONY: all install test |