1##
2LOCAL_PATH := $(call my-dir)
3# libv8.so
4# ===================================================
5include $(CLEAR_VARS)
6
7LOCAL_CXX_STL := libc++
8
9ifeq ($(TARGET_ARCH),mips)
10       LOCAL_MIPS_MODE=mips
11endif
12
13# Set up the target identity
14LOCAL_MODULE := libv8
15LOCAL_MODULE_CLASS := STATIC_LIBRARIES
16generated_sources := $(call local-generated-sources-dir)
17
18LOCAL_MULTILIB := both
19
20# Android.v8common.mk defines V8_LOCAL_JS_LIBRARY_FILES, LOCAL_SRC_FILES,
21# LOCAL_CFLAGS, LOCAL_SRC_FILES_arch, and LOCAL_CFLAGS_arch
22V8_LOCAL_JS_LIBRARY_FILES :=
23V8_LOCAL_JS_EXPERIMENTAL_LIBRARY_FILES :=
24include $(LOCAL_PATH)/Android.v8common.mk
25
26# Target can only be linux
27LOCAL_SRC_FILES += \
28  src/base/platform/platform-linux.cc \
29  src/base/platform/platform-posix.cc
30
31LOCAL_SRC_FILES_x86 += src/base/atomicops_internals_x86_gcc.cc
32LOCAL_SRC_FILES_x86_64 += src/base/atomicops_internals_x86_gcc.cc
33
34LOCAL_JS_LIBRARY_FILES := $(addprefix $(LOCAL_PATH)/, $(V8_LOCAL_JS_LIBRARY_FILES))
35LOCAL_JS_EXPERIMENTAL_LIBRARY_FILES := $(addprefix $(LOCAL_PATH)/, $(V8_LOCAL_JS_EXPERIMENTAL_LIBRARY_FILES))
36
37# Copy js2c.py to generated sources directory and invoke there to avoid
38# generating jsmin.pyc in the source directory
39JS2C_PY := $(generated_sources)/js2c.py $(generated_sources)/jsmin.py
40$(JS2C_PY): $(generated_sources)/%.py : $(LOCAL_PATH)/tools/%.py | $(ACP)
41	@echo "Copying $@"
42	$(copy-file-to-target)
43
44# Generate libraries.cc
45GEN1 := $(generated_sources)/libraries.cc
46$(GEN1): SCRIPT := $(generated_sources)/js2c.py
47$(GEN1): $(LOCAL_JS_LIBRARY_FILES) $(JS2C_PY)
48	@echo "Generating libraries.cc"
49	@mkdir -p $(dir $@)
50	python $(SCRIPT) $@ CORE off $(LOCAL_JS_LIBRARY_FILES)
51V8_GENERATED_LIBRARIES := $(generated_sources)/libraries.cc
52
53# Generate experimental-libraries.cc
54GEN2 := $(generated_sources)/experimental-libraries.cc
55$(GEN2): SCRIPT := $(generated_sources)/js2c.py
56$(GEN2): $(LOCAL_JS_EXPERIMENTAL_LIBRARY_FILES) $(JS2C_PY)
57	@echo "Generating experimental-libraries.cc"
58	@mkdir -p $(dir $@)
59	python $(SCRIPT) $@ EXPERIMENTAL off $(LOCAL_JS_EXPERIMENTAL_LIBRARY_FILES)
60V8_GENERATED_LIBRARIES += $(generated_sources)/experimental-libraries.cc
61
62LOCAL_GENERATED_SOURCES += $(V8_GENERATED_LIBRARIES)
63
64# Generate snapshot.cc
65ifeq ($(ENABLE_V8_SNAPSHOT),true)
66
67SNAP_GEN := $(generated_sources)/snapshot_$(TARGET_ARCH).cc
68MKSNAPSHOT := $(HOST_OUT_EXECUTABLES)/v8_mksnapshot.$(TARGET_ARCH)
69$(SNAP_GEN): PRIVATE_CUSTOM_TOOL = $(HOST_OUT_EXECUTABLES)/v8_mksnapshot.$(TARGET_ARCH) --log-snapshot-positions --logfile $(dir $@)/v8-snapshot_$(TARGET_ARCH).log $@
70$(SNAP_GEN): $(MKSNAPSHOT)
71	$(transform-generated-source)
72LOCAL_GENERATED_SOURCES_$(TARGET_ARCH) += $(SNAP_GEN)
73
74ifdef TARGET_2ND_ARCH
75SNAP_GEN := $(generated_sources)/snapshot_$(TARGET_2ND_ARCH).cc
76MKSNAPSHOT := $(HOST_OUT_EXECUTABLES)/v8_mksnapshot.$(TARGET_2ND_ARCH)
77$(SNAP_GEN): PRIVATE_CUSTOM_TOOL = $(HOST_OUT_EXECUTABLES)/v8_mksnapshot.$(TARGET_2ND_ARCH) --log-snapshot-positions --logfile $(dir $@)/v8-snapshot_$(TARGET_2ND_ARCH).log $@
78$(SNAP_GEN): $(MKSNAPSHOT)
79	$(transform-generated-source)
80LOCAL_GENERATED_SOURCES_$(TARGET_2ND_ARCH) += $(SNAP_GEN)
81endif # TARGET_2ND_ARCH
82
83else
84LOCAL_SRC_FILES += \
85  src/snapshot-empty.cc
86endif # ENABLE_V8_SNAPSHOT
87
88# The -fvisibility=hidden option below prevents exporting of symbols from
89# libv8.a.
90LOCAL_CFLAGS += \
91	-Wno-endif-labels \
92	-Wno-import \
93	-Wno-format \
94	-fno-exceptions \
95	-fvisibility=hidden \
96	-DENABLE_DEBUGGER_SUPPORT \
97	-DENABLE_LOGGING_AND_PROFILING \
98	-DENABLE_VMSTATE_TRACKING \
99	-DV8_NATIVE_REGEXP \
100	-Wno-unused-parameter \
101	-std=gnu++0x
102
103LOCAL_CFLAGS_arm += -DV8_TARGET_ARCH_ARM
104LOCAL_CFLAGS_arm64 += -DV8_TARGET_ARCH_ARM64
105
106# atomicops_internals_arm64_gcc.h:77:49: error:
107# expected compatible register, symbol or integer in range [0, 4095]
108LOCAL_CLANG_CFLAGS_arm64 += -no-integrated-as
109
110LOCAL_CFLAGS_mips += -DV8_TARGET_ARCH_MIPS \
111	-Umips \
112	-finline-limit=64 \
113	-fno-strict-aliasing
114LOCAL_CFLAGS_mips64 += -DV8_TARGET_ARCH_MIPS64 \
115	-Umips \
116	-finline-limit=64 \
117	-fno-strict-aliasing
118
119LOCAL_CFLAGS_x86 += -DV8_TARGET_ARCH_IA32
120LOCAL_CFLAGS_x86_64 += -DV8_TARGET_ARCH_X64
121
122ifeq ($(DEBUG_V8),true)
123	LOCAL_CFLAGS += -DDEBUG -UNDEBUG
124endif
125
126ifdef TARGET_2ND_ARCH
127LOCAL_SRC_FILES_$(TARGET_2ND_ARCH) += $(v8_local_src_files_$(TARGET_2ND_ARCH))
128endif
129
130LOCAL_SRC_FILES_$(TARGET_ARCH) += $(v8_local_src_files_$(TARGET_ARCH))
131
132LOCAL_SHARED_LIBRARIES += libicuuc libicui18n
133
134LOCAL_C_INCLUDES += $(LOCAL_PATH)/src
135
136LOCAL_MODULE_TARGET_ARCH_WARN := $(V8_SUPPORTED_ARCH)
137
138LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
139
140include $(BUILD_STATIC_LIBRARY)
141