makefile: only check for HGROOT when running tests
authorPierre-Yves David <pierre-yves.david@ens-lyon.org>
Fri, 03 Mar 2017 10:58:30 +0100
changeset 2039 103da16f3be2
parent 2038 a4b09789117a
child 2040 934d70e3be97
makefile: only check for HGROOT when running tests Otherwise we breaks other target that do not needs HGROOT.
Makefile
--- 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)