diff mbox series

[4/4] package/freescale-imx/imx-gpu-viv: use make loops instead of shell loops

Message ID 20210805212736.2799576-4-thomas.petazzoni@bootlin.com
State Accepted
Headers show
Series [1/4] package/freescale-imx/imx-gpu-viv: move pkg-config files fixup to the build step | expand

Commit Message

Thomas Petazzoni Aug. 5, 2021, 9:27 p.m. UTC
We generally prefer using make loops instead of shell loops. They
bring automatic error handling, as they abort the loop when there is
an error, without the need for "|| exit 1".

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
 package/freescale-imx/imx-gpu-viv/imx-gpu-viv.mk | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Comments

Gary Bisson Aug. 20, 2021, 1:43 p.m. UTC | #1
Hi,

On Thu, Aug 05, 2021 at 11:27:35PM +0200, Thomas Petazzoni wrote:
> We generally prefer using make loops instead of shell loops. They
> bring automatic error handling, as they abort the loop when there is
> an error, without the need for "|| exit 1".
> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>

Same, not sure why shell loops were used in the first place.

Reviewed-by: Gary Bisson <gary.bisson@boundarydevices.com>

Regards,
Gary
diff mbox series

Patch

diff --git a/package/freescale-imx/imx-gpu-viv/imx-gpu-viv.mk b/package/freescale-imx/imx-gpu-viv/imx-gpu-viv.mk
index df39d3ddc2..fec19523a3 100644
--- a/package/freescale-imx/imx-gpu-viv/imx-gpu-viv.mk
+++ b/package/freescale-imx/imx-gpu-viv/imx-gpu-viv.mk
@@ -52,9 +52,9 @@  define IMX_GPU_VIV_FIXUP_PKGCONFIG
 endef
 else ifeq ($(IMX_GPU_VIV_LIB_TARGET),x11)
 define IMX_GPU_VIV_FIXUP_PKGCONFIG
-	for lib in egl gbm glesv1_cm glesv2 vg; do \
-		ln -sf $${lib}_x11.pc $(@D)/gpu-core/usr/lib/pkgconfig/$${lib}.pc || exit 1; \
-	done
+	$(foreach lib,egl gbm glesv1_cm glesv2 vg, \
+		ln -sf $(lib)_x11.pc $(@D)/gpu-core/usr/lib/pkgconfig/$(lib).pc
+	)
 endef
 endif
 
@@ -63,9 +63,9 @@  endif
 # Make sure these commands are idempotent.
 define IMX_GPU_VIV_BUILD_CMDS
 	cp -dpfr $(@D)/gpu-core/usr/lib/$(IMX_GPU_VIV_LIB_TARGET)/* $(@D)/gpu-core/usr/lib/
-	for backend in fb x11 wayland; do \
-		$(RM) -r $(@D)/gpu-core/usr/lib/$$backend ; \
-	done
+	$(foreach backend,fb x11 wayland, \
+		$(RM) -r $(@D)/gpu-core/usr/lib/$(backend)
+	)
 	$(IMX_GPU_VIV_FIXUP_PKGCONFIG)
 endef