summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'compiler')
-rw-r--r--compiler/ghc.mk15
1 files changed, 13 insertions, 2 deletions
diff --git a/compiler/ghc.mk b/compiler/ghc.mk
index 43b609b7b5..54dfa3efdb 100644
--- a/compiler/ghc.mk
+++ b/compiler/ghc.mk
@@ -265,8 +265,6 @@ PRIMOP_BITS = compiler/primop-data-decl.hs-incl \
compiler_CPP_OPTS += -I$(GHC_INCLUDE_DIR)
compiler_CPP_OPTS += ${GhcCppOpts}
-compiler/stage2/build/LibFFI.hs : $(ffi_HEADER)
-
$(PRIMOPS_TXT) compiler/parser/Parser.y: %: %.pp compiler/stage1/$(PLATFORM_H)
$(CPP) $(RAWCPP_FLAGS) -P $(compiler_CPP_OPTS) -x c $< | grep -v '^#pragma GCC' > $@
@@ -493,6 +491,19 @@ ifeq "$(GhcVersion)" "6.12.2"
compiler/hsSyn/HsLit_HC_OPTS += -fomit-interface-pragmas
endif
+# LibFFI.hs #includes ffi.h
+compiler/stage2/build/LibFFI.hs : $(ffi_HEADER)
+# On Windows it seems we also need to link directly to libffi
+ifeq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
+define windowsDynLinkToFfi
+# $1 = way
+ifneq "$$(findstring dyn, $1)" ""
+compiler_stage2_$1_ALL_HC_OPTS += -lffi-5
+endif
+endef
+$(foreach way,$(GhcLibWays),$(eval $(call windowsDynLinkToFfi,$(way))))
+endif
+
# Note [munge-stage1-package-config]
# Strip the date/patchlevel from the version of stage1. See Note
# [fiddle-stage1-version] above.