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