diff mbox series

mach-imx: do not use if_changed more than once per target

Message ID 20240828153637.1818625-1-jerome.forissier@linaro.org
State Accepted
Commit aec0015a52d3faf723fec9ed9fe1d1af0b89e996
Headers show
Series mach-imx: do not use if_changed more than once per target | expand

Commit Message

Jerome Forissier Aug. 28, 2024, 3:36 p.m. UTC
doc/develop/makefiles.rst has the following note:

  if_changed should not be used more than once per target.
  It stores the executed command in a corresponding .cmd
  file and multiple calls would result in overwrites and
  unwanted results when the target is up to date and only the
  tests on changed commands trigger execution of commands.

The mach-imx Makefile does not follow this recommandation, so fix it
by implementing a single command that performs both the cpp_cfg
and imx9_check actions.

This change fixes an issue with "tools/buildman/buildman imx8ulp_evk"
failing every other time [1].

[1] https://lists.denx.de/pipermail/u-boot/2024-August/563192.html

Fixes: f637dfe8c468 ("mach-imx: Add i.MX93 binman support.")
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
---
 arch/arm/mach-imx/Makefile | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

Comments

Fabio Estevam Aug. 29, 2024, 12:52 p.m. UTC | #1
Hi Jerome,

On Wed, Aug 28, 2024 at 12:37 PM Jerome Forissier
<jerome.forissier@linaro.org> wrote:
>
> doc/develop/makefiles.rst has the following note:
>
>   if_changed should not be used more than once per target.
>   It stores the executed command in a corresponding .cmd
>   file and multiple calls would result in overwrites and
>   unwanted results when the target is up to date and only the
>   tests on changed commands trigger execution of commands.
>
> The mach-imx Makefile does not follow this recommandation, so fix it
> by implementing a single command that performs both the cpp_cfg
> and imx9_check actions.
>
> This change fixes an issue with "tools/buildman/buildman imx8ulp_evk"
> failing every other time [1].
>
> [1] https://lists.denx.de/pipermail/u-boot/2024-August/563192.html
>
> Fixes: f637dfe8c468 ("mach-imx: Add i.MX93 binman support.")
> Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>

Thanks for the fix.

Applied to u-boot-imx/master, thanks.
diff mbox series

Patch

diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile
index b311d176d6..5262dca4ff 100644
--- a/arch/arm/mach-imx/Makefile
+++ b/arch/arm/mach-imx/Makefile
@@ -217,8 +217,8 @@  endif
 
 ifeq ($(CONFIG_ARCH_IMX9)$(CONFIG_ARCH_IMX8ULP), y)
 
-quiet_cmd_imx9_check = CHECK    $@
-cmd_imx9_check = $(srctree)/tools/imx9_image.sh $@
+quiet_cmd_cpp_cfg_imx9_check = CHECK    $@
+cmd_cpp_cfg_imx9_check = $(CPP) $(cpp_flags) -D__ASSEMBLY__ -x c -o $@ $< && $(srctree)/tools/imx9_image.sh $@
 
 SPL: spl/u-boot-spl.bin spl/u-boot-spl.cfgout u-boot-container.cfgout FORCE
 
@@ -227,15 +227,13 @@  flash.bin: MKIMAGEOUTPUT = flash.log
 
 spl/u-boot-spl.cfgout: $(IMX_CONFIG) FORCE
 	$(Q)mkdir -p $(dir $@)
-	$(call if_changed_dep,cpp_cfg)
-	$(call if_changed,imx9_check)
+	$(call if_changed_dep,cpp_cfg_imx9_check)
 
 spl/u-boot-spl-ddr.bin: spl/u-boot-spl.bin spl/u-boot-spl.cfgout FORCE
 
 u-boot-container.cfgout: $(IMX_CONTAINER_CFG) FORCE
 	$(Q)mkdir -p $(dir $@)
-	$(call if_changed_dep,cpp_cfg)
-	$(call if_changed,imx9_check)
+	$(call if_changed_dep,cpp_cfg_imx9_check)
 
 flash.bin: spl/u-boot-spl-ddr.bin container.cfgout FORCE
 	$(call if_changed,mkimage)