1# Copyright (C) 2010 The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#      http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14#
15
16# Check that we have a Cygwin-compatible make.
17#
18# For some reason, a lot of application developers on Windows
19# have another GNU Make installed in their path, that fails
20# miserably with our build scripts. If we can detect this use
21# case, early, we will be able to dump a human-readable error
22# message with some help to fix the issue.
23#
24
25.PHONY: all
26all:
27
28# Get the cygwin-specific path to the make executable
29# (e.g. /cygdrive/c/cygwin/usr/bin/make), then strip the
30# .exe suffix, if any.
31#
32CYGWIN_MAKE := $(shell cygpath --unix --absolute $(firstword $(MAKE)))
33CYGWIN_MAKE := $(CYGWIN_MAKE:%.exe=%)
34
35# Now try to find it on the file system, a non-cygwin compatible
36# GNU Make, even if launched from a Cygwin shell, will not
37#
38SELF_MAKE := $(strip $(wildcard $(CYGWIN_MAKE).exe))
39ifeq ($(SELF_MAKE),)
40    $(error Android NDK: $(firstword $(MAKE)) is not cygwin-compatible)
41endif
42
43# that's all
44