-SRC_HC_OPTS += -Istage$(stage)
-
-# -----------------------------------------------------------------------------
-# Set SRCS etc.
-#
-# First figure out ALL_DIRS, the source sub-directories
-
-ALL_DIRS = \
- utils basicTypes types hsSyn prelude rename typecheck deSugar coreSyn \
- specialise simplCore stranal stgSyn simplStg codeGen main \
- profiling parser cprAnalysis ndpFlatten iface cmm
-
-# Make sure we include Config.hs even if it doesn't exist yet...
-ALL_SRCS += $(CONFIG_HS)
-
-# HsGeneric.hs is not used just now
-EXCLUDED_SRCS += hsSyn/HsGeneric.hs
-
-ifeq ($(GhcWithNativeCodeGen),YES)
-ALL_DIRS += nativeGen
-else
-SRC_HC_OPTS += -DOMIT_NATIVE_CODEGEN
-endif
-
-ifeq ($(GhcWithIlx),YES)
-ALL_DIRS += ilxGen
-SRC_HC_OPTS += -DILX
-endif
-
-ifeq ($(GhcWithJavaGen),YES)
-ALL_DIRS += javaGen
-SRC_HC_OPTS += -DJAVA
-endif
-
-ifeq "$(BootingFromHc)" "YES"
-# HC files are always from a self-booted compiler
-bootstrapped = YES
-else
-ifneq "$(findstring $(stage), 2 3)" ""
-bootstrapped = YES
-else
-bootstrapped = NO
-endif
-endif
-
-# -----------------------------------------------------------------------------
-# Building a compiler with interpreter support
-#
-# The interpreter, GHCi interface, Template Haskell and Hpc are only
-# enabled when we are bootstrapping with the same version of GHC, and
-# the interpreter is supported on this platform.
-
-ifeq "$(GhcWithInterpreter) $(bootstrapped)" "YES YES"
-
-# Yes, include the interepreter, readline, and Template Haskell extensions
-SRC_HC_OPTS += -DGHCI -package template-haskell -package hpc
-PKG_DEPENDS += template-haskell hpc
-
-# Should GHCI be building info tables in the TABLES_NEXT_TO_CODE style
-# or not?
-ifeq "$(GhcEnableTablesNextToCode) $(GhcUnregisterised)" "YES NO"
-SRC_HC_OPTS += -DGHCI_TABLES_NEXT_TO_CODE
-endif
-
-ifneq "$(GhcNotThreaded)" "YES"
-# Use threaded RTS with GHCi, so threads don't get blocked at the prompt.
-SRC_HC_OPTS += -threaded
-endif
-
-ALL_DIRS += ghci
-
-# If we are going to use dynamic libraries instead of .o files for ghci,
-# we will need to always retain CAFs in the compiler.
-# ghci/keepCAFsForGHCi contains a GNU C __attribute__((constructor))
-# function which sets the keepCAFs flag for the RTS before any Haskell
-# code is run.
-ifeq "$(GhcBuildDylibs)" "YES"
-else
-EXCLUDED_SRCS += ghci/keepCAFsForGHCi.c
-endif
-
-# Enable readline if either:
-# - we're building stage 1 and $(GhcHasReadline)="YES"
-# - we're building stage 2/3, and we have built the readline package
-#
-# But we don't enable readline on Windows, because readline is fairly
-# broken there.
-#
-ifneq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
-ifeq "$(stage)" "1"
-ifeq "$(GhcHasReadline)" "YES"
-SRC_HC_OPTS += -package readline -DUSE_READLINE
-PKG_DEPENDS += readline
-endif
-else
--include $(FPTOOLS_TOP)/libraries/readline/config.mk
-# readline's config.mk sets PACKAGE, which we don't want here
-PACKAGE=
-ifeq "$(READLINE_BUILD_PACKAGE)" "yes"
-SRC_HC_OPTS += -package readline -DUSE_READLINE
-PKG_DEPENDS += readline
-endif
-endif # stage=1
-endif # not windows
-
-else
-
-# No interpreter, so exclude Template Haskell modules
-EXCLUDED_SRCS += deSugar/DsMeta.hs typecheck/TcSplice.lhs hsSyn/Convert.lhs
-
-endif # bootstrapped with interpreter
-
-# -----------------------------------------------
-# mkdependC stuff
-#
-# Big Fudge to get around inherent problem that Makefile setup
-# has got with 'mkdependC'.
-#
-SRC_MKDEPENDC_OPTS += -D__GLASGOW_HASKELL__=$(ProjectVersionInt)
-
-# XXX not really correct, hschooks.c actually gets include files like
-# RtsFlags.c from the installed GHC, but we can't tell mkdependC about that.
-SRC_MKDEPENDC_OPTS += -I$(GHC_INCLUDE_DIR)
-
-# -----------------------------------------------------------------------------
-# Haskell compilations
-
-SRC_HC_OPTS += \
- -cpp -fglasgow-exts -fno-generics -Rghc-timing \
- -I. -Iparser
-
-# Omitted: -I$(GHC_INCLUDE_DIR)
-# We should have -I$(GHC_INCLUDE_DIR) in SRC_HC_OPTS,
-# to avoid the use of an explicit path in GHC source files
-# (include "../includes/config.h"
-# But alas GHC 4.08 (and others for all I know) uses this very
-# same include path when compiling the .hc files it generates.
-# Disaster! Then the hc file sees the GHC 5.02 (or whatever)
-# include files. For the moment we've reverted to using
-# an explicit path in the .hs sources
-#
-# For the benefit of <5.00 compilers, do include GHC_INCLUDE_DIR
-# when generating dependencies. (=> it gets passed onto mkdependHS,
-# which needs it).
-SRC_MKDEPENDHS_OPTS += -I$(GHC_INCLUDE_DIR)
-
-# We need System.Posix (or Posix when ghc < 6.2)
-ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
-ifeq "$(bootstrapped)" "YES"
-SRC_HC_OPTS += -package Win32
-PKG_DEPENDS += Win32
-endif
-else
-ifeq "$(bootstrapped) $(ghc_ge_601)" "NO NO"
-SRC_HC_OPTS += -package posix
-else
-SRC_HC_OPTS += -package unix
-PKG_DEPENDS += unix
-endif
-endif
-
-# We use the Cabal package in stages 2/3 only; in stage 1 we're using
-# the libcompat library which provides the Cabal modules.
-ifneq "$(stage)" "1"
-SRC_HC_OPTS += -package Cabal
-PKG_DEPENDS += Cabal
-endif
-
-ifeq "$(ghc_ge_603)" "YES"
-# Ignore lang, to avoid potential clash with the Generics module if
-# lang happens to be a dependency of some exposed package in the local
-# GHC installation (eg. wxHaskell did this around 6.4).
-SRC_HC_OPTS += -ignore-package lang
-endif
-
-SRC_CC_OPTS += -Iparser -I. -O
-SRC_HC_OPTS += -recomp $(GhcHcOpts) $(GhcStage$(stage)HcOpts)
-SRC_HC_OPTS += -H16M
-
-ifeq "$(BootingFromHc)" "YES"
-SRC_CC_OPTS += -D__GLASGOW_HASKELL__=$(ProjectVersionInt)
-endif
-
-# Special flags for particular modules
-# The standard suffix rule for compiling a Haskell file
-# adds these flags to the command line
-
-# There used to be a -no-recomp flag on PrimOp, but why?
-# It's an expensive module to recompile!
-prelude/PrimOp_HC_OPTS = -H80m
-
-
-main/ParsePkgConf_HC_OPTS += -fno-warn-incomplete-patterns
-parser/Parser_HC_OPTS += -fno-warn-incomplete-patterns
-
-ifeq "$(ghc_ge_603)" "NO"
-# Use -fvia-C since the NCG can't handle the narrow16Int# (and intToInt16#?)
-# primops on all platforms.
-parser/Parser_HC_OPTS += -fvia-C
-# because the NCG can't handle the 64-bit math in here
-prelude/PrelRules_HC_OPTS += -fvia-C
-# ByteCodeItbls uses primops that the NCG doesn't support.
-ghci/ByteCodeItbls_HC_OPTS += -fvia-C
-ghci/ByteCodeLink_HC_OPTS += -fvia-C -monly-3-regs
-endif
-
-# Careful optimisation of the parser: we don't want to throw everything
-# at it, because that takes too long and doesn't buy much, but we do want
-# to inline certain key external functions, so we instruct GHC not to
-# throw away inlinings as it would normally do in -Onot mode:
-parser/Parser_HC_OPTS += -Onot -fno-ignore-interface-pragmas
-
-ifeq "$(HOSTPLATFORM)" "hppa1.1-hp-hpux9"
-rename/RnMonad_HC_OPTS = -O2 -O2-for-C
-endif
-
-utils/Digraph_HC_OPTS = -fglasgow-exts
-
-basicTypes/SrcLoc_HC_OPTS = -funbox-strict-fields
-
-# We always optimise some low-level modules, otherwise performance of
-# a non-optimised compiler is severely affected.
-main/BinIface_HC_OPTS += -O
-utils/Binary_HC_OPTS += -O -funbox-strict-fields
-utils/FastMutInt_HC_OPTS += -O
-utils/Encoding_HC_OPTS += -O
-utils/StringBuffer_HC_OPTS += -O -funbox-strict-fields
-utils/FastString_HC_OPTS += -O -funbox-strict-fields
-
-# ---- Profiling ----
-#simplCore/Simplify_HC_OPTS = -auto-all
-#simplCore/SimplEnv_HC_OPTS = -auto-all
-#simplCore/SimplUtils_HC_OPTS = -auto-all
-
-# CSE interacts badly with top-level IORefs (reportedly in DriverState and
-# DriverMkDepend), causing some of them to be commoned up. We have a fix for
-# this in 5.00+, but earlier versions of the compiler will need CSE turned off.
-# To be on the safe side, we disable CSE in *all* modules with top-level IORefs.
-ghci/InteractiveUI_HC_OPTS = -fno-cse
-main/CmdLineOpts_HC_OPTS = -fno-cse
-main/DriverMkDepend_HC_OPTS = -fno-cse
-main/DriverPipeline_HC_OPTS = -fno-cse
-main/Finder_HC_OPTS = -fno-cse
-main/SysTools_HC_OPTS = -fno-cse
-main/StaticFlags_HC_OPTS = -fno-cse
-
-# The #include is vital for the via-C route, else the C
-# compiler doesn't realise that the stcall foreign imports are indeed
-# stdcall, and doesn't generate the Foo@8 name for them
-ifeq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
-main/SysTools_HC_OPTS += '-\#include <windows.h>' '-\#include <process.h>'
-endif
-
-parser/Lexer_HC_OPTS += -funbox-strict-fields
-
-# ghc_strlen percolates through so many modules that it is easier to get its
-# prototype via a global option instead of a myriad of per-file OPTIONS
-SRC_HC_OPTS += '-\#include "cutils.h"'
-