lib/Makefile.inc: fail build when SPD would be empty

Add a check to be sure that at least one SPD file will be added and fail
the build when the resulting spd.bin would be empty.

Change-Id: Ic6db1dbe5fed5f242e408bcad4f36dda1b1fa1b4
Signed-off-by: Michael Niewöhner <foss@mniewoehner.de>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/45131
Reviewed-by: Furquan Shaikh <furquan@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
diff --git a/src/lib/Makefile.inc b/src/lib/Makefile.inc
index 6829578..62f10be 100644
--- a/src/lib/Makefile.inc
+++ b/src/lib/Makefile.inc
@@ -357,6 +357,10 @@
 
 # Include spd ROM data
 $(LIB_SPD_BIN): $(LIB_SPD_DEPS)
+	test -n "$(SPD_SOURCES)" || \
+	    (echo "HAVE_SPD_BIN_IN_CBFS is set but SPD_SOURCES is empty" && exit 1)
+	test -n "$(LIB_SPD_DEPS)" || \
+	    (echo "SPD_SOURCES is set but no SPD file was found" && exit 1)
 	for f in $(LIB_SPD_DEPS); \
 	 do for c in $$(cat $$f | grep --binary-files=text -v ^#); \
 	  do printf $$(printf '\\%o' 0x$$c); \