Makefile
changeset 2039 103da16f3be2
parent 2020 143c8e4dc22d
child 2040 934d70e3be97
--- a/Makefile	Thu Mar 02 20:13:47 2017 +0100
+++ b/Makefile	Fri Mar 03 10:58:30 2017 +0100
@@ -1,5 +1,6 @@
 VERSION=$(shell python setup.py --version)
 
+PYTHON=python
 
 help:
 	@echo 'Commonly used make targets:'
@@ -18,10 +19,6 @@
 
 # test targets
 
-PYTHON=python
-ifeq ($(HGROOT),)
-  $(error HGROOT is not set to the root of the hg source tree)
-endif
 TESTFLAGS ?= $(shell echo $$HGTESTFLAGS)
 
 HGTESTS=$(HGROOT)/tests
@@ -34,15 +31,20 @@
 
 all: help
 
-tests:
+_check_hgroot:
+	ifeq ($(HGROOT),)
+	  $(error HGROOT is not set to the root of the hg source tree)
+	endif
+
+tests: _check_hgroot
 	cd tests && $(PYTHON) $(HGTESTS)/run-tests.py $(TESTFLAGS)
 
 # /!\ run outside of the compatibility branch output test will likely fails
 
-test-%:
+test-%: _check_hgroot
 	cd tests && $(PYTHON) $(HGTESTS)/run-tests.py $(TESTFLAGS) $@
 
-tests-%:
+tests-%: _check_hgroot
 	hg -R $(HGROOT) checkout $$(echo $@ | sed s/tests-//) && \
 	(cd $(HGROOT) ; $(MAKE) clean ) && \
 	cd tests && $(PYTHON) $(HGTESTS)/run-tests.py $(TESTFLAGS)