mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sam Ravnborg <sam@ravnborg.org>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 1/4] build: fix that defaultenv is always rebuilt
Date: Tue, 26 Dec 2017 19:35:30 +0100	[thread overview]
Message-ID: <20171226183530.GA28706@ravnborg.org> (raw)
In-Reply-To: <20171226183236.GA26708@ravnborg.org>

From fcffd0176b3394cc664d9bf5b31b053253323bfb Mon Sep 17 00:00:00 2001
From: Sam Ravnborg <sam@ravnborg.org>
Date: Tue, 26 Dec 2017 16:47:16 +0100
Subject: [PATCH 1/4] build: fix that defaultenv is always rebuilt

Using following pattern:

	target: prerequisite FORCE
		$(call cmd,foo)

is almost always wrong. Due to FORCE target will be rebuilt
using cmd_foo no mater the timestamps.

The following pattern:

	target: prerequisite FORCE
        	$(call if_changed,foo)

Will call cmd_foo only if:
- target is not updated
- or command to built target has changed

But to make this work target must be added to the
list af targets built.
This can be done by assigning target to extra-y or targets.

Use the latter pattern for defaultenv to avoid rebuilding
the environmentt for each build.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
 defaultenv/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/defaultenv/Makefile b/defaultenv/Makefile
index 33e0eceef..f313b04e8 100644
--- a/defaultenv/Makefile
+++ b/defaultenv/Makefile
@@ -14,7 +14,7 @@ quiet_cmd_env_default = ENV     $@
 cmd_env_default = ($(srctree)/scripts/genenv $(srctree) $(objtree) $@ $(CONFIG_DEFAULT_ENVIRONMENT_PATH))
 
 $(obj)/barebox_default_env: FORCE
-	$(call cmd,env_default)
+	$(call if_changed,env_default)
 
 quiet_cmd_env_h = ENVH    $@
 cmd_env_h = cat $< | (cd $(obj) && $(objtree)/scripts/bin2c "__aligned(4) default_environment") > $@; \
@@ -27,4 +27,4 @@ quiet_cmd_env_zero = ENVZ    $@
 cmd_env_zero = ($(objtree)/scripts/bareboxenv -z $(CONFIG_DEFAULT_ENVIRONMENT_PATH) $@)
 
 $(obj)/barebox_zero_env: FORCE
-	$(call cmd,env_zero)
+	$(call if_changed,env_zero)
-- 
2.12.0


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

  reply	other threads:[~2017-12-26 18:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-26 18:32 [PATCH 0/4] build: minimize rebuilds Sam Ravnborg
2017-12-26 18:35 ` Sam Ravnborg [this message]
2017-12-26 18:36 ` [PATCH 2/4] build: fix that passwd.h is always built Sam Ravnborg
2017-12-26 18:36 ` [PATCH 3/4] build: fix that the bbenv file is always rebuilt Sam Ravnborg
2017-12-26 18:36 ` [PATCH 4/4] build: fix that LZO " Sam Ravnborg
2018-01-05 10:49   ` Sascha Hauer
2018-01-05 14:57     ` Sascha Hauer
2018-01-06  7:34       ` Sam Ravnborg

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=20171226183530.GA28706@ravnborg.org \
    --to=sam@ravnborg.org \
    --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