| OLD | NEW |
| 1 # Copyright 2012 the V8 project authors. All rights reserved. | 1 # Copyright 2012 the V8 project authors. All rights reserved. |
| 2 # Redistribution and use in source and binary forms, with or without | 2 # Redistribution and use in source and binary forms, with or without |
| 3 # modification, are permitted provided that the following conditions are | 3 # modification, are permitted provided that the following conditions are |
| 4 # met: | 4 # met: |
| 5 # | 5 # |
| 6 # * Redistributions of source code must retain the above copyright | 6 # * Redistributions of source code must retain the above copyright |
| 7 # notice, this list of conditions and the following disclaimer. | 7 # notice, this list of conditions and the following disclaimer. |
| 8 # * Redistributions in binary form must reproduce the above | 8 # * Redistributions in binary form must reproduce the above |
| 9 # copyright notice, this list of conditions and the following | 9 # copyright notice, this list of conditions and the following |
| 10 # disclaimer in the documentation and/or other materials provided | 10 # disclaimer in the documentation and/or other materials provided |
| 11 # with the distribution. | 11 # with the distribution. |
| 12 # * Neither the name of Google Inc. nor the names of its | 12 # * Neither the name of Google Inc. nor the names of its |
| 13 # contributors may be used to endorse or promote products derived | 13 # contributors may be used to endorse or promote products derived |
| 14 # from this software without specific prior written permission. | 14 # from this software without specific prior written permission. |
| 15 # | 15 # |
| 16 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 16 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 17 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 17 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 18 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 18 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 19 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 19 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 20 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 20 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 21 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 21 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 22 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 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. | 26 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 # Those definitions should be consistent with the main Makefile | 28 # Those definitions should be consistent with the main Makefile |
| 29 ANDROID_ARCHES = android_ia32 android_arm android_a64 android_mipsel | 29 ANDROID_ARCHES = android_ia32 android_arm android_mipsel |
| 30 MODES = release debug | 30 MODES = release debug |
| 31 | 31 |
| 32 # Generates all combinations of ANDROID ARCHES and MODES, | 32 # Generates all combinations of ANDROID ARCHES and MODES, |
| 33 # e.g. "android_ia32.release" or "android_arm.release" | 33 # e.g. "android_ia32.release" or "android_arm.release" |
| 34 ANDROID_BUILDS = $(foreach mode,$(MODES), \ | 34 ANDROID_BUILDS = $(foreach mode,$(MODES), \ |
| 35 $(addsuffix .$(mode),$(ANDROID_ARCHES))) | 35 $(addsuffix .$(mode),$(ANDROID_ARCHES))) |
| 36 | 36 |
| 37 HOST_OS = $(shell uname -s | sed -e 's/Linux/linux/;s/Darwin/mac/') | 37 HOST_OS = $(shell uname -s | sed -e 's/Linux/linux/;s/Darwin/mac/') |
| 38 ANDROID_NDK_HOST_ARCH ?= $(shell uname -m | sed -e 's/i[3456]86/x86/') | 38 ANDROID_NDK_HOST_ARCH ?= $(shell uname -m | sed -e 's/i[3456]86/x86/') |
| 39 ifeq ($(HOST_OS), linux) | 39 ifeq ($(HOST_OS), linux) |
| 40 TOOLCHAIN_DIR = linux-$(ANDROID_NDK_HOST_ARCH) | 40 TOOLCHAIN_DIR = linux-$(ANDROID_NDK_HOST_ARCH) |
| 41 else | 41 else |
| 42 ifeq ($(HOST_OS), mac) | 42 ifeq ($(HOST_OS), mac) |
| 43 TOOLCHAIN_DIR = darwin-$(ANDROID_NDK_HOST_ARCH) | 43 TOOLCHAIN_DIR = darwin-$(ANDROID_NDK_HOST_ARCH) |
| 44 else | 44 else |
| 45 $(error Host platform "${HOST_OS}" is not supported) | 45 $(error Host platform "${HOST_OS}" is not supported) |
| 46 endif | 46 endif |
| 47 endif | 47 endif |
| 48 | 48 |
| 49 ifeq ($(ARCH), android_arm) | 49 ifeq ($(ARCH), android_arm) |
| 50 DEFINES = target_arch=arm v8_target_arch=arm android_target_arch=arm | 50 DEFINES = target_arch=arm v8_target_arch=arm android_target_arch=arm |
| 51 DEFINES += arm_neon=0 arm_version=7 | 51 DEFINES += arm_neon=0 arm_version=7 |
| 52 TOOLCHAIN_ARCH = arm-linux-androideabi | 52 TOOLCHAIN_ARCH = arm-linux-androideabi-4.6 |
| 53 TOOLCHAIN_PREFIX = $(TOOLCHAIN_ARCH) | |
| 54 TOOLCHAIN_VER = 4.6 | |
| 55 else | 53 else |
| 56 ifeq ($(ARCH), android_a64) | 54 ifeq ($(ARCH), android_mipsel) |
| 57 DEFINES = target_arch=a64 v8_target_arch=a64 android_target_arch=arm64 | 55 DEFINES = target_arch=mipsel v8_target_arch=mipsel android_target_arch=mips |
| 58 TOOLCHAIN_ARCH = aarch64-linux-android | 56 DEFINES += mips_arch_variant=mips32r2 |
| 59 TOOLCHAIN_PREFIX = $(TOOLCHAIN_ARCH) | 57 TOOLCHAIN_ARCH = mipsel-linux-android-4.6 |
| 60 TOOLCHAIN_VER = 4.8 | |
| 61 else | 58 else |
| 62 ifeq ($(ARCH), android_mipsel) | 59 ifeq ($(ARCH), android_ia32) |
| 63 DEFINES = target_arch=mipsel v8_target_arch=mipsel | 60 DEFINES = target_arch=ia32 v8_target_arch=ia32 android_target_arch=x86 |
| 64 DEFINES += android_target_arch=mips mips_arch_variant=mips32r2 | 61 TOOLCHAIN_ARCH = x86-4.6 |
| 65 TOOLCHAIN_ARCH = mipsel-linux-android | |
| 66 TOOLCHAIN_PREFIX = $(TOOLCHAIN_ARCH) | |
| 67 TOOLCHAIN_VER = 4.6 | |
| 68 | |
| 69 else | 62 else |
| 70 ifeq ($(ARCH), android_ia32) | 63 $(error Target architecture "${ARCH}" is not supported) |
| 71 DEFINES = target_arch=ia32 v8_target_arch=ia32 android_target_arch=x86 | |
| 72 TOOLCHAIN_ARCH = x86 | |
| 73 TOOLCHAIN_PREFIX = i686-linux-android | |
| 74 TOOLCHAIN_VER = 4.6 | |
| 75 else | |
| 76 $(error Target architecture "${ARCH}" is not supported) | |
| 77 endif | |
| 78 endif | 64 endif |
| 79 endif | 65 endif |
| 80 endif | 66 endif |
| 81 | 67 |
| 82 TOOLCHAIN_PATH = \ | 68 TOOLCHAIN_PATH = ${ANDROID_NDK_ROOT}/toolchains/${TOOLCHAIN_ARCH}/prebuilt |
| 83 ${ANDROID_NDK_ROOT}/toolchains/${TOOLCHAIN_ARCH}-${TOOLCHAIN_VER}/prebuilt | |
| 84 ANDROID_TOOLCHAIN ?= ${TOOLCHAIN_PATH}/${TOOLCHAIN_DIR} | 69 ANDROID_TOOLCHAIN ?= ${TOOLCHAIN_PATH}/${TOOLCHAIN_DIR} |
| 85 | |
| 86 ifeq ($(wildcard $(ANDROID_TOOLCHAIN)),) | 70 ifeq ($(wildcard $(ANDROID_TOOLCHAIN)),) |
| 87 $(error Cannot find Android toolchain in "${ANDROID_TOOLCHAIN}". Please \ | 71 $(error Cannot find Android toolchain in "${ANDROID_TOOLCHAIN}". Please \ |
| 88 check that ANDROID_NDK_ROOT and ANDROID_NDK_HOST_ARCH are set \ | 72 check that ANDROID_NDK_ROOT and ANDROID_NDK_HOST_ARCH are set \ |
| 89 correctly) | 73 correctly) |
| 90 endif | 74 endif |
| 91 | 75 |
| 92 # For mksnapshot host generation. | 76 # For mksnapshot host generation. |
| 93 DEFINES += host_os=${HOST_OS} | 77 DEFINES += host_os=${HOST_OS} |
| 94 | 78 |
| 95 .SECONDEXPANSION: | 79 .SECONDEXPANSION: |
| 96 $(ANDROID_BUILDS): $(OUTDIR)/Makefile.$$@ | 80 $(ANDROID_BUILDS): $(OUTDIR)/Makefile.$$@ |
| 97 @$(MAKE) -C "$(OUTDIR)" -f Makefile.$@ \ | 81 @$(MAKE) -C "$(OUTDIR)" -f Makefile.$@ \ |
| 98 » CXX="$(ANDROID_TOOLCHAIN)/bin/${TOOLCHAIN_PREFIX}-g++" \ | 82 » CXX="$(ANDROID_TOOLCHAIN)/bin/*-g++" \ |
| 99 » AR="$(ANDROID_TOOLCHAIN)/bin/${TOOLCHAIN_PREFIX}-ar" \ | 83 » AR="$(ANDROID_TOOLCHAIN)/bin/*-ar" \ |
| 100 » RANLIB="$(ANDROID_TOOLCHAIN)/bin/${TOOLCHAIN_PREFIX}-ranlib" \ | 84 » RANLIB="$(ANDROID_TOOLCHAIN)/bin/*-ranlib" \ |
| 101 » CC="$(ANDROID_TOOLCHAIN)/bin/${TOOLCHAIN_PREFIX}-gcc" \ | 85 » CC="$(ANDROID_TOOLCHAIN)/bin/*-gcc" \ |
| 102 » LD="$(ANDROID_TOOLCHAIN)/bin/${TOOLCHAIN_PREFIX}-ld" \ | 86 » LD="$(ANDROID_TOOLCHAIN)/bin/*-ld" \ |
| 103 » LINK="$(ANDROID_TOOLCHAIN)/bin/${TOOLCHAIN_PREFIX}-g++" \ | 87 » LINK="$(ANDROID_TOOLCHAIN)/bin/*-g++" \ |
| 104 » BUILDTYPE=$(shell echo $(subst .,,$(suffix $@)) | \ | 88 » BUILDTYPE=$(shell echo $(subst .,,$(suffix $@)) | \ |
| 105 » python -c "print raw_input().capitalize()") \ | 89 » python -c "print raw_input().capitalize()") \ |
| 106 » builddir="$(shell pwd)/$(OUTDIR)/$@" | 90 » builddir="$(shell pwd)/$(OUTDIR)/$@" |
| 107 | 91 |
| 108 # Android GYP file generation targets. | 92 # Android GYP file generation targets. |
| 109 ANDROID_MAKEFILES = $(addprefix $(OUTDIR)/Makefile.,$(ANDROID_BUILDS)) | 93 ANDROID_MAKEFILES = $(addprefix $(OUTDIR)/Makefile.,$(ANDROID_BUILDS)) |
| 110 $(ANDROID_MAKEFILES): | 94 $(ANDROID_MAKEFILES): |
| 111 GYP_GENERATORS=make-android \ | 95 GYP_GENERATORS=make-android \ |
| 112 GYP_DEFINES="${DEFINES}" \ | 96 GYP_DEFINES="${DEFINES}" \ |
| 113 » CC="${ANDROID_TOOLCHAIN}/bin/${TOOLCHAIN_PREFIX}-gcc" \ | 97 » CC="${ANDROID_TOOLCHAIN}/bin/*-gcc" \ |
| 114 » CXX="${ANDROID_TOOLCHAIN}/bin/${TOOLCHAIN_PREFIX}-g++" \ | 98 » CXX="${ANDROID_TOOLCHAIN}/bin/*-g++" \ |
| 115 PYTHONPATH="$(shell pwd)/tools/generate_shim_headers:$(PYTHONPATH)" \ | 99 PYTHONPATH="$(shell pwd)/tools/generate_shim_headers:$(PYTHONPATH)" \ |
| 116 build/gyp/gyp --generator-output="${OUTDIR}" build/all.gyp \ | 100 build/gyp/gyp --generator-output="${OUTDIR}" build/all.gyp \ |
| 117 -Ibuild/standalone.gypi --depth=. -Ibuild/android.gypi \ | 101 -Ibuild/standalone.gypi --depth=. -Ibuild/android.gypi \ |
| 118 -S$(suffix $(basename $@))$(suffix $@) ${GYPFLAGS} | 102 -S$(suffix $(basename $@))$(suffix $@) ${GYPFLAGS} |
| OLD | NEW |