1#!/bin/bash
2# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#     http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15# ==============================================================================
16
17set -x
18set -e
19
20SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
21TENSORFLOW_DIR="${SCRIPT_DIR}/../../../.."
22
23FREE_MEM="$(free -m | awk '/^Mem/ {print $2}')"
24# Use "-j 4" only memory is larger than 2GB
25if [[ "FREE_MEM" -gt "2000" ]]; then
26  NO_JOB=4
27else
28  NO_JOB=1
29fi
30
31make -j ${NO_JOB} TARGET=rpi -C "${TENSORFLOW_DIR}" -f tensorflow/lite/tools/make/Makefile $@
32