Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 1 | # 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 Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 29 | ANDROID_ARCHES = android_ia32 android_x64 android_arm android_arm64 \ |
| 30 | android_mipsel android_x87 |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 31 | MODES = release debug |
| 32 | |
| 33 | # Generates all combinations of ANDROID ARCHES and MODES, |
| 34 | # e.g. "android_ia32.release" or "android_arm.release" |
| 35 | ANDROID_BUILDS = $(foreach mode,$(MODES), \ |
| 36 | $(addsuffix .$(mode),$(ANDROID_ARCHES))) |
| 37 | |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 38 | ifeq ($(ARCH), android_arm) |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 39 | DEFINES = target_arch=arm v8_target_arch=arm |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 40 | else ifeq ($(ARCH), android_arm64) |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 41 | DEFINES = target_arch=arm64 v8_target_arch=arm64 |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 42 | else ifeq ($(ARCH), android_mipsel) |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 43 | DEFINES = target_arch=mipsel v8_target_arch=mipsel |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 44 | else ifeq ($(ARCH), android_ia32) |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 45 | DEFINES = target_arch=ia32 v8_target_arch=ia32 |
| 46 | else ifeq ($(ARCH), android_x64) |
| 47 | DEFINES = target_arch=x64 v8_target_arch=x64 |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 48 | else ifeq ($(ARCH), android_x87) |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 49 | DEFINES = target_arch=ia32 v8_target_arch=x87 |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 50 | else |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 51 | $(error Target architecture "${ARCH}" is not supported) |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 52 | endif |
| 53 | |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 54 | # Common flags. |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 55 | DEFINES += OS=android |
| 56 | |
| 57 | .SECONDEXPANSION: |
| 58 | $(ANDROID_BUILDS): $(OUTDIR)/Makefile.$$@ |
| 59 | @$(MAKE) -C "$(OUTDIR)" -f Makefile.$@ \ |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 60 | BUILDTYPE=$(shell echo $(subst .,,$(suffix $@)) | \ |
| 61 | python -c "print raw_input().capitalize()") \ |
| 62 | builddir="$(shell pwd)/$(OUTDIR)/$@" |
| 63 | |
| 64 | # Android GYP file generation targets. |
| 65 | ANDROID_MAKEFILES = $(addprefix $(OUTDIR)/Makefile.,$(ANDROID_BUILDS)) |
| 66 | $(ANDROID_MAKEFILES): |
| 67 | GYP_GENERATORS=make-android \ |
| 68 | GYP_DEFINES="${DEFINES}" \ |
Ben Murdoch | 61f157c | 2016-09-16 13:49:30 +0100 | [diff] [blame] | 69 | PYTHONPATH="$(shell pwd)/tools/generate_shim_headers:$(shell pwd)/gypfiles:$(PYTHONPATH)" \ |
Ben Murdoch | c561043 | 2016-08-08 18:44:38 +0100 | [diff] [blame] | 70 | tools/gyp/gyp --generator-output="${OUTDIR}" gypfiles/all.gyp \ |
| 71 | -Igypfiles/standalone.gypi --depth=. \ |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 72 | -S$(suffix $(basename $@))$(suffix $@) ${GYPFLAGS} |