diff options
author | Ahmad Fatoum <a.fatoum@pengutronix.de> | 2019-12-09 15:11:13 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2019-12-11 09:26:43 +0100 |
commit | beec04590b85af55e9a5cc36ef575eead818a75f (patch) | |
tree | f68b2af21a8308836909481c729814f063b92045 | |
parent | 86d711f394f0449f4420819d7df000fd5f2f769b (diff) | |
download | barebox-beec04590b85af55e9a5cc36ef575eead818a75f.tar.gz barebox-beec04590b85af55e9a5cc36ef575eead818a75f.tar.xz |
ARM: i.MX: introduce imx_image_rule variable for code deduplication
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.
As the arguments are now going through an eval, any use of $ must be
escaped with another $ to become $$.
No functional change.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r-- | images/Makefile.imx | 34 |
1 files changed, 13 insertions, 21 deletions
diff --git a/images/Makefile.imx b/images/Makefile.imx index 53d4ac8202..2d00229f43 100644 --- a/images/Makefile.imx +++ b/images/Makefile.imx @@ -23,28 +23,20 @@ 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 +$(eval +$$(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) +$(call imx_image_rule,imximg) +$(call imx_image_rule,pimximg, -p $$($$(patsubst $$(obj)/%.pblb,PBL_MEMORY_SIZE_%,$$<))) +$(call imx_image_rule,psimximg, -p $$($$(patsubst $$(obj)/%.pblb,PBL_MEMORY_SIZE_%,$$<)) -s) +$(call imx_image_rule,simximg, -s) +$(call imx_image_rule,usimximg, -u -s) +$(call imx_image_rule,esimximg, -e -s) +$(call imx_image_rule,esimximg.dek, -e -s) .SECONDEXPANSION: $(obj)/%.img.dek: $(obj)/$$(FILE_$$(@F)) |