-# Main compiler Makefile
-
-# Targets:
-#
-# all builds stage1 compiler
-#
-# boot stage=N generate build dirs and dependencies for stage N.
-# NB. Must be done before 'make stageN'.
-# NB. Cannot 'make boot stage=2' until stage1 has
-# been built (similarly for stage3).
-#
-# stage1 (or stage=1) builds stage1 compiler
-# stage2 (or stage=2) builds stage2 compiler
-# stage3 (or stage=3) builds stage3 compiler
-#
-
-TOP = ..
-
-# Use GHC for compiling C bits (NB. must be before boilerplate include)
-#
-UseGhcForCc = YES
-
-# We don't want to compile stage1 in multiple ways
-ifeq "$(findstring $(stage), 2 3)" ""
-WAYS=
-endif
-
-include $(TOP)/mk/boilerplate.mk
-
-ifeq "$(GhcThreaded)$(GhcProfiled)" "YESYES"
-$(error Cannot make GHC both threaded and profiled)
-endif
-
-
-#-----------------------------------------------------------------------------
-# Counting source code lines
-
-USER_SRCS = $(filter-out $(DERIVED_SRCS),$(SRCS))
-count :
- ./count_lines $(USER_SRCS)
-
-# -----------------------------------------------------------------------------
-# Bootstrapping
-
-# The stage1/stage2/stage3 business is quite delicate. Here's how it works:
-#
-# - the variable $(stage) holds the current stage number. To build a
-# particular stage, you say 'make stage=N' where N is 1, 2, or 3.
-# N defaults to 1.
-#
-# - for stage N, object files and .hi files are placed inside
-# the directory stageN, in subdirectories as per the sources.
-#
-# - .hi-boot files are *linked* into the stageN tree, because in GHC 5.05+
-# the .hi-boot file must reside in the same place as the .hi file.
-#
-# - we use explicit -o and -ohi options to direct the output from C &
-# Haskell compilations.
-#
-# - we generate a different .depend file for each build. They need to be
-# different, because each stage might include different files: stage1
-# might not include GHCi, for example. For each stage, a normal .depend
-# file is generated, and then post-processed to add the correct stageN/
-# prefix to each object and .hi filename. The resulting .depend file
-# is named .depend-$(stage). See the end of this Makefile for details.
-#
-# - normal implicit rules don't work any more, because they're of the form
-#
-# %.o : %.hs
-#
-# whereas we really need
-#
-# stageN/%.o : %.hs
-#
-# so suffix.mk now defines the appropriate suffix rules when
-# $(odir) is set to a non-empty value. Here we set $(odir) to
-# stage1, stage2, or stage3.
-#
-# There are other plausible designs that might work, but each has different
-# problems:
-#
-# - using -odir and -hidir: GHC <= 4.08 doesn't support -hidir, and
-# anyway -odir puts all the objects in one directory (strips off the
-# subdirectory part), which eventually forces us to use VPATH to find
-# the sources. I have a really bad feeling about VPATH.
-#
-# - invoke make in the stageN subdirectory. This probably requires VPATH
-# too.
-#
-# - create a link tree. The problem with requiring link trees is that
-# Windows doesn't support symbolic links.
-
-ifeq "$(stage)" ""
-stage=1
-endif
-
-.DUMMY: stage_dir
-stage_dirs :
- $(MKDIRHIER) stage$(stage)
- for i in $(ALL_DIRS); do \
- $(MKDIRHIER) stage$(stage)/$$i; \
- done
-
-ifeq "$(stage)" "1"
-UsingHsBoot = YES
-else
-ifneq "$(findstring $(stage), 2 3)" ""
-UsingHsBoot = YES
-else
-UsingHsBoot = NO
-endif
-endif
-
-boot :: stage_dirs
-# On Windows, we can't use symbolic links for the -hi-boot files
-# because GHC itself is a Mingw program and does not understand
-# symbolic links. So we have to copy the files instead of link them.
-# That means that if you modify a .hi-boot file in Windows, you
-# have to to say 'make boot' again.
-#
-# PS: 'ln -s foo baz' takes 'foo' relative to the path to 'baz'
-# whereas 'cp foo baz' treats the two paths independently.
-# Hence the "../.." in the ln command line
-ifeq "$(UsingHsBoot)" "NO"
-ifeq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
- for i in */*hi-boot*; do \
- cp -u -f $$i stage$(stage)/$$i; \
- done
-else
- for i in */*hi-boot*; do \
- ($(RM) -f stage$(stage)/$$i \
- && $(LN_S) ../../$$i stage$(stage)/$$i) || true ; \
- done
-endif
-endif
-
-ifeq "$(stage)" "1"
-HC=$(GHC)
-endif
-
-ifeq "$(stage)" "2"
-HC=$(GHC_STAGE1)
-endif
-
-ifeq "$(stage)" "3"
-HC=$(GHC_STAGE2)
-endif
-
-stage1 ::
- $(MAKE) stage=1
-
-stage2 ::
- $(MAKE) stage=2
-
-stage3 ::
- $(MAKE) stage=3
-
-odir=stage$(stage)
-
-SRC_HC_OPTS += $(patsubst %, -i$(odir)/%, $(ALL_DIRS))
-
-SRC_HC_OPTS += -Wall -fno-warn-name-shadowing
-# Turn off orphan warnings, but only if the flag exists (i.e. not if we
-# are building stage 1 and using GHC < 6.3).
-ifneq "$(stage)" "1 NO"
-SRC_HC_OPTS += -fno-warn-orphans
-endif
-
-HS_OBJS = $(patsubst %, $(odir)/%, $(addsuffix .$(way_)o,$(basename $(HS_SRCS))))
-C_OBJS = $(patsubst %, $(odir)/%, $(addsuffix .$(way_)o,$(basename $(C_SRCS))))
-
-# Our standard cleaning rules don't know that we're doing our output
-# into $(odir), so we have to augment CLEAN_FILES appropriateliy.
-
-CLEAN_FILES += $(odir)/*/*.$(way_)hi $(odir)/*/*.$(way_)hi-boot $(odir)/*/*.$(way_)o-boot
-
-ifeq "$(UsingHsBoot)" "YES"
-CLEAN_FILES += $(odir)/*/*.hi-boot $(odir)/*/*.o-boot
-endif
-
-ifeq "$(stage)" "1"
-mostlyclean clean distclean maintainer-clean ::
- $(MAKE) $@ stage=2
- $(MAKE) $@ stage=3
-endif
-
-# -----------------------------------------------------------------------------
-# Set HS_PROG
-
-# Note: there have been reports of people running up against the ARG_MAX limit
-# when linking ghc with all its constituent object files. The likely source of
-# the problem is that the environment is a bit too big, so a workaround could
-# be to do `env PATH=$(PATH) make ghc' to minimise the environment. (or the
-# equivalent of `env' if it doesn't exist locally).
-#
-ifneq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
-GHC_PROG=$(odir)/ghc$(_way)-$(ProjectVersion)
-else
-GHC_PROG=$(odir)/ghc$(_way)
-endif
-
-ifeq "$(stage)" "1"
-HS_PROG = $(GHC_PROG)
-endif
-
-# -----------------------------------------------------------------------------
-# Create compiler configuration
-#
-# The 'echo' commands simply spit the values of various make variables
-# into Config.hs, whence they can be compiled and used by GHC itself
-
-CONFIG_HS = main/Config.hs
-boot :: $(CONFIG_HS)
-
-$(CONFIG_HS) : $(FPTOOLS_TOP)/mk/config.mk
- @$(RM) -f $(CONFIG_HS)
- @echo "Creating $(CONFIG_HS) ... "
- @echo "module Config where" >>$(CONFIG_HS)
- @echo "cProjectName :: String" >> $(CONFIG_HS)
- @echo "cProjectName = \"$(ProjectName)\"" >> $(CONFIG_HS)
- @echo "cProjectVersion :: String" >> $(CONFIG_HS)
- @echo "cProjectVersion = \"$(ProjectVersion)\"" >> $(CONFIG_HS)
- @echo "cProjectVersionInt :: String" >> $(CONFIG_HS)
- @echo "cProjectVersionInt = \"$(ProjectVersionInt)\"" >> $(CONFIG_HS)
- @echo "cProjectPatchLevel :: String" >> $(CONFIG_HS)
- @echo "cProjectPatchLevel = \"$(ProjectPatchLevel)\"" >> $(CONFIG_HS)
- @echo "cBooterVersion :: String" >> $(CONFIG_HS)
- @echo "cBooterVersion = \"$(GhcVersion)\"" >> $(CONFIG_HS)
- @echo "cStage :: String" >> $(CONFIG_HS)
- @echo "cStage = STAGE" >> $(CONFIG_HS)
- @echo "cHscIfaceFileVersion :: String" >> $(CONFIG_HS)
- @echo "cHscIfaceFileVersion = \"$(HscIfaceFileVersion)\"" >> $(CONFIG_HS)
- @echo "cSplitObjs :: String" >> $(CONFIG_HS)
- @echo "cSplitObjs = \"$(SplitObjs)\"" >> $(CONFIG_HS)
- @echo "cGhcWithInterpreter :: String" >> $(CONFIG_HS)
- @echo "cGhcWithInterpreter = \"$(GhcWithInterpreter)\"" >> $(CONFIG_HS)
- @echo "cGhcWithNativeCodeGen :: String" >> $(CONFIG_HS)
- @echo "cGhcWithNativeCodeGen = \"$(GhcWithNativeCodeGen)\"" >> $(CONFIG_HS)
- @echo "cGhcWithSMP :: String" >> $(CONFIG_HS)
- @echo "cGhcWithSMP = \"$(GhcWithSMP)\"" >> $(CONFIG_HS)
- @echo "cGhcRTSWays :: String" >> $(CONFIG_HS)
- @echo "cGhcRTSWays = \"$(GhcRTSWays)\"" >> $(CONFIG_HS)
- @echo "cGhcUnregisterised :: String" >> $(CONFIG_HS)
- @echo "cGhcUnregisterised = \"$(GhcUnregisterised)\"" >> $(CONFIG_HS)
- @echo "cGhcEnableTablesNextToCode :: String" >> $(CONFIG_HS)
- @echo "cGhcEnableTablesNextToCode = \"$(GhcEnableTablesNextToCode)\"" >> $(CONFIG_HS)
- @echo "cLeadingUnderscore :: String" >> $(CONFIG_HS)
- @echo "cLeadingUnderscore = \"$(LeadingUnderscore)\"" >> $(CONFIG_HS)
- @echo "cRAWCPP_FLAGS :: String" >> $(CONFIG_HS)
- @echo "cRAWCPP_FLAGS = \"$(RAWCPP_FLAGS)\"" >> $(CONFIG_HS)
- @echo "cGCC :: String" >> $(CONFIG_HS)
- @echo "cGCC = \"$(WhatGccIsCalled)\"" >> $(CONFIG_HS)
- @echo "cMKDLL :: String" >> $(CONFIG_HS)
- @echo "cMKDLL = \"$(BLD_DLL)\"" >> $(CONFIG_HS)
- @echo "cLdIsGNULd :: String" >> $(CONFIG_HS)
- @echo "cLdIsGNULd = \"$(LdIsGNULd)\"" >> $(CONFIG_HS)
- @echo "cLD_X :: String" >> $(CONFIG_HS)
- @echo "cLD_X = \"$(LD_X)\"" >> $(CONFIG_HS)
- @echo "cPROJECT_DIR :: String" >> $(CONFIG_HS)
- @echo "cPROJECT_DIR = \"$(PROJECT_DIR)\"" >> $(CONFIG_HS)
- @echo "cGHC_DRIVER_DIR_REL :: String" >> $(CONFIG_HS)
- @echo "cGHC_DRIVER_DIR_REL = \"$(GHC_DRIVER_DIR_REL)\"" >> $(CONFIG_HS)
- @echo "cGHC_TOUCHY_PGM :: String" >> $(CONFIG_HS)
- @echo "cGHC_TOUCHY_PGM = \"$(GHC_TOUCHY_PGM)\"" >> $(CONFIG_HS)
- @echo "cGHC_TOUCHY_DIR_REL :: String" >> $(CONFIG_HS)
- @echo "cGHC_TOUCHY_DIR_REL = \"$(GHC_TOUCHY_DIR_REL)\"" >> $(CONFIG_HS)
- @echo "cGHC_UNLIT_PGM :: String" >> $(CONFIG_HS)
- @echo "cGHC_UNLIT_PGM = \"$(GHC_UNLIT_PGM)\"" >> $(CONFIG_HS)
- @echo "cGHC_UNLIT_DIR_REL :: String" >> $(CONFIG_HS)
- @echo "cGHC_UNLIT_DIR_REL = \"$(GHC_UNLIT_DIR_REL)\"" >> $(CONFIG_HS)
- @echo "cGHC_MANGLER_PGM :: String" >> $(CONFIG_HS)
- @echo "cGHC_MANGLER_PGM = \"$(GHC_MANGLER_PGM)\"" >> $(CONFIG_HS)
- @echo "cGHC_MANGLER_DIR_REL :: String" >> $(CONFIG_HS)
- @echo "cGHC_MANGLER_DIR_REL = \"$(GHC_MANGLER_DIR_REL)\"" >> $(CONFIG_HS)
- @echo "cGHC_SPLIT_PGM :: String" >> $(CONFIG_HS)
- @echo "cGHC_SPLIT_PGM = \"$(GHC_SPLIT_PGM)\"" >> $(CONFIG_HS)
- @echo "cGHC_SPLIT_DIR_REL :: String" >> $(CONFIG_HS)
- @echo "cGHC_SPLIT_DIR_REL = \"$(GHC_SPLIT_DIR_REL)\"" >> $(CONFIG_HS)
- @echo "cGHC_SYSMAN_PGM :: String" >> $(CONFIG_HS)
- @echo "cGHC_SYSMAN_PGM = \"$(GHC_SYSMAN)\"" >> $(CONFIG_HS)
- @echo "cGHC_SYSMAN_DIR_REL :: String" >> $(CONFIG_HS)
- @echo "cGHC_SYSMAN_DIR_REL = \"$(GHC_SYSMAN_DIR)\"" >> $(CONFIG_HS)
- @echo "cGHC_CP :: String" >> $(CONFIG_HS)
- @echo "cGHC_CP = \"$(GHC_CP)\"" >> $(CONFIG_HS)
- @echo "cGHC_PERL :: String" >> $(CONFIG_HS)
- @echo "cGHC_PERL = \"$(GHC_PERL)\"" >> $(CONFIG_HS)
-ifeq ($(GhcWithIlx),YES)
- @echo "cILX2IL :: String" >> $(CONFIG_HS)
- @echo "cILX2IL = \"$(ILX2IL)\"" >> $(CONFIG_HS)
- @echo "cILASM :: String" >> $(CONFIG_HS)
- @echo "cILASM = \"$(ILASM)\"" >> $(CONFIG_HS)
-endif
- @echo "cEnableWin32DLLs :: String" >> $(CONFIG_HS)
- @echo "cEnableWin32DLLs = \"$(EnableWin32DLLs)\"" >> $(CONFIG_HS)
- @echo "cCONTEXT_DIFF :: String" >> $(CONFIG_HS)
- @echo "cCONTEXT_DIFF = \"$(CONTEXT_DIFF)\"" >> $(CONFIG_HS)
- @echo "cUSER_WAY_NAMES :: String" >> $(CONFIG_HS)
- @echo "cUSER_WAY_NAMES = \"$(USER_WAY_NAMES)\"" >> $(CONFIG_HS)
- @echo "cUSER_WAY_OPTS :: String" >> $(CONFIG_HS)
- @echo "cUSER_WAY_OPTS = \"$(USER_WAY_OPTS)\"" >> $(CONFIG_HS)
- @echo "cDEFAULT_TMPDIR :: String" >> $(CONFIG_HS)
- @echo "cDEFAULT_TMPDIR = \"$(DEFAULT_TMPDIR)\"" >> $(CONFIG_HS)
- @echo "cRelocatableBuild :: Bool" >> $(CONFIG_HS)
-ifeq "$(RelocatableBuild)" "YES"
- @echo "cRelocatableBuild = True" >> $(CONFIG_HS)
-else
- @echo "cRelocatableBuild = False" >> $(CONFIG_HS)
-endif
- @echo "cLibFFI :: Bool" >> $(CONFIG_HS)
-ifeq "$(UseLibFFI)" "YES"
- @echo "cLibFFI = True" >> $(CONFIG_HS)
-else
- @echo "cLibFFI = False" >> $(CONFIG_HS)
-endif
- @echo done.
-
-CLEAN_FILES += $(CONFIG_HS)
-
-# -----------------------------------------------------------------------------
-# Create platform includes
-
-# Here we generate a little header file containing CPP symbols that GHC
-# uses to determine which platform it is building on/for. The platforms
-# can differ between stage1 and stage2 if we're cross-compiling, so we
-# need one of these header files per stage.
-
-PLATFORM_H = ghc_boot_platform.h
-
-stage1/$(PLATFORM_H) : stage_dirs $(FPTOOLS_TOP)/mk/config.mk
- @echo "Creating $@..."
- @$(RM) $@
- @echo "#ifndef __PLATFORM_H__" >$@
- @echo "#define __PLATFORM_H__" >>$@
- @echo >> $@
- @echo "#define BuildPlatform_NAME \"$(BUILDPLATFORM)\"" >> $@
- @echo "#define HostPlatform_NAME \"$(HOSTPLATFORM)\"" >> $@
- @echo "#define TargetPlatform_NAME \"$(TARGETPLATFORM)\"" >> $@
- @echo >> $@
- @echo "#define $(BuildPlatform_CPP)_BUILD 1" >> $@
- @echo "#define $(HostPlatform_CPP)_HOST 1" >> $@
- @echo "#define $(TargetPlatform_CPP)_TARGET 1" >> $@
- @echo >> $@
- @echo "#define $(BuildArch_CPP)_BUILD_ARCH 1" >> $@
- @echo "#define $(HostArch_CPP)_HOST_ARCH 1" >> $@
- @echo "#define $(TargetArch_CPP)_TARGET_ARCH 1" >> $@
- @echo "#define BUILD_ARCH \"$(BuildArch_CPP)\"" >> $@
- @echo "#define HOST_ARCH \"$(HostArch_CPP)\"" >> $@
- @echo "#define TARGET_ARCH \"$(TargetArch_CPP)\"" >> $@
- @echo >> $@
- @echo "#define $(BuildOS_CPP)_BUILD_OS 1" >> $@
- @echo "#define $(HostOS_CPP)_HOST_OS 1" >> $@
- @echo "#define $(TargetOS_CPP)_TARGET_OS 1" >> $@
- @echo "#define BUILD_OS \"$(BuildOS_CPP)\"" >> $@
- @echo "#define HOST_OS \"$(HostOS_CPP)\"" >> $@
- @echo "#define TARGET_OS \"$(TargetOS_CPP)\"" >> $@
-ifeq "$(HostOS_CPP)" "irix"
- @echo "#ifndef $(IRIX_MAJOR)_TARGET_OS " >> $@
- @echo "#define $(IRIX_MAJOR)_TARGET_OS 1" >> $@
- @echo "#endif " >> $@
-endif
- @echo >> $@
- @echo "#define $(BuildVendor_CPP)_BUILD_VENDOR 1" >> $@
- @echo "#define $(HostVendor_CPP)_HOST_VENDOR 1" >> $@
- @echo "#define $(TargetVendor_CPP)_TARGET_VENDOR 1" >> $@
- @echo "#define BUILD_VENDOR \"$(BuildVendor_CPP)\"" >> $@
- @echo "#define HOST_VENDOR \"$(HostVendor_CPP)\"" >> $@
- @echo "#define TARGET_VENDOR \"$(TargetVendor_CPP)\"" >> $@
- @echo >> $@
- @echo "#endif /* __PLATFORM_H__ */" >> $@
- @echo "Done."
-
-# For stage2 and above, the BUILD platform is the HOST of stage1, and
-# the HOST platform is the TARGET of stage1. The TARGET remains the same
-# (stage1 is the cross-compiler, not stage2).
-stage2/$(PLATFORM_H) : stage_dirs $(FPTOOLS_TOP)/mk/config.mk
- @echo "Creating $@..."
- @$(RM) $@
- @echo "#ifndef __PLATFORM_H__" >$@
- @echo "#define __PLATFORM_H__" >>$@
- @echo >> $@
- @echo "#define BuildPlatform_NAME \"$(HOSTPLATFORM)\"" >> $@
- @echo "#define HostPlatform_NAME \"$(TARGETPLATFORM)\"" >> $@
- @echo "#define TargetPlatform_NAME \"$(TARGETPLATFORM)\"" >> $@
- @echo >> $@
- @echo "#define $(HostPlatform_CPP)_BUILD 1" >> $@
- @echo "#define $(TargetPlatform_CPP)_HOST 1" >> $@
- @echo "#define $(TargetPlatform_CPP)_TARGET 1" >> $@
- @echo >> $@
- @echo "#define $(HostArch_CPP)_BUILD_ARCH 1" >> $@
- @echo "#define $(TargetArch_CPP)_HOST_ARCH 1" >> $@
- @echo "#define $(TargetArch_CPP)_TARGET_ARCH 1" >> $@
- @echo "#define BUILD_ARCH \"$(HostArch_CPP)\"" >> $@
- @echo "#define HOST_ARCH \"$(TargetArch_CPP)\"" >> $@
- @echo "#define TARGET_ARCH \"$(TargetArch_CPP)\"" >> $@
- @echo >> $@
- @echo "#define $(HostOS_CPP)_BUILD_OS 1" >> $@
- @echo "#define $(TargetOS_CPP)_HOST_OS 1" >> $@
- @echo "#define $(TargetOS_CPP)_TARGET_OS 1" >> $@
- @echo "#define BUILD_OS \"$(HostOS_CPP)\"" >> $@
- @echo "#define HOST_OS \"$(TargetOS_CPP)\"" >> $@
- @echo "#define TARGET_OS \"$(TargetOS_CPP)\"" >> $@
-ifeq "$(HostOS_CPP)" "irix"
- @echo "#ifndef $(IRIX_MAJOR)_TARGET_OS " >> $@
- @echo "#define $(IRIX_MAJOR)_TARGET_OS 1" >> $@
- @echo "#endif " >> $@
-endif
- @echo >> $@
- @echo "#define $(HostVendor_CPP)_BUILD_VENDOR 1" >> $@
- @echo "#define $(TargetVendor_CPP)_HOST_VENDOR 1" >> $@
- @echo "#define $(TargetVendor_CPP)_TARGET_VENDOR 1" >> $@
- @echo "#define BUILD_VENDOR \"$(HostVendor_CPP)\"" >> $@
- @echo "#define HOST_VENDOR \"$(TargetVendor_CPP)\"" >> $@
- @echo "#define TARGET_VENDOR \"$(TargetVendor_CPP)\"" >> $@
- @echo >> $@
- @echo "#endif /* __PLATFORM_H__ */" >> $@
- @echo "Done."
-
-stage3/$(PLATFORM_H) : stage_dirs stage2/$(PLATFORM_H)
- $(CP) stage2/$(PLATFORM_H) stage3/$(PLATFORM_H)
-
-STAGE_PLATFORM_H = stage$(stage)/$(PLATFORM_H)
-
-boot :: $(STAGE_PLATFORM_H)
-
-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 \
- vectorise specialise simplCore stranal stgSyn simplStg codeGen main \
- profiling parser cprAnalysis 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 ($(UseLibFFI),YES)
-SRC_HC_OPTS += -DUSE_LIBFFI
-SRC_HSC2HS_OPTS += -DUSE_LIBFFI
-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
-
-# Beyond stage 1, honour any Mac OS X depolyment target options. If we use
-# these options in stage 1 we get a linker error if the bootstrap compiler is
-# for a more recent OS version
-ifneq "$(findstring $(stage), 2 3)" ""
-SRC_CC_OPTS += $(MACOSX_DEPLOYMENT_CC_OPTS)
-SRC_HC_OPTS += $(addprefix -optc, $(MACOSX_DEPLOYMENT_CC_OPTS))
-SRC_LD_OPTS += $(addprefix -optl, $(MACOSX_DEPLOYMENT_LD_OPTS))
-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 "$(bootstrapped)" "YES"
-SRC_HC_OPTS += -package hpc -package bytestring
-PKG_DEPENDS += hpc bytestring
-endif
-
-ifeq "$(GhcWithInterpreter) $(bootstrapped)" "YES YES"
-
-# Yes, include the interepreter and Template Haskell extensions
-SRC_HC_OPTS += -DGHCI -package template-haskell
-PKG_DEPENDS += template-haskell
-
-# 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
-
-ifeq "$(GhcThreaded)" "YES"
-# Use threaded RTS with GHCi, so threads don't get blocked at the prompt.
-SRC_LD_OPTS += -threaded
-endif
-ifeq "$(GhcProfiled)" "YES"
-SRC_LD_OPTS += -prof
-endif
-ifeq "$(GhcDebugged)" "YES"
-SRC_LD_OPTS += -debug
-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
-ifeq "$(wildcard $(FPTOOLS_TOP_ABS)/libraries/readline/unbuildable)" ""
-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