-%.$(way_)o : %.hs
- $(RM) $@
- $(HASKELL_PRE_COMPILE)
- $(HC) $(HC_OPTS) -c $< -o $@ -osuf $(subst .,,$(suffix $@))
- $(HASKELL_POST_COMPILE)
-
-%.$(way_)o : %.lhs
- $(RM) $@
- $(HASKELL_PRE_COMPILE)
- $(HC) $(HC_OPTS) -c $< -o $@ -osuf $(subst .,,$(suffix $@))
- $(HASKELL_POST_COMPILE)
-
-%.$(way_)hc : %.lhs
+# Turn off all the Haskell suffix rules if we're booting from .hc
+# files. The file bootstrap.mk contains alternative suffix rules in
+# this case.
+ifneq "$(BootingFromHc)" "YES"
+
+$(odir_)%.$(way_)o : %.hs
+ $(HC_PRE_OPTS)
+ $(HC) $(HC_OPTS) -c $< -o $@ -ohi $(basename $@).$(way_)hi
+ $(HC_POST_OPTS)
+
+$(odir_)%.$(way_)o : %.lhs
+ $(HC_PRE_OPTS)
+ $(HC) $(HC_OPTS) -c $< -o $@ -ohi $(basename $@).$(way_)hi
+ $(HC_POST_OPTS)
+
+$(odir_)%.$(way_)hc : %.lhs