blob: c1700462b8e473afa5b3914bedc0ec101d5ff0a9 [file] [log] [blame]
#!/bin/sh
#
# Copyright (C) 2010 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# This shell script is a wrapper to launch the NDK build from the
# command-line inside an application project path.
#
# Typical usage is:
#
# cd $PROJECT_PATH
# ndk-build
#
# Assuming that the Android NDK root path is in your PATH. However,
# you can also invoke it directly as:
#
# $NDK_ROOT/ndk-build
#
# This really is a tiny wrapper around GNU Make.
#
# Ensure we get the full path of this script's directory
# this is needed if the caller uses the -C <path> GNU Make
# option, as in:
#
# cd ndk
# ./ndk-build -C <project-path>
#
PROGDIR=`dirname $0`
PROGDIR=`cd $PROGDIR && pwd`
# if GNUMAKE is not defined in the environment, use 'make'
if [ -z "$GNUMAKE" ] ; then
GNUMAKE=make
fi
# On Windows, when running under cygwin, check that we are
# invoking a cygwin-compatible GNU Make binary. It is unfortunately
# common for app developers to have another non-cygwin compatible
#
if [ "$OSTYPE" = "cygwin" ] ; then
PROGDIR_MIXED=`cygpath -m $PROGDIR`
GNUMAKE=`cygpath -u $GNUMAKE`
CYGWIN_GNUMAKE=`$GNUMAKE -f $PROGDIR_MIXED/build/core/check-cygwin-make.mk 2>&1`
if [ $? != 0 ] ; then
echo "ERROR: You are using a non-Cygwin compatible Make program."
echo "Currently using: `cygpath -m $GNUMAKE`"
echo ""
echo "To solve the issue, follow these steps:"
echo ""
echo "1. Ensure that the Cygwin 'make' package is installed."
echo " NOTE: You will need GNU Make 3.81 or later!"
echo ""
echo "2. Define the GNUMAKE environment variable to point to it, as in:"
echo ""
echo " export GNUMAKE=/usr/bin/make"
echo ""
echo "3. Call 'ndk-build' again."
echo ""
exit 1
fi
fi
$GNUMAKE -f $PROGDIR/build/core/build-local.mk $@