Build: refactor BL32 build rules

This complicated if-conditional combo was introduced by commit
70d1fc5383 ("Fix build error when `BL32` is not defined") in order
to fix the compile error of "make all" when SPD=opteed is given.

The requirement for the build system is like follows:

 - If both BL32 and BL32_SOURCES are defined, the former takes
   precedence.

 - If BL32 is undefined but BL32_SOURCES is defined, we compile
   BL32 from the source files.

 - We want to let the build fail if neither of them is defined,
   but we want to check it only when we are building FIP.

Refactor the code to not call FIP_ADD_IMG twice.  The behavior is
still the same.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
This commit is contained in:
Masahiro Yamada 2018-01-26 11:42:01 +09:00
parent 76d27d24d4
commit 9cd152397d
1 changed files with 5 additions and 3 deletions

View File

@ -616,9 +616,11 @@ endif
# build system will call FIP_ADD_IMG to print a warning message and abort the
# process. Note that the dependency on BL32 applies to the FIP only.
ifeq (${NEED_BL32},yes)
$(if ${BL32}, $(eval $(call FIP_ADD_IMG,BL32,${BL32},--tos-fw)),\
$(if ${BL32_SOURCES}, $(eval $(call MAKE_BL,32,tos-fw)),\
$(eval $(call FIP_ADD_IMG,BL32,--tos-fw))))
BUILD_BL32 := $(if $(BL32),,$(if $(BL32_SOURCES),1))
$(if ${BUILD_BL32}, $(eval $(call MAKE_BL,32,tos-fw)),\
$(eval $(call FIP_ADD_IMG,BL32,--tos-fw)))
endif
# Add the BL33 image if required by the platform