Message ID | 1454501114-4346-4-git-send-email-yamada.masahiro@socionext.com |
---|---|
State | Superseded |
Delegated to: | Tom Rini |
Headers | show |
Hello Masahiro, On Wed, 3 Feb 2016 21:05:12 +0900, Masahiro Yamada <yamada.masahiro@socionext.com> wrote: > These build commands are constant (mostly, just concatenating images, > or just copying). No need to use $(call if_changed,...) for them. I am a total kbuild ignorant, so I'm probably asking a stupid question, but hey. What are the exact semantics of $(call if_changed,)? I thought it meant "call the function if any of the dependencies has changed. If it does, then won't this patch make the corresponding action systematic, causing unneeded concatenations or copies? Amicalement,
Hello Albert, On Wed, 3 Feb 2016 13:18:35 +0100, Albert ARIBAUD <albert.u.boot@aribaud.net> wrote: > Hello Masahiro, > > On Wed, 3 Feb 2016 21:05:12 +0900, Masahiro Yamada > <yamada.masahiro@socionext.com> wrote: > > These build commands are constant (mostly, just concatenating images, > > or just copying). No need to use $(call if_changed,...) for them. > > I am a total kbuild ignorant, so I'm probably asking a stupid question, > but hey. > > What are the exact semantics of $(call if_changed,)? I thought it meant > "call the function if any of the dependencies has changed. If it does, > then won't this patch make the corresponding action systematic, causing > unneeded concatenations or copies? NVM, the answer could be found in later patches in the series. Amicalement,
On 02/03/2016 05:05 AM, Masahiro Yamada wrote: > These build commands are constant (mostly, just concatenating images, > or just copying). No need to use $(call if_changed,...) for them. I disagree, since I believe this change means that if someone /does/ change the command in the future (e.g. to replace it with more complex processing, or add additional dependencies), then the Makefile will/may not automatically rebuild those targets, which is the entire point of using if_changed, and is a huge benefit of using Kbuild. In my opinion, every rule should use if_changed, and contain a single command at the Makefile level; i.e. I noticed the following somewhere, which also doesn't rebuild the target in all cases if the commands are changed, which is bad: target: sources FORCE $(call if_changed,xxx) something_else yet_more_cmds If "something_else" or "yet_more_cmds" are edited, the target won't get rebuilt unless some other modification causes it to be.
Hi Stephen, 2016-02-04 0:57 GMT+09:00 Stephen Warren <swarren@wwwdotorg.org>: > On 02/03/2016 05:05 AM, Masahiro Yamada wrote: >> >> These build commands are constant (mostly, just concatenating images, >> or just copying). No need to use $(call if_changed,...) for them. > > > I disagree, since I believe this change means that if someone /does/ change > the command in the future (e.g. to replace it with more complex processing, > or add additional dependencies), then the Makefile will/may not > automatically rebuild those targets, which is the entire point of using > if_changed, and is a huge benefit of using Kbuild. I do not a strong opinion about this, so I will drop 3/5 and submit v2. > In my opinion, every rule should use if_changed, and contain a single > command at the Makefile level; i.e. I noticed the following somewhere, which > also doesn't rebuild the target in all cases if the commands are changed, > which is bad: > > target: sources FORCE > $(call if_changed,xxx) > something_else > yet_more_cmds > > If "something_else" or "yet_more_cmds" are edited, the target won't get > rebuilt unless some other modification causes it to be. Patch are welcome to clean up them.
On Fri, 2016-02-05 at 14:33 +0900, Masahiro Yamada wrote: > >> These build commands are constant (mostly, just concatenating > images, > >> or just copying). No need to use $(call if_changed,...) for them. > > > > > > I disagree, since I believe this change means that if someone /does/ change > > the command in the future (e.g. to replace it with more complex processing, > > or add additional dependencies), then the Makefile will/may not > > automatically rebuild those targets, which is the entire point of using > > if_changed, and is a huge benefit of using Kbuild. > > I do not a strong opinion about this, so > I will drop 3/5 and submit v2. I think the same logic applies to that part of the change in patch 2 as well. Ian.
diff --git a/Makefile b/Makefile index 430dd4f..aaa5b44 100644 --- a/Makefile +++ b/Makefile @@ -827,8 +827,8 @@ quiet_cmd_copy = COPY $@ cmd_copy = cp $< $@ ifeq ($(CONFIG_OF_SEPARATE),y) -u-boot-dtb.bin: u-boot-nodtb.bin dts/dt.dtb FORCE - $(call if_changed,cat) +u-boot-dtb.bin: u-boot-nodtb.bin dts/dt.dtb + $(call cmd,cat) u-boot.bin: u-boot-dtb.bin FORCE $(call if_changed,copy) @@ -847,8 +847,8 @@ OBJCOPYFLAGS_u-boot.hex := -O ihex OBJCOPYFLAGS_u-boot.srec := -O srec -u-boot.hex u-boot.srec: u-boot FORCE - $(call if_changed,objcopy) +u-boot.hex u-boot.srec: u-boot + $(call cmd,objcopy) OBJCOPYFLAGS_u-boot-nodtb.bin := -O binary \ $(if $(CONFIG_X86_RESET_VECTOR),-R .start16 -R .resetvec) @@ -881,8 +881,8 @@ OBJCOPYFLAGS_u-boot.ldr.hex := -I binary -O ihex OBJCOPYFLAGS_u-boot.ldr.srec := -I binary -O srec -u-boot.ldr.hex u-boot.ldr.srec: u-boot.ldr FORCE - $(call if_changed,objcopy) +u-boot.ldr.hex u-boot.ldr.srec: u-boot.ldr + $(call cmd,objcopy) # # U-Boot entry point, needed for booting of full-blown U-Boot @@ -954,7 +954,7 @@ lpc32xx-boot-1.bin: lpc32xx-spl.img $(call if_changed,objcopy) lpc32xx-full.bin: lpc32xx-boot-0.bin lpc32xx-boot-1.bin u-boot.img - $(call if_changed,cat) + $(call cmd,cat) CLEAN_FILES += lpc32xx-* @@ -1060,8 +1060,8 @@ u-boot.rom: u-boot-x86-16bit.bin u-boot.bin $(call if_changed,ifdtool) OBJCOPYFLAGS_u-boot-x86-16bit.bin := -O binary -j .start16 -j .resetvec -u-boot-x86-16bit.bin: u-boot FORCE - $(call if_changed,objcopy) +u-boot-x86-16bit.bin: u-boot + $(call cmd,objcopy) endif ifneq ($(CONFIG_SUNXI),) @@ -1080,8 +1080,8 @@ OBJCOPYFLAGS_u-boot-tegra.bin = -O binary --pad-to=$(CONFIG_SYS_TEXT_BASE) u-boot-tegra.bin: spl/u-boot-spl u-boot.bin FORCE $(call if_changed,pad_cat) -u-boot-dtb-tegra.bin: u-boot-tegra.bin FORCE - $(call if_changed,copy) +u-boot-dtb-tegra.bin: u-boot-tegra.bin + $(call cmd,copy) endif OBJCOPYFLAGS_u-boot-app.efi := $(OBJCOPYFLAGS_EFI) @@ -1108,8 +1108,8 @@ OBJCOPYFLAGS_u-boot-payload.efi := $(OBJCOPYFLAGS_EFI) u-boot-payload.efi: u-boot-payload FORCE $(call if_changed,zobjcopy) -u-boot-img.bin: spl/u-boot-spl.bin u-boot.img FORCE - $(call if_changed,cat) +u-boot-img.bin: spl/u-boot-spl.bin u-boot.img + $(call cmd,cat) #Add a target to create boot binary having SPL binary in PBI format #concatenated with u-boot binary. It is need by PowerPC SoC having diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl index d8b3947..2668ef3 100644 --- a/scripts/Makefile.spl +++ b/scripts/Makefile.spl @@ -167,8 +167,8 @@ quiet_cmd_copy = COPY $@ ifeq ($(CONFIG_SPL_OF_CONTROL),y) $(obj)/$(SPL_BIN)-dtb.bin: $(obj)/$(SPL_BIN)-nodtb.bin $(obj)/$(SPL_BIN)-pad.bin \ - $(obj)/$(SPL_BIN).dtb FORCE - $(call if_changed,cat) + $(obj)/$(SPL_BIN).dtb + $(call cmd,cat) $(obj)/$(SPL_BIN).bin: $(obj)/$(SPL_BIN)-dtb.bin FORCE $(call if_changed,copy)
These build commands are constant (mostly, just concatenating images, or just copying). No need to use $(call if_changed,...) for them. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> --- Makefile | 26 +++++++++++++------------- scripts/Makefile.spl | 4 ++-- 2 files changed, 15 insertions(+), 15 deletions(-)