payloads/edk2: Separate the Release String variable

Separate the Release String from the Build String. This allows
the makefile to locate built files more precisely.

Signed-off-by: Sean Rhodes <sean@starlabs.systems>
Change-Id: Id98674f0bbf485b2bfdbf5784d325c5ac89ad076
Reviewed-on: https://review.coreboot.org/c/coreboot/+/66358
Reviewed-by: Lean Sheng Tan <sheng.tan@9elements.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
diff --git a/payloads/external/edk2/Makefile b/payloads/external/edk2/Makefile
index 2fe47ac..8191a58 100644
--- a/payloads/external/edk2/Makefile
+++ b/payloads/external/edk2/Makefile
@@ -31,8 +31,10 @@
 BUILD_STR += -D BOOT_MANAGER_ESCAPE=TRUE
 endif
 # BUILD_TARGETS			= DEBUG
-ifeq ($(CONFIG_EDK2_RELEASE),y)
-BUILD_STR += -b RELEASE
+ifeq ($(CONFIG_EDK2_DEBUG),y)
+RELEASE_STR = DEBUG
+else
+RELEASE_STR = RELEASE
 endif
 # DISABLE_SERIAL_TERMINAL	= FALSE
 ifneq ($(CONFIG_EDK2_SERIAL_SUPPORT),y)
@@ -176,9 +178,9 @@
 		if [ $$? -ne 0 ]; then \
 			cat ../tools_def.txt >> $(EDK2_PATH)/Conf/tools_def.txt; \
 		fi; \
-		build $(BUILD_STR); \
+		build -b $(RELEASE_STR) $(BUILD_STR); \
 		mkdir -p $(WORKSPACE)/output; \
-		mv $(WORKSPACE)/Build/UefiPayloadPkgX64/*_COREBOOT/FV/UEFIPAYLOAD.fd $(WORKSPACE)/output
+		mv $(WORKSPACE)/Build/UefiPayloadPkgX64/$(RELEASE_STR)_COREBOOT/FV/UEFIPAYLOAD.fd $(WORKSPACE)/output
 
 clean:
 	test -d $(WORKSPACE) && (cd $(WORKSPACE); rm -rf Build; rm -f Conf/tools_def.txt) || exit 0