-ifneq "$$(CHECKED_$1)" "YES"
-CHECKED_$1 = YES
-check_packages: check_$1
-.PHONY: check_$1
-check_$1: $$(GHC_CABAL_INPLACE)
- $$(GHC_CABAL_INPLACE) check $1
+# We must use a different dependency file if $(GhcLibWays) changes, so
+# encode the ways into the name of the file.
+$1_$2_WAYS_DASHED = $$(subst $$(space),,$$(patsubst %,-%,$$(strip $$($1_$2_WAYS))))
+$1_$2_depfile_base = $1/$2/build/.depend$$($1_$2_WAYS_DASHED)
+
+########################################
+ifeq "$$($1_$2_CONFIGURE_PHASE)" ""
+$$(error No configure phase for $1_$2)
+else ifeq "$$($1_$2_CONFIGURE_PHASE)" "$$(phase)"
+
+ifeq "$$(DEBUG)" "YES"
+$$(warning $1/$2 configure phase)