| OLD | NEW |
| 1 HOST_ARCH :=$(shell python third_party/detect_v8_host_arch.py) | 1 HOST_ARCH :=$(shell python third_party/detect_v8_host_arch.py) |
| 2 | 2 |
| 3 ifndef HOST_OS | 3 ifndef HOST_OS |
| 4 raw_OS = $(shell uname -s) | 4 raw_OS = $(shell uname -s) |
| 5 ifeq (${raw_OS},Linux) | 5 ifeq (${raw_OS},Linux) |
| 6 HOST_OS=linux | 6 HOST_OS=linux |
| 7 TRAVIS_OS_NAME=linux | 7 TRAVIS_OS_NAME=linux |
| 8 else ifeq (${raw_OS},Darwin) | 8 else ifeq (${raw_OS},Darwin) |
| 9 HOST_OS=mac | 9 HOST_OS=mac |
| 10 TRAVIS_OS_NAME=osx | 10 TRAVIS_OS_NAME=osx |
| 11 endif | 11 endif |
| 12 endif | 12 endif |
| 13 | 13 |
| 14 TARGET_OS ?= ${HOST_OS} | 14 TARGET_OS ?= ${HOST_OS} |
| 15 TARGET_ARCH ?= ${HOST_ARCH} | 15 ABP_TARGET_ARCH ?= ${HOST_ARCH} |
| 16 Configuration ?= debug | 16 Configuration ?= debug |
| 17 | 17 |
| 18 # Default V8 directories | 18 # Default V8 directories |
| 19 LIBV8_INCLUDE_DIR ?= $(shell pwd -L)/third_party/prebuilt-v8/include | 19 LIBV8_INCLUDE_DIR ?= $(shell pwd -L)/third_party/prebuilt-v8/include |
| 20 LIBV8_LIB_DIR ?= $(shell pwd -L)/third_party/prebuilt-v8/${TARGET_OS}-${TARGET_A
RCH}-${Configuration} | 20 LIBV8_LIB_DIR ?= $(shell pwd -L)/third_party/prebuilt-v8/${TARGET_OS}-${ABP_TARG
ET_ARCH}-${Configuration} |
| 21 | 21 |
| 22 BUILD_DIR ?=$(shell pwd -L)/build | 22 BUILD_DIR ?=$(shell pwd -L)/build |
| 23 | 23 |
| 24 ifeq (${TARGET_OS},android) | 24 ifeq (${TARGET_OS},android) |
| 25 Configuration ?= release | 25 Configuration ?= release |
| 26 ANDROID_PLATFORM_LEVEL=android-16 | 26 ANDROID_PLATFORM_LEVEL=android-16 |
| 27 ANDROID_FIXES= | 27 ANDROID_FIXES= |
| 28 ifeq ($(TARGET_ARCH),arm) | 28 ifeq ($(ABP_TARGET_ARCH),arm) |
| 29 ANDROID_ABI = armeabi-v7a | 29 ANDROID_ABI = armeabi-v7a |
| 30 ANDROID_FIXES="LOCAL_LDFLAGS=\"-Wl,--allow-multiple-definition\"" | 30 ANDROID_FIXES="LOCAL_LDFLAGS=\"-Wl,--allow-multiple-definition\"" |
| 31 else ifeq ($(TARGET_ARCH),ia32) | 31 else ifeq ($(ABP_TARGET_ARCH),ia32) |
| 32 ANDROID_ABI = x86 | 32 ANDROID_ABI = x86 |
| 33 else ifeq ($(TARGET_ARCH),arm64) | 33 else ifeq ($(ABP_TARGET_ARCH),arm64) |
| 34 ANDROID_ABI = arm64-v8a | 34 ANDROID_ABI = arm64-v8a |
| 35 # minimal platform having arch-arm64, see ndk/platforms | 35 # minimal platform having arch-arm64, see ndk/platforms |
| 36 ANDROID_PLATFORM_LEVEL=android-21 | 36 ANDROID_PLATFORM_LEVEL=android-21 |
| 37 else | 37 else |
| 38 $(error "Unsupported Android architecture: $(TARGET_ARCH)") | 38 $(error "Unsupported Android architecture: $(ABP_TARGET_ARCH)") |
| 39 endif | 39 endif |
| 40 endif | 40 endif |
| 41 | 41 |
| 42 # linux,osx | 42 # linux,osx |
| 43 # x64, ia32 | 43 # x64, ia32 |
| 44 # debug, release | 44 # debug, release |
| 45 # android | 45 # android |
| 46 # arm, arm64, ia32 | 46 # arm, arm64, ia32 |
| 47 # release | 47 # release |
| 48 | 48 |
| 49 GYP_PARAMETERS=host_arch=${HOST_ARCH} OS=${TARGET_OS} target_arch=${TARGET_ARCH} | 49 GYP_PARAMETERS=host_arch=${HOST_ARCH} OS=${TARGET_OS} target_arch=${ABP_TARGET_A
RCH} |
| 50 ifneq "$(and ${LIBV8_LIB_DIR}, ${LIBV8_INCLUDE_DIR})" "" | 50 ifneq "$(and ${LIBV8_LIB_DIR}, ${LIBV8_INCLUDE_DIR})" "" |
| 51 GYP_PARAMETERS+= libv8_lib_dir=${LIBV8_LIB_DIR} libv8_include_dir=${LIBV8_INCLUD
E_DIR} | 51 GYP_PARAMETERS+= libv8_lib_dir=${LIBV8_LIB_DIR} libv8_include_dir=${LIBV8_INCLUD
E_DIR} |
| 52 else | 52 else |
| 53 $(error "V8 directories are not specified") | 53 $(error "V8 directories are not specified") |
| 54 endif | 54 endif |
| 55 | 55 |
| 56 TEST_EXECUTABLE = ${BUILD_DIR}/out/Debug/tests | 56 TEST_EXECUTABLE = ${BUILD_DIR}/out/Debug/tests |
| 57 | 57 |
| 58 .PHONY: all test clean docs ensure_dependencies | 58 .PHONY: all test clean docs ensure_dependencies |
| 59 | 59 |
| 60 .DEFAULT_GOAL:=all | 60 .DEFAULT_GOAL:=all |
| 61 | 61 |
| 62 ensure_dependencies: | 62 ensure_dependencies: |
| 63 python ensure_dependencies.py | 63 python ensure_dependencies.py |
| 64 | 64 |
| 65 test: all | 65 test: all |
| 66 ifdef FILTER | 66 ifdef FILTER |
| 67 $(TEST_EXECUTABLE) --gtest_filter=$(FILTER) | 67 $(TEST_EXECUTABLE) --gtest_filter=$(FILTER) |
| 68 else | 68 else |
| 69 $(TEST_EXECUTABLE) | 69 $(TEST_EXECUTABLE) |
| 70 endif | 70 endif |
| 71 | 71 |
| 72 docs: | 72 docs: |
| 73 doxygen | 73 doxygen |
| 74 | 74 |
| 75 get-prebuilt-v8: | 75 get-prebuilt-v8: |
| 76 URL_PREFIX="https://v8.eyeofiles.com/v8-4fc9a2fe7f8a7ef1e7966185b39b3b54
1792669a/" \ | 76 URL_PREFIX="https://v8.eyeofiles.com/v8-4fc9a2fe7f8a7ef1e7966185b39b3b54
1792669a/" \ |
| 77 » TARGET_OS=${TARGET_OS} TARGET_ARCH=${TARGET_ARCH} \ | 77 » TARGET_OS=${TARGET_OS} ABP_TARGET_ARCH=${ABP_TARGET_ARCH} \ |
| 78 TRAVIS_OS_NAME=${TRAVIS_OS_NAME} Configuration=${Configuration} \ | 78 TRAVIS_OS_NAME=${TRAVIS_OS_NAME} Configuration=${Configuration} \ |
| 79 bash .travis/prepare-prebuilt-v8.sh | 79 bash .travis/prepare-prebuilt-v8.sh |
| 80 | 80 |
| 81 clean: | 81 clean: |
| 82 $(RM) -r ${BUILD_DIR} docs | 82 $(RM) -r ${BUILD_DIR} docs |
| 83 | 83 |
| 84 ifeq ($(TARGET_OS),android) | 84 ifeq ($(TARGET_OS),android) |
| 85 SUB_ACTION ?= installed_modules | 85 SUB_ACTION ?= installed_modules |
| 86 all: ensure_dependencies | 86 all: ensure_dependencies |
| 87 GYP_DEFINES="${GYP_PARAMETERS}" \ | 87 GYP_DEFINES="${GYP_PARAMETERS}" \ |
| 88 python ./make_gyp_wrapper.py --depth=. -f make-android -Ilibadblockplus.
gypi --generator-output=${BUILD_DIR} -Gandroid_ndk_version=r16b libadblockplus.g
yp | 88 python ./make_gyp_wrapper.py --depth=. -f make-android -Ilibadblockplus.
gypi --generator-output=${BUILD_DIR} -Gandroid_ndk_version=r16b libadblockplus.g
yp |
| 89 $(ANDROID_NDK_ROOT)/ndk-build -C ${BUILD_DIR} ${SUB_ACTION} \ | 89 $(ANDROID_NDK_ROOT)/ndk-build -C ${BUILD_DIR} ${SUB_ACTION} \ |
| 90 BUILDTYPE=Release \ | 90 BUILDTYPE=Release \ |
| 91 APP_ABI=$(ANDROID_ABI) \ | 91 APP_ABI=$(ANDROID_ABI) \ |
| 92 APP_PLATFORM=${ANDROID_PLATFORM_LEVEL} \ | 92 APP_PLATFORM=${ANDROID_PLATFORM_LEVEL} \ |
| 93 APP_PIE=true \ | 93 APP_PIE=true \ |
| 94 APP_STL=c++_shared \ | 94 APP_STL=c++_shared \ |
| 95 APP_BUILD_SCRIPT=Makefile \ | 95 APP_BUILD_SCRIPT=Makefile \ |
| 96 NDK_PROJECT_PATH=. \ | 96 NDK_PROJECT_PATH=. \ |
| 97 NDK_OUT=. \ | 97 NDK_OUT=. \ |
| 98 ${ANDROID_FIXES} \ | 98 ${ANDROID_FIXES} \ |
| 99 » NDK_APP_DST_DIR=android-$(TARGET_ARCH).release | 99 » NDK_APP_DST_DIR=android-$(ABP_TARGET_ARCH).release |
| 100 else | 100 else |
| 101 SUB_ACTION ?= all | 101 SUB_ACTION ?= all |
| 102 all: ensure_dependencies | 102 all: ensure_dependencies |
| 103 GYP_DEFINES="${GYP_PARAMETERS}" third_party/gyp/gyp --depth=. -f make -I
libadblockplus.gypi --generator-output=${BUILD_DIR} libadblockplus.gyp | 103 GYP_DEFINES="${GYP_PARAMETERS}" third_party/gyp/gyp --depth=. -f make -I
libadblockplus.gypi --generator-output=${BUILD_DIR} libadblockplus.gyp |
| 104 $(MAKE) -C ${BUILD_DIR} ${SUB_ACTION} | 104 $(MAKE) -C ${BUILD_DIR} ${SUB_ACTION} |
| 105 | 105 |
| 106 endif | 106 endif |
| OLD | NEW |