From 159269e971d4e0814744ab9f6e3f15902440a436 Mon Sep 17 00:00:00 2001
From: Mark Hatle <mark.hatle@xilinx.com>
Date: Mon, 13 Sep 2021 13:24:50 -0700
Subject: [PATCH] zynqmp_pmufw: Fixup core makefile

The Yocto Project build environment needs to be able to override a few
additional variables that may not be appropriate to do on the regular
command line build version.  This Yocto Project specific will allow this
behavior.

Signed-off-by: Mark Hatle <mark.hatle@xilinx.com>
---
 lib/sw_apps/zynqmp_pmufw/misc/Makefile | 6 ++++--
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/lib/sw_apps/zynqmp_pmufw/misc/Makefile b/lib/sw_apps/zynqmp_pmufw/misc/Makefile
index a773498512..4203e9c91d 100644
--- a/lib/sw_apps/zynqmp_pmufw/misc/Makefile
+++ b/lib/sw_apps/zynqmp_pmufw/misc/Makefile
@@ -2,6 +2,8 @@
 COMPILER := mb-gcc
 ARCHIVER := mb-gcc-ar
 ASSEMBLER := mb-as
+COMPILER_FLAGS := -O2 -c -mcpu=v9.2 -mlittle-endian -mxl-barrel-shift -mxl-pattern-compare -mxl-soft-mul
+EXTRA_COMPILER_FLAGS := -ffunction-sections -fdata-sections -Wall -Wextra -Os -flto -ffat-lto-objects
 DRIVER_LIB_VERSION = 1.0
 PROCESSOR = psu_pmu_0
 LIBRARIES = ${PROCESSOR}/lib/libxil.a
@@ -40,11 +42,11 @@ $(PROCESSOR)/lib/libxil.a: $(PROCESSOR)/lib/libxil_init.a
 
 %/make.include: $(if $(wildcard $(PROCESSOR)/lib/libxil_init.a),$(PROCESSOR)/lib/libxil.a,)
 	@echo "Running Make include in $(subst /make.include,,$@)"
-	$(MAKE) -C $(subst /make.include,,$@) -s include  "SHELL=$(SHELL)" "COMPILER=$(COMPILER)" "ARCHIVER=$(ARCHIVER)" "COMPILER_FLAGS=  -O2 -c -mcpu=v9.2 -mlittle-endian -mxl-barrel-shift -mxl-pattern-compare -mxl-soft-mul" "EXTRA_COMPILER_FLAGS=-ffunction-sections -fdata-sections -Wall -Wextra -Os -flto -ffat-lto-objects"
+	$(MAKE) -C $(subst /make.include,,$@) -s include  "SHELL=$(SHELL)" "COMPILER=$(COMPILER)" "ARCHIVER=$(ARCHIVER)" "COMPILER_FLAGS=$(COMPILER_FLAGS)" "EXTRA_COMPILER_FLAGS=$(EXTRA_COMPILER_FLAGS)"
 
 %/make.libs: include
 	@echo "Running Make libs in $(subst /make.libs,,$@)"
-	$(MAKE) -C $(subst /make.libs,,$@) -s libs  "SHELL=$(SHELL)" "COMPILER=$(COMPILER)" "ARCHIVER=$(ARCHIVER)" "COMPILER_FLAGS=  -O2 -c -mcpu=v9.2 -mlittle-endian -mxl-barrel-shift -mxl-pattern-compare -mxl-soft-mul" "EXTRA_COMPILER_FLAGS=-ffunction-sections -fdata-sections -Wall -Wextra -Os -flto -ffat-lto-objects"
+	$(MAKE) -C $(subst /make.libs,,$@) -s libs  "SHELL=$(SHELL)" "COMPILER=$(COMPILER)" "ARCHIVER=$(ARCHIVER)" "COMPILER_FLAGS=$(COMPILER_FLAGS)" "EXTRA_COMPILER_FLAGS=$(EXTRA_COMPILER_FLAGS)"
 
 %/make.clean:
 	$(MAKE) -C $(subst /make.clean,,$@) -s clean
 
-- 
2.17.1

