defaultenv: simplify env dependencies
Finding out whether to rebuild the environment is a difficult task since we have to track all files in a directory. Instead of trying this, just rebuild the environment during every build and only if it differs to the last one overwrite the target. This way make only sees a change when the environment is changed. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
72230bad19
commit
658af1caf3
|
@ -65,23 +65,16 @@ ifneq ($(CONFIG_DEFAULT_ENVIRONMENT_PATH),"")
|
||||||
DEFAULT_ENVIRONMENT_PATH += $(CONFIG_DEFAULT_ENVIRONMENT_PATH)
|
DEFAULT_ENVIRONMENT_PATH += $(CONFIG_DEFAULT_ENVIRONMENT_PATH)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ENV_FILES := $(shell cd $(srctree); for i in $(DEFAULT_ENVIRONMENT_PATH); do find $${i} -type f ; done)
|
|
||||||
|
|
||||||
endif # ifdef CONFIG_DEFAULT_ENVIRONMENT
|
endif # ifdef CONFIG_DEFAULT_ENVIRONMENT
|
||||||
|
|
||||||
#
|
#
|
||||||
# Generate a barebox envfs image.
|
# Generate a barebox envfs image.
|
||||||
#
|
#
|
||||||
# echo $(ENV_FILES) > /dev/null is just for letting if_changed
|
quiet_cmd_envs = ENV $@
|
||||||
# recognize that something has changed when the environment has
|
cmd_envs = ($(srctree)/scripts/genenv $(srctree) $(objtree) $@ $(DEFAULT_ENVIRONMENT_PATH))
|
||||||
# other files,
|
|
||||||
#
|
|
||||||
quiet_cmd_env = ENV $@
|
|
||||||
cmd_env = ($(srctree)/scripts/genenv $(srctree) $(objtree) $@ $(DEFAULT_ENVIRONMENT_PATH)) || \
|
|
||||||
(echo $(ENV_FILES) > /dev/null; rm -f $@ ; false)
|
|
||||||
|
|
||||||
$(obj)/barebox_default_env: $(ENV_FILES) FORCE
|
$(obj)/barebox_default_env: FORCE
|
||||||
$(call if_changed,env)
|
$(call cmd,envs)
|
||||||
|
|
||||||
barebox_default_env_comp =
|
barebox_default_env_comp =
|
||||||
ifeq ($(CONFIG_DEFAULT_ENVIRONMENT_COMPRESSED_GZIP),y)
|
ifeq ($(CONFIG_DEFAULT_ENVIRONMENT_COMPRESSED_GZIP),y)
|
||||||
|
|
|
@ -10,7 +10,8 @@ basedir=$1
|
||||||
target=$3
|
target=$3
|
||||||
shift 3
|
shift 3
|
||||||
|
|
||||||
tempdir="$objtree/.barebox_default_env"
|
tempdir="${target}.genenv.tmp"
|
||||||
|
tmpfile="$(mktemp)"
|
||||||
|
|
||||||
mkdir -p "$tempdir"
|
mkdir -p "$tempdir"
|
||||||
|
|
||||||
|
@ -26,6 +27,13 @@ done
|
||||||
|
|
||||||
find $tempdir -name '.svn' -o -name '*~' -delete
|
find $tempdir -name '.svn' -o -name '*~' -delete
|
||||||
|
|
||||||
$objtree/scripts/bareboxenv -s $tempdir $target
|
$objtree/scripts/bareboxenv -s $tempdir ${tmpfile}
|
||||||
|
|
||||||
|
diff "${tmpfile}" "${target}" >/dev/null 2>/dev/null
|
||||||
|
if [ $? != 0 ]; then
|
||||||
|
mv "${tmpfile}" "${target}"
|
||||||
|
else
|
||||||
|
rm ${tmpfile}
|
||||||
|
fi
|
||||||
|
|
||||||
rm -r $tempdir
|
rm -r $tempdir
|
||||||
|
|
Loading…
Reference in New Issue