INSTALLING=1
-SRC_HC_OPTS += -i$(GHC_LIB_COMPAT_DIR)
-SRC_LD_OPTS += -L$(GHC_LIB_COMPAT_DIR) -lghccompat
+# This causes libghccompat.a to be used:
+include $(GHC_LIB_COMPAT_DIR)/compat.mk
+
+# This is required because libghccompat.a must be built with
+# $(GhcHcOpts) because it is linked to the compiler, and hence
+# we must also build with $(GhcHcOpts) here:
+SRC_HC_OPTS += $(GhcHcOpts)
HS_PROG = hsc2hs-bin
ifeq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
# for calling the C preprocessor via GHC has changed a few times, making a
# clean solution impossible. So we revert to a hack in Main.hs...
SRC_HC_OPTS += -Wall
-ifeq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
-SRC_HC_OPTS += -Dmingw32_HOST_OS=1
-endif
ifneq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
INSTALLED_SCRIPT_PROG = hsc2hs