1#!/bin/bash 2 3# Quit if any command produces an error. 4set -e 5 6# Check required paths 7: ${ANDROID_BUILD_TOP:?"ERROR: Please run build/envsetup.sh and lunch first"} 8 9BUILD_ONLY="false" 10while getopts "b" opt; do 11 case ${opt} in 12 b) 13 BUILD_ONLY="true" 14 ;; 15 esac 16done 17 18# Build and run the CHRE simulator. 19CHRE_HOST_OS=`uname` 20if [[ $CHRE_HOST_OS == 'Darwin' ]]; then 21JOB_COUNT=`sysctl -n hw.ncpu` 22else 23JOB_COUNT=$((`grep -c ^processor /proc/cpuinfo`)) 24fi 25 26# Export the variant Makefile. 27export CHRE_VARIANT_MK_INCLUDES=variant/simulator/variant.mk 28 29make clean && make google_x86_linux_debug -j$JOB_COUNT 30 31if [ "$BUILD_ONLY" = "false" ]; then 32./out/google_x86_linux_debug/libchre ${@:1} 33else 34 if [ ! -f ./out/google_x86_linux_debug/libchre ]; then 35 echo "./out/google_x86_linux_debug/libchre does not exist." 36 exit 1 37 fi 38fi 39