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/spm/ivy/ivy.mk b/spm/ivy/ivy.mk
index 0c0039d..2e6cbfa 100644
--- a/spm/ivy/ivy.mk
+++ b/spm/ivy/ivy.mk
@@ -16,9 +16,11 @@
 IVY_SHIM	:= 1
 
 ifeq (${IVY_SHIM},1)
-	IVY_DTB		:= $(BUILD_PLAT)/ivy-sel1.dtb
+	IVY_DTB			:= $(BUILD_PLAT)/ivy-sel1.dtb
+	SECURE_PARTITIONS	+= ivy_shim
 else
-	IVY_DTB		:= $(BUILD_PLAT)/ivy-sel0.dtb
+	IVY_DTB			:= $(BUILD_PLAT)/ivy-sel0.dtb
+	SECURE_PARTITIONS	+= ivy
 endif
 
 IVY_INCLUDES :=					\
@@ -98,13 +100,11 @@
 	@echo "  DTBGEN  $@"
 	${Q}tools/generate_dtb/generate_dtb.sh \
 		ivy ${IVY_DTS} $(BUILD_PLAT) $(IVY_DTB)
-	${Q}tools/generate_json/generate_json.sh \
-		ivy $(BUILD_PLAT) $(IVY_SHIM)
 	@echo
 	@echo "Built $@ successfully"
 	@echo
 
-ivy: $(IVY_DTB)
+ivy: $(IVY_DTB) SP_LAYOUT
 
 # FDTS_CP copies flattened device tree sources
 #   $(1) = output directory