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
new file mode 100644
index 0000000..7b341c9
--- /dev/null
+++ b/build/envsetup.sh
@@ -0,0 +1,65 @@
+function __print_omni_functions_help() {
+cat <<EOF
+Additional OmniROM 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 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
+ CUSTOM_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 omni model name
+ lunch omni_$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
+}