# Yes, include the interepreter, readline, and Template Haskell extensions
SRC_HC_OPTS += -DGHCI -package template-haskell
-PKG_DEPENDS += template_haskell
+PKG_DEPENDS += template-haskell
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
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
# set GhcCompilerWays instead.
GhcLibWays = $(GhcCompilerWays)
+# override $(GhcLibHcOpts): we want GhcStage2HcOpts to take precedence
+GhcLibHcOpts =
+
# override default definition of HS_IFACES so we can add $(odir)
HS_IFACES = $(addsuffix .$(way_)hi,$(basename $(HS_OBJS)))
+
+# Haddock can't handle recursive modules currently, so we disable it for now.
+NO_HADDOCK_DOCS = YES
endif
#-----------------------------------------------------------------------------