make: Fix parallel builds

Parallel builds would fail while generating the dependency file of the
first source file that included tests_list.h due to it missing.
In-order builds only worked, because a rule that specified tests_list.c
as a prerequisite happened to get executed first.

This patch introduces tests_list.h as an order-only dependency of all
rules that generate dependency files. This is necessary because we can't
know which files actually depend on it until the dependency files have
been generated.

This forces the autogenerated files to be generated before any other
files are compiled, but does not cause unrelated files to recompile if
they are modified.

Signed-off-by: Bence Szépkúti <bence.szepkuti@arm.com>
Change-Id: I21f0b98052a884a853935ea35a2898ff90245a49
diff --git a/Makefile b/Makefile
index 1269b6d..100e241 100644
--- a/Makefile
+++ b/Makefile
@@ -353,7 +353,7 @@
 $(eval OBJ := $(1)/$(patsubst %.c,%.o,$(notdir $(2))))
 $(eval DEP := $(patsubst %.o,%.d,$(OBJ)))
 
-$(OBJ) : $(2)
+$(OBJ) : $(2) | $(AUTOGEN_DIR)/tests_list.h
 	@echo "  CC      $$<"
 	$$(Q)$$(CC) $$($(3)_CFLAGS) ${$(3)_INCLUDES} ${$(3)_DEFINES} -DIMAGE_$(3) $(MAKE_DEP) -c $$< -o $$@
 
@@ -366,7 +366,7 @@
 $(eval OBJ := $(1)/$(patsubst %.S,%.o,$(notdir $(2))))
 $(eval DEP := $(patsubst %.o,%.d,$(OBJ)))
 
-$(OBJ) : $(2)
+$(OBJ) : $(2) | $(AUTOGEN_DIR)/tests_list.h
 	@echo "  AS      $$<"
 	$$(Q)$$(AS) $$($(3)_ASFLAGS) ${$(3)_INCLUDES} ${$(3)_DEFINES} -DIMAGE_$(3) $(MAKE_DEP) -c $$< -o $$@
 
@@ -378,7 +378,7 @@
 
 $(eval DEP := $(1).d)
 
-$(1) : $(2)
+$(1) : $(2) | $(AUTOGEN_DIR)/tests_list.h
 	@echo "  PP      $$<"
 	$$(Q)$$(AS) $$($(3)_ASFLAGS) ${$(3)_INCLUDES} ${$(3)_DEFINES} -P -E $(MAKE_DEP) -o $$@ $$<