Index: Makefile.nacl |
diff --git a/Makefile.android b/Makefile.nacl |
similarity index 52% |
copy from Makefile.android |
copy to Makefile.nacl |
index aeff01c665e1da1c9c6fc51daff0bb6c8f671bf6..e8fc3d252a96ed71af69b37b33f370bf0d841256 100644 |
--- a/Makefile.android |
+++ b/Makefile.nacl |
@@ -1,4 +1,5 @@ |
-# Copyright 2012 the V8 project authors. All rights reserved. |
+# |
+# Copyright 2013 the V8 project authors. All rights reserved. |
# Redistribution and use in source and binary forms, with or without |
# modification, are permitted provided that the following conditions are |
# met: |
@@ -26,73 +27,70 @@ |
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
# Those definitions should be consistent with the main Makefile |
-ANDROID_ARCHES = android_ia32 android_arm android_mipsel |
+NACL_ARCHES = nacl_ia32 nacl_x64 |
MODES = release debug |
-# Generates all combinations of ANDROID ARCHES and MODES, |
-# e.g. "android_ia32.release" or "android_arm.release" |
-ANDROID_BUILDS = $(foreach mode,$(MODES), \ |
- $(addsuffix .$(mode),$(ANDROID_ARCHES))) |
+# Generates all combinations of NACL ARCHES and MODES, |
+# e.g. "nacl_ia32.release" or "nacl_x64.release" |
+NACL_BUILDS = $(foreach mode,$(MODES), \ |
+ $(addsuffix .$(mode),$(NACL_ARCHES))) |
HOST_OS = $(shell uname -s | sed -e 's/Linux/linux/;s/Darwin/mac/') |
ifeq ($(HOST_OS), linux) |
- TOOLCHAIN_DIR = linux-x86 |
+ TOOLCHAIN_DIR = linux_x86_glibc |
else |
ifeq ($(HOST_OS), mac) |
- TOOLCHAIN_DIR = darwin-x86 |
+ TOOLCHAIN_DIR = mac_x86_glibc |
else |
$(error Host platform "${HOST_OS}" is not supported) |
endif |
endif |
-ifeq ($(ARCH), android_arm) |
- DEFINES = target_arch=arm v8_target_arch=arm android_target_arch=arm |
- DEFINES += arm_neon=0 armv7=1 |
- TOOLCHAIN_ARCH = arm-linux-androideabi-4.6 |
+TOOLCHAIN_PATH = ${NACL_SDK_ROOT}/toolchain |
+NACL_TOOLCHAIN ?= ${TOOLCHAIN_PATH}/${TOOLCHAIN_DIR} |
+ |
+ifeq ($(ARCH), nacl_ia32) |
+ GYPENV = nacl_target_arch=nacl_ia32 v8_target_arch=arm v8_host_arch=ia32 |
+ TOOLCHAIN_ARCH = x86-4.4 |
+ NACL_CC = "$(NACL_TOOLCHAIN)/bin/i686-nacl-gcc" |
+ NACL_CXX = "$(NACL_TOOLCHAIN)/bin/i686-nacl-g++" |
+ NACL_LINK = "$(NACL_TOOLCHAIN)/bin/i686-nacl-g++" |
else |
- ifeq ($(ARCH), android_mipsel) |
- DEFINES = target_arch=mipsel v8_target_arch=mipsel android_target_arch=mips |
- DEFINES += mips_arch_variant=mips32r2 |
- TOOLCHAIN_ARCH = mipsel-linux-android-4.6 |
+ ifeq ($(ARCH), nacl_x64) |
+ GYPENV = nacl_target_arch=nacl_x64 v8_target_arch=arm v8_host_arch=ia32 |
+ TOOLCHAIN_ARCH = x86-4.4 |
+ NACL_CC = "$(NACL_TOOLCHAIN)/bin/x86_64-nacl-gcc" |
+ NACL_CXX = "$(NACL_TOOLCHAIN)/bin/x86_64-nacl-g++" |
+ NACL_LINK = "$(NACL_TOOLCHAIN)/bin/x86_64-nacl-g++" |
else |
- ifeq ($(ARCH), android_ia32) |
- DEFINES = target_arch=ia32 v8_target_arch=ia32 android_target_arch=x86 |
- TOOLCHAIN_ARCH = x86-4.6 |
- else |
- $(error Target architecture "${ARCH}" is not supported) |
- endif |
+ $(error Target architecture "${ARCH}" is not supported) |
endif |
endif |
-TOOLCHAIN_PATH = ${ANDROID_NDK_ROOT}/toolchains/${TOOLCHAIN_ARCH}/prebuilt |
-ANDROID_TOOLCHAIN ?= ${TOOLCHAIN_PATH}/${TOOLCHAIN_DIR} |
-ifeq ($(wildcard $(ANDROID_TOOLCHAIN)),) |
- $(error Cannot find Android toolchain in "${ANDROID_TOOLCHAIN}") |
+ifeq ($(wildcard $(NACL_TOOLCHAIN)),) |
+ $(error Cannot find Native Client toolchain in "${NACL_TOOLCHAIN}") |
endif |
# For mksnapshot host generation. |
-DEFINES += host_os=${HOST_OS} |
+GYPENV += host_os=${HOST_OS} |
+NACL_MAKEFILES = $(addprefix $(OUTDIR)/Makefile.,$(NACL_ARCHES)) |
.SECONDEXPANSION: |
-$(ANDROID_BUILDS): $(OUTDIR)/Makefile.$$(basename $$@) |
+# For some reason the $$(basename $$@) expansion didn't work here... |
+$(NACL_BUILDS): $(NACL_MAKEFILES) |
@$(MAKE) -C "$(OUTDIR)" -f Makefile.$(basename $@) \ |
- CXX="$(ANDROID_TOOLCHAIN)/bin/*-g++" \ |
- AR="$(ANDROID_TOOLCHAIN)/bin/*-ar" \ |
- RANLIB="$(ANDROID_TOOLCHAIN)/bin/*-ranlib" \ |
- CC="$(ANDROID_TOOLCHAIN)/bin/*-gcc" \ |
- LD="$(ANDROID_TOOLCHAIN)/bin/*-ld" \ |
- LINK="$(ANDROID_TOOLCHAIN)/bin/*-g++" \ |
+ CXX=${NACL_CXX} \ |
+ LINK=${NACL_LINK} \ |
BUILDTYPE=$(shell echo $(subst .,,$(suffix $@)) | \ |
python -c "print raw_input().capitalize()") \ |
builddir="$(shell pwd)/$(OUTDIR)/$@" |
-# Android GYP file generation targets. |
-ANDROID_MAKEFILES = $(addprefix $(OUTDIR)/Makefile.,$(ANDROID_ARCHES)) |
-$(ANDROID_MAKEFILES): |
- @GYP_GENERATORS=make-android \ |
- GYP_DEFINES="${DEFINES}" \ |
- CC="${ANDROID_TOOLCHAIN}/bin/*-gcc" \ |
- CXX="${ANDROID_TOOLCHAIN}/bin/*-g++" \ |
+# NACL GYP file generation targets. |
+$(NACL_MAKEFILES): |
+ @GYP_GENERATORS=make \ |
+ GYP_DEFINES="${GYPENV}" \ |
+ CC=${NACL_CC} \ |
+ CXX=${NACL_CXX} \ |
build/gyp/gyp --generator-output="${OUTDIR}" build/all.gyp \ |
- -Ibuild/standalone.gypi --depth=. -Ibuild/android.gypi \ |
- -S.${ARCH} ${GYPFLAGS} |
+ -Ibuild/standalone.gypi --depth=. \ |
+ -S.$(subst .,,$(suffix $@)) $(GYPFLAGS) |