diff options
author | Ed Heyl <edheyl@google.com> | 2014-06-18 14:55:58 -0700 |
---|---|---|
committer | Dan Albert <danalbert@google.com> | 2014-08-09 17:33:05 -0700 |
commit | 9e7b9b996e5affd62bcd48e9afb5e18ae2cdf9a1 (patch) | |
tree | 74dfb2c0fd0855e5e02c93760996c667f589f7c5 /envsetup.sh | |
parent | 68715d0104b202d2cbdd281ded861c5c35fca700 (diff) | |
download | replicant_build-9e7b9b996e5affd62bcd48e9afb5e18ae2cdf9a1.zip replicant_build-9e7b9b996e5affd62bcd48e9afb5e18ae2cdf9a1.tar.gz replicant_build-9e7b9b996e5affd62bcd48e9afb5e18ae2cdf9a1.tar.bz2 |
wrap make and print success/failure message, more later
Change-Id: I48a4687d81bc4b950a1be42b34d2f0d76733574a
(cherry picked from commit cc6be0a369ece60818edbd2f604b5a929496b3f5)
Diffstat (limited to 'envsetup.sh')
-rw-r--r-- | envsetup.sh | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/envsetup.sh b/envsetup.sh index 5c66a9e..2cd342c 100644 --- a/envsetup.sh +++ b/envsetup.sh @@ -1,3 +1,4 @@ +MAKE_UTIL=(`which make`) function hmm() { cat <<EOF Invoke ". build/envsetup.sh" from your shell to add the following functions to your environment: @@ -35,7 +36,7 @@ function get_abs_build_var() return fi (\cd $T; CALLED_FROM_SETUP=true BUILD_SYSTEM=build/core \ - make --no-print-directory -f build/core/config.mk dumpvar-abs-$1) + $MAKE_UTIL --no-print-directory -f build/core/config.mk dumpvar-abs-$1) } # Get the exact value of a build variable. @@ -47,7 +48,7 @@ function get_build_var() return fi (\cd $T; CALLED_FROM_SETUP=true BUILD_SYSTEM=build/core \ - make --no-print-directory -f build/core/config.mk dumpvar-$1) + $MAKE_UTIL --no-print-directory -f build/core/config.mk dumpvar-$1) } # check to see if the supplied product is one we can build @@ -1445,6 +1446,36 @@ function pez { return $retval } +function make() +{ + local start_time=$(date +"%s") + $MAKE_UTIL $@ + local ret=$? + local end_time=$(date +"%s") + local tdiff=$(($end_time-$start_time)) + local hours=$(($tdiff / 3600 )) + local mins=$((($tdiff % 3600) / 60)) + local secs=$(($tdiff % 60)) + echo + if [ $ret -eq 0 ] ; then + echo -n -e "\e[0;32m#### make completed successfully " + else + echo -n -e "\e[0;31m#### make failed to build some targets " + fi + if [ $hours -gt 0 ] ; then + printf "(%02g:%02g:%02g (hh:mm:ss))" $hours $mins $secs + elif [ $mins -gt 0 ] ; then + printf "(%02g:%02g (mm:ss))" $mins $secs + elif [ $secs -gt 0 ] ; then + printf "(%s seconds)" $secs + fi + echo -e " ####\e[00m" + echo + return $ret +} + + + if [ "x$SHELL" != "x/bin/bash" ]; then case `ps -o command -p $$` in *bash*) |