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