| 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 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 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_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 ifeq ($(HOST_OS), linux) | 39 ifeq ($(HOST_OS), linux) |
| 39 TOOLCHAIN_DIR = linux-x86 | 40 TOOLCHAIN_DIR = linux-$(ANDROID_NDK_HOST_ARCH) |
| 40 else | 41 else |
| 41 ifeq ($(HOST_OS), mac) | 42 ifeq ($(HOST_OS), mac) |
| 42 TOOLCHAIN_DIR = darwin-x86 | 43 TOOLCHAIN_DIR = darwin-$(ANDROID_NDK_HOST_ARCH) |
| 43 else | 44 else |
| 44 $(error Host platform "${HOST_OS}" is not supported) | 45 $(error Host platform "${HOST_OS}" is not supported) |
| 45 endif | 46 endif |
| 46 endif | 47 endif |
| 47 | 48 |
| 48 ifeq ($(ARCH), android_arm) | 49 ifeq ($(ARCH), android_arm) |
| 49 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 |
| 50 DEFINES += arm_neon=0 armv7=1 | 51 DEFINES += arm_neon=0 armv7=1 |
| 51 TOOLCHAIN_ARCH = arm-linux-androideabi-4.6 | 52 TOOLCHAIN_ARCH = arm-linux-androideabi-4.6 |
| 52 else | 53 else |
| 53 ifeq ($(ARCH), android_mipsel) | 54 ifeq ($(ARCH), android_mipsel) |
| 54 DEFINES = target_arch=mipsel v8_target_arch=mipsel android_target_arch=mips | 55 DEFINES = target_arch=mipsel v8_target_arch=mipsel android_target_arch=mips |
| 55 DEFINES += mips_arch_variant=mips32r2 | 56 DEFINES += mips_arch_variant=mips32r2 |
| 56 TOOLCHAIN_ARCH = mipsel-linux-android-4.6 | 57 TOOLCHAIN_ARCH = mipsel-linux-android-4.6 |
| 57 else | 58 else |
| 58 ifeq ($(ARCH), android_ia32) | 59 ifeq ($(ARCH), android_ia32) |
| 59 DEFINES = target_arch=ia32 v8_target_arch=ia32 android_target_arch=x86 | 60 DEFINES = target_arch=ia32 v8_target_arch=ia32 android_target_arch=x86 |
| 60 TOOLCHAIN_ARCH = x86-4.6 | 61 TOOLCHAIN_ARCH = x86-4.6 |
| 61 else | 62 else |
| 62 $(error Target architecture "${ARCH}" is not supported) | 63 $(error Target architecture "${ARCH}" is not supported) |
| 63 endif | 64 endif |
| 64 endif | 65 endif |
| 65 endif | 66 endif |
| 66 | 67 |
| 67 TOOLCHAIN_PATH = ${ANDROID_NDK_ROOT}/toolchains/${TOOLCHAIN_ARCH}/prebuilt | 68 TOOLCHAIN_PATH = ${ANDROID_NDK_ROOT}/toolchains/${TOOLCHAIN_ARCH}/prebuilt |
| 68 ANDROID_TOOLCHAIN ?= ${TOOLCHAIN_PATH}/${TOOLCHAIN_DIR} | 69 ANDROID_TOOLCHAIN ?= ${TOOLCHAIN_PATH}/${TOOLCHAIN_DIR} |
| 69 ifeq ($(wildcard $(ANDROID_TOOLCHAIN)),) | 70 ifeq ($(wildcard $(ANDROID_TOOLCHAIN)),) |
| 70 $(error Cannot find Android toolchain in "${ANDROID_TOOLCHAIN}") | 71 $(error Cannot find Android toolchain in "${ANDROID_TOOLCHAIN}". Please \ |
| 72 check that ANDROID_NDK_ROOT and ANDROID_NDK_HOST_ARCH are set \ |
| 73 correctly) |
| 71 endif | 74 endif |
| 72 | 75 |
| 73 # For mksnapshot host generation. | 76 # For mksnapshot host generation. |
| 74 DEFINES += host_os=${HOST_OS} | 77 DEFINES += host_os=${HOST_OS} |
| 75 | 78 |
| 76 .SECONDEXPANSION: | 79 .SECONDEXPANSION: |
| 77 $(ANDROID_BUILDS): $(OUTDIR)/Makefile.$$(basename $$@) | 80 $(ANDROID_BUILDS): $(OUTDIR)/Makefile.$$(basename $$@) |
| 78 @$(MAKE) -C "$(OUTDIR)" -f Makefile.$(basename $@) \ | 81 @$(MAKE) -C "$(OUTDIR)" -f Makefile.$(basename $@) \ |
| 79 CXX="$(ANDROID_TOOLCHAIN)/bin/*-g++" \ | 82 CXX="$(ANDROID_TOOLCHAIN)/bin/*-g++" \ |
| 80 AR="$(ANDROID_TOOLCHAIN)/bin/*-ar" \ | 83 AR="$(ANDROID_TOOLCHAIN)/bin/*-ar" \ |
| 81 RANLIB="$(ANDROID_TOOLCHAIN)/bin/*-ranlib" \ | 84 RANLIB="$(ANDROID_TOOLCHAIN)/bin/*-ranlib" \ |
| 82 CC="$(ANDROID_TOOLCHAIN)/bin/*-gcc" \ | 85 CC="$(ANDROID_TOOLCHAIN)/bin/*-gcc" \ |
| 83 LD="$(ANDROID_TOOLCHAIN)/bin/*-ld" \ | 86 LD="$(ANDROID_TOOLCHAIN)/bin/*-ld" \ |
| 84 LINK="$(ANDROID_TOOLCHAIN)/bin/*-g++" \ | 87 LINK="$(ANDROID_TOOLCHAIN)/bin/*-g++" \ |
| 85 BUILDTYPE=$(shell echo $(subst .,,$(suffix $@)) | \ | 88 BUILDTYPE=$(shell echo $(subst .,,$(suffix $@)) | \ |
| 86 python -c "print raw_input().capitalize()") \ | 89 python -c "print raw_input().capitalize()") \ |
| 87 builddir="$(shell pwd)/$(OUTDIR)/$@" | 90 builddir="$(shell pwd)/$(OUTDIR)/$@" |
| 88 | 91 |
| 89 # Android GYP file generation targets. | 92 # Android GYP file generation targets. |
| 90 ANDROID_MAKEFILES = $(addprefix $(OUTDIR)/Makefile.,$(ANDROID_ARCHES)) | 93 ANDROID_MAKEFILES = $(addprefix $(OUTDIR)/Makefile.,$(ANDROID_ARCHES)) |
| 91 $(ANDROID_MAKEFILES): | 94 $(ANDROID_MAKEFILES): |
| 92 @GYP_GENERATORS=make-android \ | 95 @GYP_GENERATORS=make-android \ |
| 93 GYP_DEFINES="${DEFINES}" \ | 96 GYP_DEFINES="${DEFINES}" \ |
| 94 CC="${ANDROID_TOOLCHAIN}/bin/*-gcc" \ | 97 CC="${ANDROID_TOOLCHAIN}/bin/*-gcc" \ |
| 95 CXX="${ANDROID_TOOLCHAIN}/bin/*-g++" \ | 98 CXX="${ANDROID_TOOLCHAIN}/bin/*-g++" \ |
| 96 build/gyp/gyp --generator-output="${OUTDIR}" build/all.gyp \ | 99 build/gyp/gyp --generator-output="${OUTDIR}" build/all.gyp \ |
| 97 -Ibuild/standalone.gypi --depth=. -Ibuild/android.gypi \ | 100 -Ibuild/standalone.gypi --depth=. -Ibuild/android.gypi \ |
| 98 -S.${ARCH} ${GYPFLAGS} | 101 -S.${ARCH} ${GYPFLAGS} |
| OLD | NEW |