Patchwork [U-Boot,2/4] ARM: tegra: combine duplicate Makefile rules

login
register
mail settings
Submitter Stephen Warren
Date Oct. 16, 2012, 9:50 p.m.
Message ID <1350424209-11186-2-git-send-email-swarren@wwwdotorg.org>
Download mbox | patch
Permalink /patch/191899/
State Accepted
Delegated to: Tom Warren
Headers show

Comments

Stephen Warren - Oct. 16, 2012, 9:50 p.m.
From: Stephen Warren <swarren@nvidia.com>

The rules to generate u-boot-{no,}dtb-tegra.bin were almost identical.
Combine them into a single paremeterized rule. This will allow the next
patch to edit a single rule, rather than being cut/paste twice.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
 Makefile |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)
Simon Glass - Oct. 18, 2012, 12:01 a.m.
Hi Stephen,

On Tue, Oct 16, 2012 at 2:50 PM, Stephen Warren <swarren@wwwdotorg.org> wrote:
> From: Stephen Warren <swarren@nvidia.com>
>
> The rules to generate u-boot-{no,}dtb-tegra.bin were almost identical.
> Combine them into a single paremeterized rule. This will allow the next
> patch to edit a single rule, rather than being cut/paste twice.
>
> Signed-off-by: Stephen Warren <swarren@nvidia.com>

Acked-by: Simon Glass <sjg@chromium.org>

> ---
>  Makefile |   15 ++++++++-------
>  1 files changed, 8 insertions(+), 7 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index ab34fa7..425adf4 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -514,17 +514,18 @@ $(obj)u-boot.spr: $(obj)u-boot.img $(obj)spl/u-boot-spl.bin
>
>  ifeq ($(SOC),tegra20)
>  ifeq ($(CONFIG_OF_SEPARATE),y)
> -$(obj)u-boot-dtb-tegra.bin:    $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin $(obj)u-boot.dtb
> -               $(OBJCOPY) ${OBJCFLAGS} --pad-to=$(CONFIG_SYS_TEXT_BASE) -O binary $(obj)spl/u-boot-spl $(obj)spl/u-boot-spl-pad.bin
> -               cat $(obj)spl/u-boot-spl-pad.bin $(obj)u-boot.bin $(obj)u-boot.dtb > $@
> -               rm $(obj)spl/u-boot-spl-pad.bin
> +nodtb=dtb
> +dtbfile=$(obj)u-boot.dtb
>  else
> -$(obj)u-boot-nodtb-tegra.bin:  $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
> +nodtb=nodtb
> +dtbfile=

You could omit this line if you like.

> +endif
> +
> +$(obj)u-boot-$(nodtb)-tegra.bin: $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin $(dtbfile)

If you like, you could have a continuation on this line as it is a bit long.

>                 $(OBJCOPY) ${OBJCFLAGS} --pad-to=$(CONFIG_SYS_TEXT_BASE) -O binary $(obj)spl/u-boot-spl $(obj)spl/u-boot-spl-pad.bin
> -               cat $(obj)spl/u-boot-spl-pad.bin $(obj)u-boot.bin > $@
> +               cat $(obj)spl/u-boot-spl-pad.bin $(obj)u-boot.bin $(dtbfile) > $@
>                 rm $(obj)spl/u-boot-spl-pad.bin
>  endif
> -endif
>
>  ifeq ($(CONFIG_SANDBOX),y)
>  GEN_UBOOT = \
> --
> 1.7.0.4
>

Regards,
Simon

Patch

diff --git a/Makefile b/Makefile
index ab34fa7..425adf4 100644
--- a/Makefile
+++ b/Makefile
@@ -514,17 +514,18 @@  $(obj)u-boot.spr:	$(obj)u-boot.img $(obj)spl/u-boot-spl.bin
 
 ifeq ($(SOC),tegra20)
 ifeq ($(CONFIG_OF_SEPARATE),y)
-$(obj)u-boot-dtb-tegra.bin:	$(obj)spl/u-boot-spl.bin $(obj)u-boot.bin $(obj)u-boot.dtb
-		$(OBJCOPY) ${OBJCFLAGS} --pad-to=$(CONFIG_SYS_TEXT_BASE) -O binary $(obj)spl/u-boot-spl $(obj)spl/u-boot-spl-pad.bin
-		cat $(obj)spl/u-boot-spl-pad.bin $(obj)u-boot.bin $(obj)u-boot.dtb > $@
-		rm $(obj)spl/u-boot-spl-pad.bin
+nodtb=dtb
+dtbfile=$(obj)u-boot.dtb
 else
-$(obj)u-boot-nodtb-tegra.bin:	$(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
+nodtb=nodtb
+dtbfile=
+endif
+
+$(obj)u-boot-$(nodtb)-tegra.bin: $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin $(dtbfile)
 		$(OBJCOPY) ${OBJCFLAGS} --pad-to=$(CONFIG_SYS_TEXT_BASE) -O binary $(obj)spl/u-boot-spl $(obj)spl/u-boot-spl-pad.bin
-		cat $(obj)spl/u-boot-spl-pad.bin $(obj)u-boot.bin > $@
+		cat $(obj)spl/u-boot-spl-pad.bin $(obj)u-boot.bin $(dtbfile) > $@
 		rm $(obj)spl/u-boot-spl-pad.bin
 endif
-endif
 
 ifeq ($(CONFIG_SANDBOX),y)
 GEN_UBOOT = \