summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorPhil Ruffwind <rf@rufflewind.com>2015-03-07 11:04:00 -0600
committerAustin Seipp <austin@well-typed.com>2015-03-07 11:04:01 -0600
commit504d8a4b183670830093a81d3c7a6d78416aed20 (patch)
treec87ddcd004edc72a847ec34a31dc0cb00b2d1aa1 /testsuite
parent34ba68c2aeb6fb2d1ea25a1a5e45c233ed7efc9c (diff)
downloadhaskell-504d8a4b183670830093a81d3c7a6d78416aed20.tar.gz
Don't assume tools are in same directory as ghc in some cases
Summary: Tools such as `ghc-pkg` and `runghc` are no longer required to be in the same directory as `ghc` when running tests, provided that `TEST_HC` is not explicitly set and an in-tree compiler is not used. Fixes #10126. Reviewers: thomie, austin Reviewed By: thomie, austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D705 GHC Trac Issues: #10126
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/mk/boilerplate.mk23
1 files changed, 18 insertions, 5 deletions
diff --git a/testsuite/mk/boilerplate.mk b/testsuite/mk/boilerplate.mk
index 1765d78f03..3292d3d67a 100644
--- a/testsuite/mk/boilerplate.mk
+++ b/testsuite/mk/boilerplate.mk
@@ -43,6 +43,7 @@ STAGE3_GHC := $(abspath $(TOP)/../inplace/bin/ghc-stage3)
ifneq "$(wildcard $(STAGE1_GHC) $(STAGE1_GHC).exe)" ""
+IMPLICIT_COMPILER = NO
IN_TREE_COMPILER = YES
ifeq "$(BINDIST)" "YES"
TEST_HC := $(abspath $(TOP)/../)/bindisttest/install dir/bin/ghc
@@ -56,11 +57,17 @@ TEST_HC := $(STAGE2_GHC)
endif
else
+IMPLICIT_COMPILER = YES
IN_TREE_COMPILER = NO
TEST_HC := $(shell which ghc)
endif
else
+ifeq "$(TEST_HC)" "ghc"
+IMPLICIT_COMPILER = YES
+else
+IMPLICIT_COMPILER = NO
+endif
IN_TREE_COMPILER = NO
# We want to support both "ghc" and "/usr/bin/ghc" as values of TEST_HC
# passed in by the user, but
@@ -87,24 +94,30 @@ endif
# containing spaces
BIN_ROOT = $(shell dirname '$(TEST_HC)')
+ifeq "$(IMPLICIT_COMPILER)" "YES"
+find_tool = $(shell which $(1))
+else
+find_tool = $(BIN_ROOT)/$(1)
+endif
+
ifeq "$(GHC_PKG)" ""
-GHC_PKG := $(BIN_ROOT)/ghc-pkg
+GHC_PKG := $(call find_tool,ghc-pkg)
endif
ifeq "$(RUNGHC)" ""
-RUNGHC := $(BIN_ROOT)/runghc
+RUNGHC := $(call find_tool,runghc)
endif
ifeq "$(HSC2HS)" ""
-HSC2HS := $(BIN_ROOT)/hsc2hs
+HSC2HS := $(call find_tool,hsc2hs)
endif
ifeq "$(HP2PS_ABS)" ""
-HP2PS_ABS := $(BIN_ROOT)/hp2ps
+HP2PS_ABS := $(call find_tool,hp2ps)
endif
ifeq "$(HPC)" ""
-HPC := $(BIN_ROOT)/hpc
+HPC := $(call find_tool,hpc)
endif
$(eval $(call canonicaliseExecutable,TEST_HC))