fix(build): race condition in sp layout generation

To prevent concurrency errors make it so generate_json.sh is
only called once during make. To do this supply a list of
present partitions to the script and generate the sp_layout
file using this.

Signed-off-by: Daniel Boulby <daniel.boulby@arm.com>
Change-Id: If9987cf5cd88be4ca617ce304e37d95346fb481b
diff --git a/Makefile b/Makefile
index 738a926..ff8ac27 100644
--- a/Makefile
+++ b/Makefile
@@ -112,6 +112,9 @@
 include fwu/ns_bl1u/ns_bl1u.mk
 include fwu/ns_bl2u/ns_bl2u.mk
 
+# List of secure partitions present.
+SECURE_PARTITIONS	:=
+
 # Only platform fvp supports cactus_mm, quark
 ifeq (${ARCH}-${PLAT},aarch64-fvp)
 include spm/cactus_mm/cactus_mm.mk
@@ -531,6 +534,10 @@
   $(eval $(call MAKE_IMG,ivy))
 endif
 
+SP_LAYOUT:
+	${Q}tools/generate_json/generate_json.sh \
+		$(BUILD_PLAT) $(SECURE_PARTITIONS)
+
 # The EL3 test payload is only supported in AArch64. It has an independent build
 # system.
 .PHONY: el3_payload