[commit: nofib] master: Change how we find a GHC to test (70672f1)

Ian Lynagh igloo at earth.li
Tue May 28 16:51:25 CEST 2013


Repository : ssh://darcs.haskell.org//srv/darcs/nofib

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/70672f17d9c43306c880b587fa2c0e78a9268033

>---------------------------------------------------------------

commit 70672f17d9c43306c880b587fa2c0e78a9268033
Author: Ian Lynagh <ian at well-typed.com>
Date:   Tue May 28 15:46:31 2013 +0100

    Change how we find a GHC to test
    
    We now do something similar to what the testsuite does.

>---------------------------------------------------------------

 mk/boilerplate.mk |   46 ++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 42 insertions(+), 4 deletions(-)

diff --git a/mk/boilerplate.mk b/mk/boilerplate.mk
index db40550..e241712 100644
--- a/mk/boilerplate.mk
+++ b/mk/boilerplate.mk
@@ -74,13 +74,51 @@ SRC_HC_OPTS += $(NoFibHcOpts) -Rghc-timing
 SRC_HC_OPTS += -package array
 
 ifeq "$(WithNofibHc)" ""
-HC	   = $(GHC_TOP)/$(GHC_STAGE2)
-MKDEPENDHS := $(GHC_TOP)/$(GHC_STAGE2)  # ToDo: wrong, if $(WithNofibHc) isn't GHC.
+
+STAGE1_GHC := $(abspath $(TOP)/../inplace/bin/ghc-stage1)
+STAGE2_GHC := $(abspath $(TOP)/../inplace/bin/ghc-stage2)
+STAGE3_GHC := $(abspath $(TOP)/../inplace/bin/ghc-stage3)
+
+ifneq "$(wildcard $(STAGE1_GHC) $(STAGE1_GHC).exe)" ""
+
+ifeq "$(BINDIST)" "YES"
+HC := $(abspath $(TOP)/../)/bindisttest/install   dir/bin/ghc
+else ifeq "$(stage)" "1"
+HC := $(STAGE1_GHC)
+else ifeq "$(stage)" "3"
+HC := $(STAGE3_GHC)
+else
+# use stage2 by default
+HC := $(STAGE2_GHC)
+endif
+
+else
+HC := $(shell which ghc)
+endif
+
+else
+
+# We want to support both "ghc" and "/usr/bin/ghc" as values of WithNofibHc
+# passed in by the user, but
+#     which ghc          == /usr/bin/ghc
+#     which /usr/bin/ghc == /usr/bin/ghc
+# so on unix-like platforms we can just always 'which' it.
+# However, on cygwin, we can't just use which:
+#     $ which c:/ghc/ghc-7.4.1/bin/ghc.exe
+#     which: no ghc.exe in (./c:/ghc/ghc-7.4.1/bin)
+# so we start off by using realpath, and if that succeeds then we use
+# that value. Otherwise we fall back on 'which'.
+HC_REALPATH := $(realpath $(WithNofibHc))
+ifeq "$(HC_REALPATH)" ""
+HC := $(shell which '$(WithNofibHc)')
 else
-HC	   = $(WithNofibHc)
-MKDEPENDHS := $(WithNofibHc)
+HC := $(HC_REALPATH)
 endif
 
+endif
+
+MKDEPENDHS := $(HC) # ToDo: wrong, if $(HC) isn't GHC.
+
 define get-ghc-rts-field # $1 = result variable, $2 = field name
 $1 := $$(shell '$$(HC)' +RTS --info | grep '^ .("$2",' | tr -d '\r' | sed -e 's/.*", *"//' -e 's/")$$$$//')
 endef





More information about the ghc-commits mailing list