#
#---------------------------------------------------------------
-# Specify the Haskell compiler to be used to compile the compiler itself
-#
-# WithGhcHc Path name of the compiler to use
-#
-# WithGhcHcType What "type" of compiler is being used
-# Valid options:
-# HC_CHALMERS_HBC
-# HC_GLASGOW_GHC
-# HC_ROJEMO_NHC
-# HC_UNSPECIFIED
-
-WithGhcHc = @WithHc@
-
-# Variable which is set to the version number of the $(WithGhcHc) we're using.
-# Not currently used, but might come in handy sometime soon.
-#WithGhcHcVersion = $(shell echo `if ( $(WithGhcHc) --version 2>/dev/null >/dev/null ) then $(WithGhcHc) --version 2>&1 | @SedCmd@ -e 's/^.*version [^0-9]*\([.0-9]*\).*/\1/;s/\.//'; else echo unknown; fi; ` )
+# The compiler used to build GHC is $(GHC). To change the actual compiler
+# used, re-configure with --with-ghc=<path-to-ghc>.
# Extra ways in which to build the compiler (for example, you might want to
# build a profiled compiler so you can see where it spends its time)
# GhcWithHscBuiltViaC - build GHC compiler proper (\`hsc') from .hc files?
GhcWithHscBuiltViaC=@BootingFromHc@
-# Build a registerised version of hsc and runtime
-# (unregisterised used for Hugs at the moment)
-GhcWithRegisterised=YES
-
# Build a compiler with a native code generator backend
# (as well as a C backend)
#
# Target platforms supported:
# i386, alpha & sparc
-GhcWithNativeCodeGen=$(shell if (test x$(findstring $(HostArch_CPP),i386 alpha sparc) = x); then echo NO; else echo YES; fi)
+ifneq "$(findstring $(HostArch_CPP), i386 alpha sparc)" ""
+GhcWithNativeCodeGen=YES
+else
+GhcWithNativeCodeGen=NO
+endif
+
+# Include GHCi in the compiler
+ifneq "$(findstring $(HostOS_CPP), linux solaris freebsd netbsd openbsd)" ""
+GhcWithInterpreter=YES
+else
+GhcWithInterpreter=NO
+endif
#
# Building various ways?
#
ReadlineIncludePath=
+# Build the Haskell OpenGL/GLUT binding?
+#
+GhcLibsWithHOpenGL=@GhcLibsWithHOpenGL@
+
################################################################################
#
# happy project
# this in build.mk or set your environment variable "TMPDIR" to point
# to somewhere with more space. (TMPDIR=. is a good choice).
-TMPDIR = /tmp
+# DEFAULT_TMPDIR isn't called TMPDIR because GNU make tends to
+# override an environment variable with the value of the make variable
+# of the same name (if it exists) when executing sub-processes, so
+# setting the TMPDIR env var would have no effect in the build tree.
+
+DEFAULT_TMPDIR = /tmp
# FPTOOLS_TOP: the top of the fptools hierarchy, absolute path.
GREENCARD_PREFIX = $(FPTOOLS_TOP)/green-card/src/
UNLIT_PREFIX = $(FPTOOLS_TOP)/ghc/utils/unlit/
-UGEN_PREFIX = $(FPTOOLS_TOP)/ghc/utils/ugen/
STAT2RESID_PREFIX = $(FPTOOLS_TOP)/ghc/utils/stat2resid/
HP2PS_PREFIX = $(FPTOOLS_TOP)/ghc/utils/hp2ps/
-HSCPP_PREFIX = $(FPTOOLS_TOP)/ghc/utils/hscpp/
HSTAGS_PREFIX = $(FPTOOLS_TOP)/ghc/utils/hstags/
#
# $(HC) is a generic Haskell 98 compiler, set to $(GHC) by default.
# $(MKDEPENDHS) is the Haskell dependency generator (ghc -M).
+#
+# NOTE: Don't override $(GHC) in build.mk, use configure --with-ghc instead
+# (because the version numbers have to be calculated).
+
+GHC = @WithGhc@
+GhcVersion = @GhcVersion@
+GhcMajVersion = @GhcMajVersion@
+GhcMinVersion = @GhcMinVersion@
+GhcPatchLevel = @GhcPatchLevel@
-GHC = @GHC@
HBC = @HBC@
NHC = @NHC@
# projects (eg. it's handy to have a nofib & a ghc build in the same
# tree). We can refer to "this ghc" as $(GHC_INPLACE):
-GHC_INPLACE = $(FPTOOLS_TOP)/ghc/driver/ghc-inplace
+GHC_INPLACE = $(FPTOOLS_TOP)/ghc/compiler/ghc-inplace
#-----------------------------------------------------------------------------
# C compiler
LibGmp = @LibGmp@
#-----------------------------------------------------------------------------
+# Regex library
+# (if present in libc use that one, otherwise use the one in the tree)
+#
+HaveRegex = @HaveRegex@
+
+#-----------------------------------------------------------------------------
# Flex
FLEX = @LEX@
#
# Under Windows, we have to deal with .exe suffixes
#
-EXE_SUFFIX=@ExeSuffix@
+EXE_SUFFIX=@exeext@
#
# This is special to literate/, ToDo: add literate-specific
VERBATIM = $(VERBATIM_PREFIX)verbatim
SGMLVERB = $(SGMLVERB_PREFIX)sgmlverb
RUNTEST = $(RUNTEST_PREFIX)runstdtest
-HAPPY = @HappyCmd@
-HAPPY_VERSION = @HappyVersion@
LX = @LxCmd@
GREENCARD = $(FPTOOLS_TOP)/green-card/src/green-card
BLD_DLL = dllwrap
#
+# Happy
+#
+HAPPY = @HappyCmd@
+HAPPY_VERSION = @HappyVersion@
+#
+# Options to pass to Happy when we're going to compile the output with GHC
+#
+GHC_HAPPY_OPTS = $(shell if expr $(HAPPY_VERSION) \< "1.8" >/dev/null; then echo -g; else echo -agc; fi)
+
+#
# Stuff from fptools/literate
#
LIT2PGM = $(LITERATE_PREFIX)lit2pgm
#
# Stuff from fptools/ghc/utils
#
-UNLIT = $(UNLIT_PREFIX)unlit
-UGEN = $(UGEN_PREFIX)ugen
+UNLIT = $(UNLIT_PREFIX)unlit$(EXE_SUFFIX)
STAT2RESID = $(STAT2RESID_PREFIX)stat2resid
-HP2PS = $(HP2PS_PREFIX)hp2ps
+HP2PS = $(HP2PS_PREFIX)hp2ps$(EXE_SUFFIX)
HSCPP = $(HSCPP_PREFIX)hscpp
HSTAGS = $(HSTAGS_PREFIX)hstags
# Way `dll':
WAY_dll_NAME=Win32 DLLs
-WAY_dll_HC_OPTS=
+WAY_dll_HC_OPTS=-dll
#
# Add user-way configurations here: