ts: fix build-ts-app helper macro

Correct adding extra flags to the CROSS_COMPILE settings and replace
dashes with underscore in variables to follow the common coding scheme.

Signed-off-by: Gabor Toth <gabor.toth2@arm.com>
Change-Id: Ie4877b59cc1c01fb4a2c29cc13e073b8c378d2a4
diff --git a/trusted-services.mk b/trusted-services.mk
index 82af02f..fb03215 100644
--- a/trusted-services.mk
+++ b/trusted-services.mk
@@ -157,12 +157,12 @@
 #
 # Each target will pass TS_APP_COMMON_FLAGS and
 # TS_APP_<ucfdpn>_EXTRA_FLAGS to cmake. ucfdpn is the upper case
-# deployment name with all / characters replaced by _ characters. These
-# variables allow setting extra build flags trough the environment.
+# deployment name with all / and - characters replaced by _ characters.
+# These variables allow setting extra build flags trough the environment.
 
 define build-ts-app
 .PHONY: ffa-$1
-FFA_$1_UC_NAME:=$(shell echo $1 | tr a-z/ A-Z_)
+FFA_$1_UC_NAME:=$(shell echo $1 | tr a-z/- A-Z__)
 ffa-$1:
 	CROSS_COMPILE=$(subst $(CCACHE),,$(CROSS_COMPILE_NS_USER)) cmake -G"Unix Makefiles" \
 		-S $(TS_PATH)/deployments/$1/arm-linux -B $(TS_BUILD_PATH)/$1 \
@@ -170,7 +170,7 @@
 		-Dlibts_DIR=${TS_INSTALL_PREFIX}/arm-linux/lib/cmake/libts \
 		-DCFG_FORCE_PREBUILT_LIBTS=On \
 		-DCMAKE_C_COMPILER_LAUNCHER=$(CCACHE) $(TS_APP_COMMON_FLAGS) \
-		$(TS_APP_${FFA_$1_UC_NAME}_EXTRA_FLAGS)
+		$$(TS_APP_$$(FFA_$1_UC_NAME)_EXTRA_FLAGS)
 	$$(MAKE) -C $(TS_BUILD_PATH)/$1 install
 
 ifneq ($1,libts)