#!/bin/sh

# Copyright 2016 The Fuchsia Authors
# Copyright (c) 2008 Travis Geiselbrecht
#
# Use of this source code is governed by a MIT-style
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/MIT

if [ "$#" -lt 1 ]; then
    echo "not enough arguments"
    echo "usage: $0 <project>"
    exit 1
fi

case `uname` in
Linux)
    N=`cat /proc/cpuinfo | grep processor | wc -l`
    JOBS=-j$N
    ;;
*)
    JOBS=-j4
    ;;
esac

PROJ=$1
PROJ_DIR=build-${PROJ}
TESTS="--enable=warning,style,performance,portability,information"

cppcheck --force --file-list=${PROJ_DIR}/srcfiles.txt --includes-file=${PROJ_DIR}/include_paths.txt --include=${PROJ_DIR}/config.h -q --platform=unix32 $TESTS $JOBS
