mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 2/3] ARM: i.MX: introduce imx_image_rule variable for code deduplication
Date: Wed,  4 Dec 2019 17:01:59 +0100	[thread overview]
Message-ID: <20191204160200.4920-2-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20191204160200.4920-1-a.fatoum@pengutronix.de>

The next patch will add the .imxcfg file as a rule prerequisite, so the
target is rebuilt if it changes. Instead of duplicating it in all rules,
factor out the common parts into a imx_image_rule variable.

No functional change.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 images/Makefile.imx | 32 +++++++++++---------------------
 1 file changed, 11 insertions(+), 21 deletions(-)

diff --git a/images/Makefile.imx b/images/Makefile.imx
index 53d4ac8202c5..078b6b9d6a93 100644
--- a/images/Makefile.imx
+++ b/images/Makefile.imx
@@ -23,28 +23,18 @@ endef
 # %.imximg - convert into i.MX image
 # ----------------------------------------------------------------
 
-$(obj)/%.imximg: $(obj)/% FORCE
-	$(call if_changed,imx_image,$(CFG_$(@F)),)
-
-$(obj)/%.pimximg: $(obj)/% FORCE
-	$(call if_changed,imx_image,$(CFG_$(patsubst %.pimximg,%.imximg,$(@F))),\
-	-p $($(patsubst $(obj)/%.pblb,PBL_MEMORY_SIZE_%,$<)))
-
-$(obj)/%.psimximg: $(obj)/% FORCE
-	$(call if_changed,imx_image,$(CFG_$(patsubst %.psimximg,%.imximg,$(@F))),\
-	-p $($(patsubst $(obj)/%.pblb,PBL_MEMORY_SIZE_%,$<)) -s)
-
-$(obj)/%.simximg: $(obj)/% FORCE
-	$(call if_changed,imx_image,$(CFG_$(patsubst %.simximg,%.imximg,$(@F))),-s)
-
-$(obj)/%.usimximg: $(obj)/% FORCE
-	$(call if_changed,imx_image,$(CFG_$(patsubst %.usimximg,%.imximg,$(@F))),-u -s)
-
-$(obj)/%.esimximg: $(obj)/% FORCE
-	$(call if_changed,imx_image,$(CFG_$(patsubst %.esimximg,%.imximg,$(@F))),-e -s)
+define imx_image_rule
+$$(obj)/%.$(strip $(1)): $$(obj)/% FORCE
+	$$(call if_changed,imx_image,$$(CFG_$$(patsubst %.$(strip $(1)),%.imximg,$$(@F))),$(strip $(2)))
+endef
 
-$(obj)/%.esimximg.dek: $(obj)/% FORCE
-	$(call if_changed,imx_image,$(CFG_$(patsubst %.esimximg,%.imximg,$(@F))),-e -s)
+$(eval $(call imx_image_rule,imximg))
+$(eval $(call imx_image_rule,pimximg, -p $($(patsubst $(obj)/%.pblb,PBL_MEMORY_SIZE_%,$<))))
+$(eval $(call imx_image_rule,psimximg, -p $($(patsubst $(obj)/%.pblb,PBL_MEMORY_SIZE_%,$<)) -s))
+$(eval $(call imx_image_rule,simximg, -s))
+$(eval $(call imx_image_rule,usimximg, -u -s))
+$(eval $(call imx_image_rule,esimximg, -e -s))
+$(eval $(call imx_image_rule,esimximg.dek, -e -s))
 
 .SECONDEXPANSION:
 $(obj)/%.img.dek: $(obj)/$$(FILE_$$(@F))
-- 
2.24.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2019-12-04 16:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-04 16:01 [PATCH 1/3] images: i.MX: rearrange image rules in preparation for boilerplate removal Ahmad Fatoum
2019-12-04 16:01 ` Ahmad Fatoum [this message]
2019-12-09 13:31   ` [PATCH 2/3] ARM: i.MX: introduce imx_image_rule variable for code deduplication Sascha Hauer
2019-12-09 13:32     ` Ahmad Fatoum
2019-12-04 16:02 ` [PATCH 3/3] ARM: i.MX: rebuild .imximg if DCD table in .imxcfg changes Ahmad Fatoum
2019-12-09  9:24 ` [PATCH 1/3] images: i.MX: rearrange image rules in preparation for boilerplate removal Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191204160200.4920-2-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox