build: Add mka/brunch/breakfast aliases

- bacon target is move to its own Makefile

Change-Id: I06d70a56c6946d7a23c6df81769aa20e7500f953
diff --git a/build/envsetup.sh b/build/envsetup.sh
index d424a68..5afd8c1 100644
--- a/build/envsetup.sh
+++ b/build/envsetup.sh
@@ -1,4 +1,14 @@
 # bliss functions that extend build/envsetup.sh
+function __print_bliss_functions_help() {
+cat <<EOF
+Additional BlissRoms functions:
+- breakfast:       Setup the build environment, but only list
+                   devices we support.
+- brunch:          Sets up build environment using breakfast(),
+                   and then comiles using mka() against bacon target.
+- mka:             Builds using SCHED_BATCH on all processors.
+EOF
+}
 
 function bliss_device_combos()
 {
@@ -185,8 +195,57 @@
     done |column
 }
 
-bliss_append_hmm "blissremote" "Add a git remote for matching BlissRoms repository"
-bliss_append_hmm "losremote" "Add a git remote for matching LineageOS repository"
-bliss_append_hmm "aospremote" "Add git remote for matching AOSP repository"
-bliss_append_hmm "cafremote" "Add git remote for matching CodeAurora repository."
+function brunch()
+{
+    breakfast $*
+    if [ $? -eq 0 ]; then
+        time mka bacon
+    else
+        echo "No such item in brunch menu. Try 'breakfast'"
+        return 1
+    fi
+    return $?
+}
 
+function breakfast()
+{
+    target=$1
+    BLISS_DEVICES_ONLY="true"
+    unset LUNCH_MENU_CHOICES
+    add_lunch_combo full-eng
+    for f in `/bin/ls device/*/*/vendorsetup.sh 2> /dev/null`
+        do
+            echo "including $f"
+            . $f
+        done
+    unset f
+
+    if [ $# -eq 0 ]; then
+        # No arguments, so let's have the full menu
+        lunch
+    else
+        echo "z$target" | grep -q "-"
+        if [ $? -eq 0 ]; then
+            # A buildtype was specified, assume a full device name
+            lunch $target
+        else
+            # This is probably just the bliss model name
+            lunch bliss_$target-userdebug
+        fi
+    fi
+    return $?
+}
+
+alias bib=breakfast
+
+# Make using all available CPUs
+function mka() {
+    case `uname -s` in
+        Darwin)
+            make -j `sysctl hw.ncpu|cut -d" " -f2` "$@"
+            ;;
+        *)
+            schedtool -B -n 1 -e ionice -n 1 make -j `cat /proc/cpuinfo | grep "^processor" | wc -l` "$@"
+            ;;
+    esac
+}