OLD | NEW |
1 V8_DIR :=$(shell pwd -L)/third_party/v8/ | |
2 HOST_ARCH :=$(shell python third_party/detect_v8_host_arch.py) | 1 HOST_ARCH :=$(shell python third_party/detect_v8_host_arch.py) |
3 | 2 |
4 GYP_PARAMETERS=host_arch=${HOST_ARCH} | |
5 | |
6 ifndef HOST_OS | 3 ifndef HOST_OS |
7 raw_OS = $(shell uname -s) | 4 raw_OS = $(shell uname -s) |
8 ifeq (${raw_OS},Linux) | 5 ifeq (${raw_OS},Linux) |
9 HOST_OS=linux | 6 HOST_OS=linux |
10 else ifeq (${raw_OS},Darwin) | 7 else ifeq (${raw_OS},Darwin) |
11 HOST_OS=mac | 8 HOST_OS=mac |
12 endif | 9 endif |
13 endif | 10 endif |
14 | 11 |
15 ifndef BUILD_DIR | 12 TARGET_OS ?= ${HOST_OS} |
16 BUILD_DIR=$(shell pwd -L)/build | 13 TARGET_ARCH ?= ${HOST_ARCH} |
17 endif | 14 Configuration ?= debug |
18 | 15 |
19 ifneq "$(and ${LIBV8_LIB_DIR}, ${LIBV8_INCLUDE_DIR})" "" | 16 BUILD_DIR ?=$(shell pwd -L)/build |
20 BUILD_V8=do-nothing | |
21 ABP_GYP_PARAMETERS+= libv8_lib_dir=${LIBV8_LIB_DIR} libv8_include_dir=${LIBV8_IN
CLUDE_DIR} | |
22 else | |
23 BUILD_V8=build-v8 | |
24 endif | |
25 | 17 |
26 ifneq ($(ANDROID_ARCH),) | 18 ifeq (${TARGET_OS},android) |
27 ANDROID_PLATFORM_LEVEL=android-9 | 19 Configuration ?= release |
28 GYP_PARAMETERS+= OS=android target_arch=${ANDROID_ARCH} | 20 ANDROID_PLATFORM_LEVEL=android-16 |
29 ifeq ($(ANDROID_ARCH),arm) | 21 ANDROID_FIXES= |
| 22 ifeq ($(TARGET_ARCH),arm) |
30 ANDROID_ABI = armeabi-v7a | 23 ANDROID_ABI = armeabi-v7a |
31 else ifeq ($(ANDROID_ARCH),ia32) | 24 ANDROID_FIXES="LOCAL_LDFLAGS=\"-Wl,--allow-multiple-definition\"" |
| 25 else ifeq ($(TARGET_ARCH),ia32) |
32 ANDROID_ABI = x86 | 26 ANDROID_ABI = x86 |
33 else ifeq ($(ANDROID_ARCH),arm64) | 27 else ifeq ($(TARGET_ARCH),arm64) |
34 ANDROID_ABI = arm64-v8a | 28 ANDROID_ABI = arm64-v8a |
35 # minimal platform having arch-arm64, see ndk/platforms | 29 # minimal platform having arch-arm64, see ndk/platforms |
36 ANDROID_PLATFORM_LEVEL=android-21 | 30 ANDROID_PLATFORM_LEVEL=android-21 |
37 else | 31 else |
38 $(error "Unsupported Android architecture: $(ANDROID_ARCH)) | 32 $(error "Unsupported Android architecture: $(TARGET_ARCH)") |
39 endif | 33 endif |
40 ANDROID_DEST_DIR = android_$(ANDROID_ARCH).release | |
41 | |
42 ifeq "$(and ${LIBV8_LIB_DIR}, ${LIBV8_INCLUDE_DIR})" "" | |
43 ABP_GYP_PARAMETERS+= libv8_lib_dir=${ANDROID_DEST_DIR} | |
44 BUILD_V8=build-v8-android | |
45 endif | 34 endif |
46 | 35 |
47 else # if ${ANDROID_ARCH} is empty | 36 # linux,osx |
48 TARGET_ARCH=${HOST_ARCH} | 37 # x64, ia32 |
49 ifdef ARCH | 38 # debug, release |
50 TARGET_ARCH=${ARCH} | 39 # android |
| 40 # arm, arm64, ia32 |
| 41 # release |
| 42 |
| 43 GYP_PARAMETERS=host_arch=${HOST_ARCH} OS=${TARGET_OS} target_arch=${TARGET_ARCH} |
| 44 ifneq "$(and ${LIBV8_LIB_DIR}, ${LIBV8_INCLUDE_DIR})" "" |
| 45 GYP_PARAMETERS+= libv8_lib_dir=${LIBV8_LIB_DIR} libv8_include_dir=${LIBV8_INCLUD
E_DIR} |
| 46 else |
| 47 $(error "V8 directories are not specified") |
51 endif | 48 endif |
52 GYP_PARAMETERS+= OS=${HOST_OS} target_arch=${TARGET_ARCH} | |
53 endif | |
54 | |
55 | 49 |
56 TEST_EXECUTABLE = ${BUILD_DIR}/out/Debug/tests | 50 TEST_EXECUTABLE = ${BUILD_DIR}/out/Debug/tests |
57 | 51 |
58 .PHONY: do-nothing all test clean docs build-v8 build-v8-android v8_android_mult
i android_multi android_x86 \ | 52 .PHONY: all test clean docs ensure_dependencies |
59 » android_arm ensure_dependencies | |
60 | 53 |
61 .DEFAULT_GOAL:=all | 54 .DEFAULT_GOAL:=all |
62 | 55 |
63 do-nothing: | |
64 | |
65 ensure_dependencies: | 56 ensure_dependencies: |
66 python ensure_dependencies.py | 57 python ensure_dependencies.py |
67 | 58 |
68 build-v8: ensure_dependencies | |
69 GYP_DEFINES="${GYP_PARAMETERS}" third_party/gyp/gyp --depth=. -f make -I
build-v8.gypi --generator-output=${BUILD_DIR}/v8 ${V8_DIR}src/v8.gyp | |
70 make -C ${BUILD_DIR}/v8 v8_snapshot v8_libplatform v8_libsampler | |
71 | |
72 all: ${BUILD_V8} ensure_dependencies | |
73 GYP_DEFINES="${GYP_PARAMETERS} ${ABP_GYP_PARAMETERS}" third_party/gyp/gy
p --depth=. -f make -I libadblockplus.gypi --generator-output=${BUILD_DIR} libad
blockplus.gyp | |
74 $(MAKE) -C ${BUILD_DIR} | |
75 | |
76 test: all | 59 test: all |
77 ifdef FILTER | 60 ifdef FILTER |
78 $(TEST_EXECUTABLE) --gtest_filter=$(FILTER) | 61 $(TEST_EXECUTABLE) --gtest_filter=$(FILTER) |
79 else | 62 else |
80 $(TEST_EXECUTABLE) | 63 $(TEST_EXECUTABLE) |
81 endif | 64 endif |
82 | 65 |
83 docs: | 66 docs: |
84 doxygen | 67 doxygen |
85 | 68 |
86 clean: | 69 clean: |
87 $(RM) -r ${BUILD_DIR} docs | 70 $(RM) -r ${BUILD_DIR} docs |
88 | 71 |
89 android_x86: | 72 ifeq ($(TARGET_OS),android) |
90 » ANDROID_ARCH="ia32" $(MAKE) android_multi | 73 all: ensure_dependencies |
91 | 74 » GYP_DEFINES="${GYP_PARAMETERS}" \ |
92 android_arm: | |
93 » ANDROID_ARCH="arm" $(MAKE) android_multi | |
94 | |
95 android_arm64: | |
96 » ANDROID_ARCH="arm64" $(MAKE) android_multi | |
97 | |
98 ifneq ($(ANDROID_ARCH),) | |
99 v8_android_multi: ensure_dependencies | |
100 » cd third_party/v8 && GYP_GENERATORS=make-android \ | |
101 » GYP_DEFINES="${GYP_PARAMETERS} v8_target_arch=${ANDROID_ARCH}" \ | |
102 » PYTHONPATH="${V8_DIR}tools/generate_shim_headers:${V8_DIR}gypfiles:${P
YTHONPATH}" \ | |
103 » python ../../make_gyp_wrapper.py \ | |
104 » --generator-output=${BUILD_DIR} src/v8.gyp \ | |
105 » -Igypfiles/standalone.gypi \ | |
106 » --depth=. \ | |
107 » -S.android_${ANDROID_ARCH}.release \ | |
108 » -I../../android-v8-options.gypi | |
109 » cd third_party/v8 && make \ | |
110 » -C ${BUILD_DIR} \ | |
111 » -f Makefile.android_${ANDROID_ARCH}.release \ | |
112 » v8_snapshot v8_libplatform v8_libsampler \ | |
113 » BUILDTYPE=Release \ | |
114 » builddir=${BUILD_DIR}/android_${ANDROID_ARCH}.release | |
115 | |
116 v8_android_multi_linux_${ANDROID_ARCH}: v8_android_multi | |
117 | |
118 v8_android_multi_mac_ia32: v8_android_multi | |
119 » find ${BUILD_DIR}/android_ia32.release/ -depth 1 -iname \*.a -exec ${AND
ROID_NDK_ROOT}/toolchains/x86-4.9/prebuilt/darwin-x86_64/bin/i686-linux-android-
ranlib {} \; | |
120 | |
121 v8_android_multi_mac_arm: v8_android_multi | |
122 » find ${BUILD_DIR}/android_arm.release/ -depth 1 -iname \*.a -exec ${ANDR
OID_NDK_ROOT}/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/ar
m-linux-androideabi-ranlib {} \; | |
123 | |
124 v8_android_multi_mac_arm64: v8_android_multi | |
125 » find ${BUILD_DIR}/android_arm64.release/ -depth 1 -iname \*.a -exec ${AN
DROID_NDK_ROOT}/toolchains/aarch64-linux-android-4.9/prebuilt/darwin-x86_64/bin/
aarch64-linux-android-ranlib {} \; | |
126 | |
127 build-v8-android: v8_android_multi_${HOST_OS}_${ANDROID_ARCH} | |
128 | |
129 android_multi: ${BUILD_V8} ensure_dependencies | |
130 » GYP_DEFINES="${GYP_PARAMETERS} ${ABP_GYP_PARAMETERS}" \ | |
131 python ./make_gyp_wrapper.py --depth=. -f make-android -Ilibadblockplus.
gypi --generator-output=${BUILD_DIR} -Gandroid_ndk_version=r16b libadblockplus.g
yp | 75 python ./make_gyp_wrapper.py --depth=. -f make-android -Ilibadblockplus.
gypi --generator-output=${BUILD_DIR} -Gandroid_ndk_version=r16b libadblockplus.g
yp |
132 $(ANDROID_NDK_ROOT)/ndk-build -C ${BUILD_DIR} installed_modules \ | 76 $(ANDROID_NDK_ROOT)/ndk-build -C ${BUILD_DIR} installed_modules \ |
133 BUILDTYPE=Release \ | 77 BUILDTYPE=Release \ |
134 APP_ABI=$(ANDROID_ABI) \ | 78 APP_ABI=$(ANDROID_ABI) \ |
135 APP_PLATFORM=${ANDROID_PLATFORM_LEVEL} \ | 79 APP_PLATFORM=${ANDROID_PLATFORM_LEVEL} \ |
136 APP_PIE=true \ | 80 APP_PIE=true \ |
137 » APP_STL=c++_static \ | 81 » APP_STL=c++_shared \ |
138 APP_BUILD_SCRIPT=Makefile \ | 82 APP_BUILD_SCRIPT=Makefile \ |
139 NDK_PROJECT_PATH=. \ | 83 NDK_PROJECT_PATH=. \ |
140 NDK_OUT=. \ | 84 NDK_OUT=. \ |
141 LOCAL_DISABLE_FATAL_LINKER_WARNINGS=true \ | 85 » ${ANDROID_FIXES} \ |
142 LOCAL_LDFLAGS="-Wl,--allow-multiple-definition" \ | 86 » NDK_APP_DST_DIR=android-$(TARGET_ARCH).release |
143 » NDK_APP_DST_DIR=$(ANDROID_DEST_DIR) | 87 else |
| 88 all: ensure_dependencies |
| 89 » GYP_DEFINES="${GYP_PARAMETERS}" third_party/gyp/gyp --depth=. -f make -I
libadblockplus.gypi --generator-output=${BUILD_DIR} libadblockplus.gyp |
| 90 » $(MAKE) -C ${BUILD_DIR} |
| 91 |
144 endif | 92 endif |
145 | |
OLD | NEW |