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 18 matching lines...) Expand all Loading... |
29 ANDROID_ARCHES = android_ia32 android_x64 android_arm android_arm64 \ | 29 ANDROID_ARCHES = android_ia32 android_x64 android_arm android_arm64 \ |
30 android_mipsel android_x87 | 30 android_mipsel android_x87 |
31 MODES = release debug | 31 MODES = release debug |
32 | 32 |
33 # Generates all combinations of ANDROID ARCHES and MODES, | 33 # Generates all combinations of ANDROID ARCHES and MODES, |
34 # e.g. "android_ia32.release" or "android_arm.release" | 34 # e.g. "android_ia32.release" or "android_arm.release" |
35 ANDROID_BUILDS = $(foreach mode,$(MODES), \ | 35 ANDROID_BUILDS = $(foreach mode,$(MODES), \ |
36 $(addsuffix .$(mode),$(ANDROID_ARCHES))) | 36 $(addsuffix .$(mode),$(ANDROID_ARCHES))) |
37 | 37 |
38 HOST_OS = $(shell uname -s | sed -e 's/Linux/linux/;s/Darwin/mac/') | 38 HOST_OS = $(shell uname -s | sed -e 's/Linux/linux/;s/Darwin/mac/') |
39 ANDROID_NDK_HOST_ARCH ?= $(shell uname -m | sed -e 's/i[3456]86/x86/') | |
40 ifeq ($(HOST_OS), linux) | |
41 TOOLCHAIN_DIR = linux-$(ANDROID_NDK_HOST_ARCH) | |
42 else ifeq ($(HOST_OS), mac) | |
43 TOOLCHAIN_DIR = darwin-$(ANDROID_NDK_HOST_ARCH) | |
44 else | |
45 $(error Host platform "${HOST_OS}" is not supported) | |
46 endif | |
47 | 39 |
48 ifeq ($(ARCH), android_arm) | 40 ifeq ($(ARCH), android_arm) |
49 DEFINES = OS=android target_arch=arm v8_target_arch=arm android_target_arch=a
rm android_target_platform=21 | 41 DEFINES = target_arch=arm v8_target_arch=arm android_target_arch=arm |
50 DEFINES += arm_neon=0 arm_version=7 | 42 DEFINES += arm_neon=0 arm_version=7 |
51 TOOLCHAIN_ARCH = arm-linux-androideabi | |
52 TOOLCHAIN_PREFIX = $(TOOLCHAIN_ARCH) | |
53 else ifeq ($(ARCH), android_arm64) | 43 else ifeq ($(ARCH), android_arm64) |
54 DEFINES = OS=android target_arch=arm64 v8_target_arch=arm64 android_target_ar
ch=arm64 android_target_platform=21 | 44 DEFINES = target_arch=arm64 v8_target_arch=arm64 android_target_arch=arm64 |
55 TOOLCHAIN_ARCH = aarch64-linux-android | |
56 TOOLCHAIN_PREFIX = $(TOOLCHAIN_ARCH) | |
57 else ifeq ($(ARCH), android_mipsel) | 45 else ifeq ($(ARCH), android_mipsel) |
58 DEFINES = OS=android target_arch=mipsel v8_target_arch=mipsel android_target_
platform=21 | 46 DEFINES = target_arch=mipsel v8_target_arch=mipsel |
59 DEFINES += android_target_arch=mips mips_arch_variant=mips32r2 | 47 DEFINES += android_target_arch=mips mips_arch_variant=mips32r2 |
60 TOOLCHAIN_ARCH = mipsel-linux-android | |
61 TOOLCHAIN_PREFIX = $(TOOLCHAIN_ARCH) | |
62 else ifeq ($(ARCH), android_ia32) | 48 else ifeq ($(ARCH), android_ia32) |
63 DEFINES = OS=android target_arch=ia32 v8_target_arch=ia32 android_target_arch=
x86 android_target_platform=21 | 49 DEFINES = target_arch=ia32 v8_target_arch=ia32 android_target_arch=x86 |
64 TOOLCHAIN_ARCH = x86 | |
65 TOOLCHAIN_PREFIX = i686-linux-android | |
66 else ifeq ($(ARCH), android_x64) | 50 else ifeq ($(ARCH), android_x64) |
67 DEFINES = OS=android target_arch=x64 v8_target_arch=x64 android_target_arch=x8
6_64 android_target_platform=21 | 51 DEFINES = target_arch=x64 v8_target_arch=x64 android_target_arch=x86_64 |
68 TOOLCHAIN_ARCH = x86_64 | |
69 TOOLCHAIN_PREFIX = x86_64-linux-android | |
70 else ifeq ($(ARCH), android_x87) | 52 else ifeq ($(ARCH), android_x87) |
71 DEFINES = OS=android target_arch=x87 v8_target_arch=x87 android_target_arch=x8
6 android_target_platform=21 | 53 DEFINES = target_arch=x87 v8_target_arch=x87 android_target_arch=x86 |
72 TOOLCHAIN_ARCH = x86 | |
73 TOOLCHAIN_PREFIX = i686-linux-android | |
74 else | 54 else |
75 $(error Target architecture "${ARCH}" is not supported) | 55 $(error Target architecture "${ARCH}" is not supported) |
76 endif | 56 endif |
77 | 57 |
78 TOOLCHAIN_PATH = \ | 58 # Common flags. |
79 ${ANDROID_NDK_ROOT}/toolchains/${TOOLCHAIN_ARCH}-4.9/prebuilt | 59 DEFINES += host_os=${HOST_OS} OS=android android_target_platform=21 |
80 ANDROID_TOOLCHAIN ?= ${TOOLCHAIN_PATH}/${TOOLCHAIN_DIR} | |
81 | |
82 ifeq ($(wildcard $(ANDROID_TOOLCHAIN)),) | |
83 $(error Cannot find Android toolchain in "${ANDROID_TOOLCHAIN}". Please \ | |
84 check that ANDROID_NDK_ROOT and ANDROID_NDK_HOST_ARCH are set \ | |
85 correctly) | |
86 endif | |
87 | |
88 # For mksnapshot host generation. | |
89 DEFINES += host_os=${HOST_OS} | |
90 DEFINES += OS=android | |
91 | 60 |
92 .SECONDEXPANSION: | 61 .SECONDEXPANSION: |
93 $(ANDROID_BUILDS): $(OUTDIR)/Makefile.$$@ | 62 $(ANDROID_BUILDS): $(OUTDIR)/Makefile.$$@ |
94 @$(MAKE) -C "$(OUTDIR)" -f Makefile.$@ \ | 63 @$(MAKE) -C "$(OUTDIR)" -f Makefile.$@ \ |
95 CXX="$(ANDROID_TOOLCHAIN)/bin/${TOOLCHAIN_PREFIX}-g++" \ | |
96 AR="$(ANDROID_TOOLCHAIN)/bin/${TOOLCHAIN_PREFIX}-ar" \ | |
97 RANLIB="$(ANDROID_TOOLCHAIN)/bin/${TOOLCHAIN_PREFIX}-ranlib" \ | |
98 CC="$(ANDROID_TOOLCHAIN)/bin/${TOOLCHAIN_PREFIX}-gcc" \ | |
99 LD="$(ANDROID_TOOLCHAIN)/bin/${TOOLCHAIN_PREFIX}-ld" \ | |
100 LINK="$(ANDROID_TOOLCHAIN)/bin/${TOOLCHAIN_PREFIX}-g++" \ | |
101 BUILDTYPE=$(shell echo $(subst .,,$(suffix $@)) | \ | 64 BUILDTYPE=$(shell echo $(subst .,,$(suffix $@)) | \ |
102 python -c "print raw_input().capitalize()") \ | 65 python -c "print raw_input().capitalize()") \ |
103 builddir="$(shell pwd)/$(OUTDIR)/$@" | 66 builddir="$(shell pwd)/$(OUTDIR)/$@" |
104 | 67 |
105 # Android GYP file generation targets. | 68 # Android GYP file generation targets. |
106 ANDROID_MAKEFILES = $(addprefix $(OUTDIR)/Makefile.,$(ANDROID_BUILDS)) | 69 ANDROID_MAKEFILES = $(addprefix $(OUTDIR)/Makefile.,$(ANDROID_BUILDS)) |
107 $(ANDROID_MAKEFILES): | 70 $(ANDROID_MAKEFILES): |
108 GYP_GENERATORS=make-android \ | 71 GYP_GENERATORS=make-android \ |
109 GYP_DEFINES="${DEFINES}" \ | 72 GYP_DEFINES="${DEFINES}" \ |
110 CC="${ANDROID_TOOLCHAIN}/bin/${TOOLCHAIN_PREFIX}-gcc" \ | |
111 CXX="${ANDROID_TOOLCHAIN}/bin/${TOOLCHAIN_PREFIX}-g++" \ | |
112 PYTHONPATH="$(shell pwd)/tools/generate_shim_headers:$(shell pwd)/build:
$(PYTHONPATH)" \ | 73 PYTHONPATH="$(shell pwd)/tools/generate_shim_headers:$(shell pwd)/build:
$(PYTHONPATH)" \ |
113 build/gyp/gyp --generator-output="${OUTDIR}" build/all.gyp \ | 74 build/gyp/gyp --generator-output="${OUTDIR}" build/all.gyp \ |
114 -Ibuild/standalone.gypi --depth=. \ | 75 -Ibuild/standalone.gypi --depth=. \ |
115 -S$(suffix $(basename $@))$(suffix $@) ${GYPFLAGS} | 76 -S$(suffix $(basename $@))$(suffix $@) ${GYPFLAGS} |
OLD | NEW |