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 $(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 $(LOCAL_JS_EXPERIMENTAL_LIBRARY_FILES)
60V8_GENERATED_LIBRARIES += $(generated_sources)/experimental-libraries.cc
61
62# Generate extra-libraries.cc
63GEN3 := $(generated_sources)/extra-libraries.cc
64$(GEN3): SCRIPT := $(generated_sources)/js2c.py
65$(GEN3): $(JS2C_PY)
66	@echo "Generating extra-libraries.cc"
67	@mkdir -p $(dir $@)
68	python $(SCRIPT) $@ EXTRAS
69V8_GENERATED_LIBRARIES += $(generated_sources)/extra-libraries.cc
70
71# Generate iexperimental-extra-libraries.cc
72GEN3 := $(generated_sources)/experimental-extra-libraries.cc
73$(GEN3): SCRIPT := $(generated_sources)/js2c.py
74$(GEN3): $(JS2C_PY)
75	@echo "Generating experimental-extra-libraries.cc"
76	@mkdir -p $(dir $@)
77	python $(SCRIPT) $@ EXPERIMENTAL_EXTRAS
78V8_GENERATED_LIBRARIES += $(generated_sources)/experimental-extra-libraries.cc
79
80
81LOCAL_GENERATED_SOURCES += $(V8_GENERATED_LIBRARIES)
82
83LOCAL_SRC_FILES += \
84	src/snapshot/snapshot-empty.cc \
85
86# The -fvisibility=hidden option below prevents exporting of symbols from
87# libv8.a.
88LOCAL_CFLAGS += \
89	-Wno-endif-labels \
90	-Wno-import \
91	-Wno-format \
92	-Wno-unused-parameter \
93	-fno-exceptions \
94	-fvisibility=hidden \
95	-DENABLE_DEBUGGER_SUPPORT \
96	-DENABLE_LOGGING_AND_PROFILING \
97	-DENABLE_VMSTATE_TRACKING \
98	-DV8_NATIVE_REGEXP \
99	-DV8_I18N_SUPPORT \
100	-std=gnu++0x
101
102LOCAL_CFLAGS_arm += -DV8_TARGET_ARCH_ARM
103LOCAL_CFLAGS_arm64 += -DV8_TARGET_ARCH_ARM64
104
105# atomicops_internals_arm64_gcc.h:77:49: error:
106# expected compatible register, symbol or integer in range [0, 4095]
107LOCAL_CLANG_CFLAGS_arm64 += -no-integrated-as
108
109LOCAL_CFLAGS_mips += -DV8_TARGET_ARCH_MIPS \
110	-Umips \
111	-finline-limit=64 \
112	-fno-strict-aliasing
113LOCAL_CFLAGS_mips64 += -DV8_TARGET_ARCH_MIPS64 \
114	-Umips \
115	-finline-limit=64 \
116	-fno-strict-aliasing
117
118LOCAL_CFLAGS_x86 += -DV8_TARGET_ARCH_IA32
119LOCAL_CFLAGS_x86_64 += -DV8_TARGET_ARCH_X64
120
121ifeq ($(DEBUG_V8),true)
122	LOCAL_CFLAGS += -DDEBUG -UNDEBUG
123endif
124
125ifdef TARGET_2ND_ARCH
126LOCAL_SRC_FILES_$(TARGET_2ND_ARCH) += $(v8_local_src_files_$(TARGET_2ND_ARCH))
127endif
128
129LOCAL_SRC_FILES_$(TARGET_ARCH) += $(v8_local_src_files_$(TARGET_ARCH))
130
131LOCAL_SHARED_LIBRARIES := libicuuc libicui18n
132
133LOCAL_C_INCLUDES += $(LOCAL_PATH)/src
134
135LOCAL_MODULE_TARGET_ARCH_WARN := $(V8_SUPPORTED_ARCH)
136
137LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
138
139include $(BUILD_STATIC_LIBRARY)
140