From 0293f7489686b9838185a38f2eb0125a9a95f5e0 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Wed, 20 Feb 2019 09:45:32 +0100 Subject: defaultenv: Fix dependencies The defaultenv should be rebuilt once a file in it has changed. the genenv script always generates the environment file to a temporary file. Only if it has changed to the last target file the temporary file is moved over the target file. This means we always have to call genenv, thus replace "if_changed" with "cmd". With this dependencies are correctly tracked. New or changed files result in new image builds whereas unchanged environments do not unnecessarily result in new images. Signed-off-by: Sascha Hauer --- defaultenv/Makefile | 4 +++- scripts/Makefile.lib | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/defaultenv/Makefile b/defaultenv/Makefile index f313b04e84..950ac29a3c 100644 --- a/defaultenv/Makefile +++ b/defaultenv/Makefile @@ -13,8 +13,10 @@ $(obj)/defaultenv.o: $(obj)/barebox_default_env.h quiet_cmd_env_default = ENV $@ cmd_env_default = ($(srctree)/scripts/genenv $(srctree) $(objtree) $@ $(CONFIG_DEFAULT_ENVIRONMENT_PATH)) +# genenv is always called, but only generates output when the file actually +# changes, so that the dependent targets are not unnecessarily rebuilt $(obj)/barebox_default_env: FORCE - $(call if_changed,env_default) + $(call cmd,env_default) quiet_cmd_env_h = ENVH $@ cmd_env_h = cat $< | (cd $(obj) && $(objtree)/scripts/bin2c "__aligned(4) default_environment") > $@; \ diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 7b8643bf57..f5dcec4dcb 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -324,8 +324,10 @@ $(obj)/%.bbenv$(DEFAULT_COMPRESSION_SUFFIX).S: $(src)/%.bbenv$(DEFAULT_COMPRESSI quiet_cmd_env = ENV $@ cmd_env=$(srctree)/scripts/genenv $(srctree) $(objtree) $@ $< +# genenv is always called, but only generates output when the file actually +# changes, so that the dependent targets are not unnecessarily rebuilt %.bbenv$(DEFAULT_COMPRESSION_SUFFIX): % FORCE - $(call if_changed,env) + $(call cmd,env) # Bzip2 # --------------------------------------------------------------------------- -- cgit v1.2.3