Makefile: Port library dependency checks to mark_missing_dep

The dependency checks have to be moved after setting the CONFIG_*
defaults so that we can alert the user of missing dependencies for
things that should be enabled by default.

Change-Id: Ibf54b41b104a01029855f957c867208b36fe0714
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/flashrom-stable/+/73446
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
diff --git a/Makefile b/Makefile
index 9ca9d79..d08cf86 100644
--- a/Makefile
+++ b/Makefile
@@ -340,30 +340,6 @@
 $(call mark_unsupported,CONFIG_INTERNAL)
 endif
 
-ifeq ($(HAS_LIBPCI), no)
-$(call mark_unsupported,$(DEPENDS_ON_LIBPCI))
-endif
-
-ifeq ($(HAS_LIBFTDI1), no)
-$(call mark_unsupported,$(DEPENDS_ON_LIBFTDI1))
-endif
-
-ifeq ($(HAS_LIB_NI845X), no)
-$(call mark_unsupported,$(DEPENDS_ON_LIB_NI845X))
-endif
-
-ifeq ($(HAS_LIBJAYLINK), no)
-$(call mark_unsupported,$(DEPENDS_ON_LIBJAYLINK))
-endif
-
-ifeq ($(HAS_LIBUSB1), no)
-$(call mark_unsupported,$(DEPENDS_ON_LIBUSB1))
-endif
-
-ifeq ($(HAS_LIBGPIOD), no)
-$(call mark_unsupported,$(DEPENDS_ON_LIBGPIOD))
-endif
-
 ifeq ($(HAS_SERIAL), no)
 $(call mark_unsupported, $(DEPENDS_ON_SERIAL))
 endif
@@ -573,6 +549,35 @@
 CONFIG_INTERNAL_DMI ?= yes
 
 ###############################################################################
+# Check for missing dependencies for the selected CONFIG_* variables
+
+ifeq ($(HAS_LIBPCI), no)
+$(call mark_missing_dep,libpci,$(DEPENDS_ON_LIBPCI), \
+	"You can disable all PCI programmers with CONFIG_ENABLE_LIBPCI_PROGRAMMERS=no.\n")
+endif
+
+ifeq ($(HAS_LIBFTDI1), no)
+$(call mark_missing_dep,libftdi1,$(DEPENDS_ON_LIBFTDI1))
+endif
+
+ifeq ($(HAS_LIB_NI845X), no)
+$(call mark_missing_dep,libni845x,$(DEPENDS_ON_LIB_NI845X))
+endif
+
+ifeq ($(HAS_LIBJAYLINK), no)
+$(call mark_missing_dep,libjaylink,$(DEPENDS_ON_LIBJAYLINK))
+endif
+
+ifeq ($(HAS_LIBUSB1), no)
+$(call mark_missing_dep,libusb1/libusbx,$(DEPENDS_ON_LIBUSB1), \
+	"You can disable all USB programmers with CONFIG_ENABLE_LIBUSB1_PROGRAMMERS=no.\n");
+endif
+
+ifeq ($(HAS_LIBGPIOD), no)
+$(call mark_missing_dep,libgpiod,$(DEPENDS_ON_LIBGPIOD))
+endif
+
+###############################################################################
 # Programmer drivers and programmer support infrastructure.
 # Depending on the CONFIG_* variables set and verified above we set compiler flags and parameters below.