| Left: | ||
| Right: |
| OLD | NEW |
|---|---|
| (Empty) | |
| 1 PATCH ?= patch | |
| 2 # Those definitions should be consistent with the main Makefile | |
| 3 ANDROID_ARCHES = android_ia32 android_arm android_mipsel | |
| 4 MODES = release debug | |
| 5 # Generates all combinations of ANDROID ARCHES and MODES, | |
| 6 # e.g. "android_ia32.release" or "android_arm.release" | |
| 7 ANDROID_BUILDS = $(foreach mode,$(MODES), \ | |
| 8 $(addsuffix .$(mode),$(ANDROID_ARCHES))) | |
| 9 | |
| 10 HOST_OS = $(shell uname -s | sed -e 's/Linux/linux/;s/Darwin/mac/') | |
| 11 ifeq ($(HOST_OS), linux) | |
| 12 TOOLCHAIN_DIR = linux-x86 | |
| 13 else | |
| 14 ifeq ($(HOST_OS), mac) | |
| 15 TOOLCHAIN_DIR = darwin-x86 | |
| 16 else | |
| 17 $(error Host platform "${HOST_OS}" is not supported) | |
| 18 endif | |
| 19 endif | |
| 20 | |
| 21 ifeq ($(ARCH), android_arm) | |
| 22 DEFINES = target_arch=arm v8_target_arch=arm android_target_arch=arm | |
|
Wladimir Palant
2013/05/07 08:18:54
Setting v8_target_arch explicitly shouldn't be nec
| |
| 23 DEFINES += arm_neon=0 armv7=1 | |
| 24 TOOLCHAIN_ARCH = arm-linux-androideabi-4.6 | |
| 25 else | |
| 26 ifeq ($(ARCH), android_mipsel) | |
| 27 DEFINES = target_arch=mipsel v8_target_arch=mipsel android_target_arch=mips | |
| 28 DEFINES += mips_arch_variant=mips32r2 | |
| 29 TOOLCHAIN_ARCH = mipsel-linux-android-4.6 | |
| 30 else | |
| 31 ifeq ($(ARCH), android_ia32) | |
| 32 DEFINES = target_arch=ia32 v8_target_arch=ia32 android_target_arch=x86 | |
| 33 TOOLCHAIN_ARCH = x86-4.6 | |
| 34 else | |
| 35 $(error Target architecture "${ARCH}" is not supported) | |
| 36 endif | |
| 37 endif | |
| 38 endif | |
| 39 | |
| 40 TOOLCHAIN_PATH = ${ANDROID_NDK_ROOT}/toolchains/${TOOLCHAIN_ARCH}/prebuilt | |
| 41 ANDROID_TOOLCHAIN ?= ${TOOLCHAIN_PATH}/${TOOLCHAIN_DIR} | |
| 42 ifeq ($(wildcard $(ANDROID_TOOLCHAIN)),) | |
| 43 $(error Cannot find Android toolchain in "${ANDROID_TOOLCHAIN}") | |
| 44 endif | |
| 45 | |
| 46 DEFINES += host_os=${HOST_OS} OS=android | |
| 47 | |
| 48 .PHONY: v8 | |
| 49 | |
| 50 must-set-ANDROID_NDK_ROOT_OR_TOOLCHAIN: | |
| 51 ifndef ANDROID_NDK_ROOT | |
| 52 ifndef ANDROID_TOOLCHAIN | |
| 53 $(error ANDROID_NDK_ROOT or ANDROID_TOOLCHAIN must be set)) | |
| 54 endif | |
| 55 endif | |
| 56 | |
| 57 v8: | |
| 58 $(PATCH) -d third_party/v8 < patches/V8.patch | |
|
Andrey Novikov
2013/04/30 20:16:05
I do not like this approach because it is not erro
Wladimir Palant
2013/05/07 08:18:54
I don't like that approach either. You don't need
| |
| 59 OUTDIR=../../build $(MAKE) -C third_party/v8 vfp3=off armv7=false $(ARCH ).$(MODE) | |
| 60 $(PATCH) -d third_party/v8 -R < patches/V8.patch | |
| 61 | |
| 62 $(ANDROID_BUILDS): must-set-ANDROID_NDK_ROOT_OR_TOOLCHAIN v8 | |
| 63 @GYP_GENERATORS=make-android \ | |
| 64 GYP_DEFINES="${DEFINES}" \ | |
| 65 CC="$(ANDROID_TOOLCHAIN)/bin/*-gcc" \ | |
| 66 CXX="$(ANDROID_TOOLCHAIN)/bin/*-g++" \ | |
| 67 third_party/gyp/gyp --depth=. -I common.gypi -I third_party/v8/build/sta ndalone.gypi --generator-output=build -Dtarget_arch=$(ARCH) libadblockplus.gyp | |
|
Wladimir Palant
2013/05/07 08:18:54
Why do we need to include standalone.gypi? We don'
| |
| 68 $(MAKE) V=1 -C build \ | |
| 69 CXX="$(ANDROID_TOOLCHAIN)/bin/*-g++" \ | |
| 70 AR="$(ANDROID_TOOLCHAIN)/bin/*-ar" \ | |
| 71 RANLIB="$(ANDROID_TOOLCHAIN)/bin/*-ranlib" \ | |
| 72 CC="$(ANDROID_TOOLCHAIN)/bin/*-gcc" \ | |
| 73 LD="$(ANDROID_TOOLCHAIN)/bin/*-ld" \ | |
| 74 LINK="$(ANDROID_TOOLCHAIN)/bin/*-g++" \ | |
| 75 BUILDTYPE=$(shell echo $(subst .,,$(suffix $@)) | \ | |
| 76 python -c "print raw_input().capitalize()") | |
| OLD | NEW |