blob: 417152177d73c270b1f6ebcabd9e5c7bcc696271 [file] [log] [blame]
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001# Copyright 2012 the V8 project authors. All rights reserved.
2# Redistribution and use in source and binary forms, with or without
3# modification, are permitted provided that the following conditions are
4# met:
5#
6# * Redistributions of source code must retain the above copyright
7# notice, this list of conditions and the following disclaimer.
8# * Redistributions in binary form must reproduce the above
9# copyright notice, this list of conditions and the following
10# disclaimer in the documentation and/or other materials provided
11# with the distribution.
12# * Neither the name of Google Inc. nor the names of its
13# contributors may be used to endorse or promote products derived
14# from this software without specific prior written permission.
15#
16# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
28# Those definitions should be consistent with the main Makefile
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000029ANDROID_ARCHES = android_ia32 android_x64 android_arm android_arm64 \
30 android_mipsel android_x87
Ben Murdochb8a8cc12014-11-26 15:28:44 +000031MODES = release debug
32
33# Generates all combinations of ANDROID ARCHES and MODES,
34# e.g. "android_ia32.release" or "android_arm.release"
35ANDROID_BUILDS = $(foreach mode,$(MODES), \
36 $(addsuffix .$(mode),$(ANDROID_ARCHES)))
37
Ben Murdochb8a8cc12014-11-26 15:28:44 +000038ifeq ($(ARCH), android_arm)
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000039 DEFINES = target_arch=arm v8_target_arch=arm
Emily Bernierd0a1eb72015-03-24 16:35:39 -040040else ifeq ($(ARCH), android_arm64)
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000041 DEFINES = target_arch=arm64 v8_target_arch=arm64
Emily Bernierd0a1eb72015-03-24 16:35:39 -040042else ifeq ($(ARCH), android_mipsel)
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000043 DEFINES = target_arch=mipsel v8_target_arch=mipsel
Emily Bernierd0a1eb72015-03-24 16:35:39 -040044else ifeq ($(ARCH), android_ia32)
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000045 DEFINES = target_arch=ia32 v8_target_arch=ia32
46else ifeq ($(ARCH), android_x64)
47 DEFINES = target_arch=x64 v8_target_arch=x64
Emily Bernierd0a1eb72015-03-24 16:35:39 -040048else ifeq ($(ARCH), android_x87)
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000049 DEFINES = target_arch=ia32 v8_target_arch=x87
Ben Murdochb8a8cc12014-11-26 15:28:44 +000050else
Emily Bernierd0a1eb72015-03-24 16:35:39 -040051 $(error Target architecture "${ARCH}" is not supported)
Ben Murdochb8a8cc12014-11-26 15:28:44 +000052endif
53
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000054# Common flags.
Ben Murdochb8a8cc12014-11-26 15:28:44 +000055DEFINES += OS=android
56
57.SECONDEXPANSION:
58$(ANDROID_BUILDS): $(OUTDIR)/Makefile.$$@
59 @$(MAKE) -C "$(OUTDIR)" -f Makefile.$@ \
Ben Murdochb8a8cc12014-11-26 15:28:44 +000060 BUILDTYPE=$(shell echo $(subst .,,$(suffix $@)) | \
61 python -c "print raw_input().capitalize()") \
62 builddir="$(shell pwd)/$(OUTDIR)/$@"
63
64# Android GYP file generation targets.
65ANDROID_MAKEFILES = $(addprefix $(OUTDIR)/Makefile.,$(ANDROID_BUILDS))
66$(ANDROID_MAKEFILES):
67 GYP_GENERATORS=make-android \
68 GYP_DEFINES="${DEFINES}" \
Ben Murdoch61f157c2016-09-16 13:49:30 +010069 PYTHONPATH="$(shell pwd)/tools/generate_shim_headers:$(shell pwd)/gypfiles:$(PYTHONPATH)" \
Ben Murdochc5610432016-08-08 18:44:38 +010070 tools/gyp/gyp --generator-output="${OUTDIR}" gypfiles/all.gyp \
71 -Igypfiles/standalone.gypi --depth=. \
Ben Murdochb8a8cc12014-11-26 15:28:44 +000072 -S$(suffix $(basename $@))$(suffix $@) ${GYPFLAGS}