summaryrefslogtreecommitdiffstats
path: root/scripts/genenv
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2012-09-27 10:29:48 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2012-09-28 16:21:44 +0200
commitc8c49c14aef009a86f238c4bdaf78b1d01b7bdcf (patch)
treeb582446b8139c8b1e94373e272443a0f5420f6cc /scripts/genenv
parent1bc0a261885396671cb28ff01f2e56f0d0e4cbde (diff)
downloadbarebox-c8c49c14aef009a86f238c4bdaf78b1d01b7bdcf.tar.gz
barebox-c8c49c14aef009a86f238c4bdaf78b1d01b7bdcf.tar.xz
environment generation: Fix dependencies
The dependencies for generating the environment do not work properly: - If files are removed from the defaultenv, a subsequent make will not update the default environment. - If CONFIG_DEFAULT_ENVIRONMENT_PATH changes, the default environment also will not be regenerated. This patch fixes this by introducing a cmd_env which has the content of $(ENV_FILES) in the command so that the if_changed mechanism recognizes a change when $(ENV_FILE) changes. This also results in a nice " ENV " string in the build process. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'scripts/genenv')
-rwxr-xr-xscripts/genenv17
1 files changed, 11 insertions, 6 deletions
diff --git a/scripts/genenv b/scripts/genenv
index c84af0c015..834ea594dd 100755
--- a/scripts/genenv
+++ b/scripts/genenv
@@ -1,22 +1,27 @@
#!/bin/bash
# Generate the default environment file from a list of directories
-# usage: genenv <basedir> <objdir> <dir>...
+# usage: genenv <basedir> <objdir> <target> <dir>...
# where <basedir> is the base directory for relative pathes in <dir>
# where <objdir> is the base directory for relative pathes for result
+# and <target> is the resulting binary environment
objtree=$2
-cd $1 || exit 1
-shift 2
+basedir=$1
+target=$3
+shift 3
-tempdir=$(mktemp -d tmp.XXXXXX)
+tempdir="$objtree/.barebox_default_env"
+mkdir -p "$tempdir"
+
+(cd $basedir
for i in $*; do
cp -r $i/* $tempdir
done
+)
find $tempdir -name '.svn' -o -name '*~' | xargs --no-run-if-empty rm -r
-$objtree/scripts/bareboxenv -s $tempdir $objtree/barebox_default_env
+$objtree/scripts/bareboxenv -s $tempdir $target
rm -r $tempdir
-