OSDN Git Service

Add code that enables SquirrelFish Extreme (a.k.a JSCX, JSC JIT) in Android.
[android-x86/external-webkit.git] / Android.mk
1 ##
2 ## Copyright 2009, The Android Open Source Project
3 ##
4 ## Redistribution and use in source and binary forms, with or without
5 ## modification, are permitted provided that the following conditions
6 ## are met:
7 ##  * Redistributions of source code must retain the above copyright
8 ##    notice, this list of conditions and the following disclaimer.
9 ##  * Redistributions in binary form must reproduce the above copyright
10 ##    notice, this list of conditions and the following disclaimer in the
11 ##    documentation and/or other materials provided with the distribution.
12 ##
13 ## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
14 ## EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 ## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 ## PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
17 ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 ## EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 ## PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 ## PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 ## OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 ## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 ## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 ##
25
26 LOCAL_PATH := $(call my-dir)
27
28 # Two ways to control which JS engine is used:
29 # 1. use JS_ENGINE environment variable, value can be either 'jsc' or 'v8'
30 #    This is the preferred way.
31 # 2. if JS_ENGINE is not set, or is not 'jsc' or 'v8', this makefile picks
32 #    up a default engine to build.
33 #    To help setup buildbot, a new environment variable, USE_ALT_JS_ENGINE,
34 #    can be set to true, so that two builds can be different but without
35 #    specifying which JS engine to use.
36
37 # To control if JSC JIT is used, please set ENABLE_ANDROID_JSC_JIT environment
38 # variable to true.
39
40 # Read JS_ENGINE environment variable
41 JAVASCRIPT_ENGINE = $(JS_ENGINE)
42
43 ifneq ($(JAVASCRIPT_ENGINE),jsc)
44   ifneq ($(JAVASCRIPT_ENGINE),v8)
45     # No JS engine is specified, pickup the one we want as default.
46     ifeq ($(USE_ALT_JS_ENGINE),true)
47       JAVASCRIPT_ENGINE = v8
48     else
49       JAVASCRIPT_ENGINE = jsc
50     endif
51   endif
52 endif
53
54 BASE_PATH := $(call my-dir)
55 include $(CLEAR_VARS)
56
57 # Define our module and find the intermediates directory
58 LOCAL_MODULE := libwebcore
59 LOCAL_MODULE_CLASS := STATIC_LIBRARIES
60 base_intermediates := $(call local-intermediates-dir)
61
62 # Using := here prevents recursive expansion
63 WEBKIT_SRC_FILES :=
64
65 # We have to use bison 2.3
66 include $(BASE_PATH)/bison_check.mk
67
68 # Build our list of include paths. We include WebKit/android/icu first so that
69 # any files that include <unicode/ucnv.h> will include our ucnv.h first. We
70 # also add external/ as an include directory so that we can specify the real
71 # icu header directory as a more exact reference to avoid including our ucnv.h.
72 #
73 # Note that JavasCriptCore/ must be included after WebCore/, so that we pick up
74 # the right config.h.
75 LOCAL_C_INCLUDES := \
76         $(JNI_H_INCLUDE) \
77         $(LOCAL_PATH)/WebKit/android/icu \
78         bionic/ \
79         external/ \
80         external/icu4c/common \
81         external/icu4c/i18n \
82         external/libxml2/include \
83         external/skia/emoji \
84         external/skia/include/core \
85         external/skia/include/effects \
86         external/skia/include/images \
87         external/skia/include/ports \
88         external/skia/include/utils \
89         external/skia/src/ports \
90         external/sqlite/dist \
91         frameworks/base/core/jni/android/graphics
92
93 LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \
94         $(LOCAL_PATH)/WebCore \
95         $(LOCAL_PATH)/WebCore/accessibility \
96         $(LOCAL_PATH)/WebCore/bindings/generic \
97         $(LOCAL_PATH)/WebCore/css \
98         $(LOCAL_PATH)/WebCore/dom \
99         $(LOCAL_PATH)/WebCore/editing \
100         $(LOCAL_PATH)/WebCore/history \
101         $(LOCAL_PATH)/WebCore/history/android \
102         $(LOCAL_PATH)/WebCore/html \
103         $(LOCAL_PATH)/WebCore/html/canvas \
104         $(LOCAL_PATH)/WebCore/inspector \
105         $(LOCAL_PATH)/WebCore/loader \
106         $(LOCAL_PATH)/WebCore/loader/appcache \
107         $(LOCAL_PATH)/WebCore/loader/icon \
108         $(LOCAL_PATH)/WebCore/notifications \
109         $(LOCAL_PATH)/WebCore/page \
110         $(LOCAL_PATH)/WebCore/page/android \
111         $(LOCAL_PATH)/WebCore/page/animation \
112         $(LOCAL_PATH)/WebCore/platform \
113         $(LOCAL_PATH)/WebCore/platform/android \
114         $(LOCAL_PATH)/WebCore/platform/animation \
115         $(LOCAL_PATH)/WebCore/platform/graphics \
116         $(LOCAL_PATH)/WebCore/platform/graphics/android \
117         $(LOCAL_PATH)/WebCore/platform/graphics/filters \
118         $(LOCAL_PATH)/WebCore/platform/graphics/network \
119         $(LOCAL_PATH)/WebCore/platform/graphics/skia \
120         $(LOCAL_PATH)/WebCore/platform/graphics/transforms \
121         $(LOCAL_PATH)/WebCore/platform/image-decoders \
122         $(LOCAL_PATH)/WebCore/platform/image-decoders/bmp \
123         $(LOCAL_PATH)/WebCore/platform/image-decoders/gif \
124         $(LOCAL_PATH)/WebCore/platform/image-decoders/ico \
125         $(LOCAL_PATH)/WebCore/platform/image-decoders/jpeg \
126         $(LOCAL_PATH)/WebCore/platform/image-decoders/png \
127         $(LOCAL_PATH)/WebCore/platform/mock \
128         $(LOCAL_PATH)/WebCore/platform/network \
129         $(LOCAL_PATH)/WebCore/platform/network/android \
130         $(LOCAL_PATH)/WebCore/platform/sql \
131         $(LOCAL_PATH)/WebCore/platform/text \
132         $(LOCAL_PATH)/WebCore/plugins \
133         $(LOCAL_PATH)/WebCore/plugins/android \
134         $(LOCAL_PATH)/WebCore/rendering \
135         $(LOCAL_PATH)/WebCore/rendering/style \
136         $(LOCAL_PATH)/WebCore/storage \
137         $(LOCAL_PATH)/WebCore/svg \
138         $(LOCAL_PATH)/WebCore/svg/animation \
139         $(LOCAL_PATH)/WebCore/svg/graphics \
140         $(LOCAL_PATH)/WebCore/svg/graphics/filters \
141         $(LOCAL_PATH)/WebCore/websockets \
142         $(LOCAL_PATH)/WebCore/workers \
143         $(LOCAL_PATH)/WebCore/xml
144
145 LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \
146         $(LOCAL_PATH)/WebKit/android \
147         $(LOCAL_PATH)/WebKit/android/WebCoreSupport \
148         $(LOCAL_PATH)/WebKit/android/jni \
149         $(LOCAL_PATH)/WebKit/android/nav \
150         $(LOCAL_PATH)/WebKit/android/plugins
151
152 LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \
153         $(LOCAL_PATH)/JavaScriptCore \
154         $(LOCAL_PATH)/JavaScriptCore/wtf \
155         $(LOCAL_PATH)/JavaScriptCore/wtf/unicode \
156         $(LOCAL_PATH)/JavaScriptCore/wtf/unicode/icu
157
158 LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \
159         $(base_intermediates)/WebCore/ \
160         $(base_intermediates)/WebCore/css \
161         $(base_intermediates)/WebCore/html \
162         $(base_intermediates)/WebCore/platform
163
164 ifeq ($(JAVASCRIPT_ENGINE),v8)
165 # Include WTF source file.
166 d := JavaScriptCore
167 LOCAL_PATH := $(BASE_PATH)/$d
168 intermediates := $(base_intermediates)/$d
169 include $(LOCAL_PATH)/Android.v8.wtf.mk
170 WEBKIT_SRC_FILES += $(addprefix $d/,$(LOCAL_SRC_FILES))
171 endif  # JAVASCRIPT_ENGINE == v8
172
173 # Include source files for WebCore
174 d := WebCore
175 LOCAL_PATH := $(BASE_PATH)/$d
176 JAVASCRIPTCORE_PATH := $(BASE_PATH)/JavaScriptCore
177 intermediates := $(base_intermediates)/$d
178 include $(LOCAL_PATH)/Android.mk
179 ifeq ($(JAVASCRIPT_ENGINE),jsc)
180 include $(LOCAL_PATH)/Android.jscbindings.mk
181 endif
182 ifeq ($(JAVASCRIPT_ENGINE),v8)
183 include $(LOCAL_PATH)/Android.v8bindings.mk
184 endif
185 WEBKIT_SRC_FILES += $(addprefix $d/,$(LOCAL_SRC_FILES))
186 LOCAL_C_INCLUDES += $(BINDING_C_INCLUDES)
187
188 # Include the derived source files for WebCore. Uses the same path as
189 # WebCore
190 include $(LOCAL_PATH)/Android.derived.mk
191 ifeq ($(JAVASCRIPT_ENGINE),jsc)
192 include $(LOCAL_PATH)/Android.derived.jscbindings.mk
193 endif
194 ifeq ($(JAVASCRIPT_ENGINE),v8)
195 include $(LOCAL_PATH)/Android.derived.v8bindings.mk
196 endif
197
198 # Include source files for android WebKit port
199 d := WebKit
200 LOCAL_PATH := $(BASE_PATH)/$d
201 intermediates := $(base_intermediates)/$d
202 include $(LOCAL_PATH)/Android.mk
203 WEBKIT_SRC_FILES += $(addprefix $d/,$(LOCAL_SRC_FILES))
204
205 # Redefine LOCAL_PATH here so the build system is not confused
206 LOCAL_PATH := $(BASE_PATH)
207
208 # Define our compiler flags
209 LOCAL_CFLAGS += -Wno-endif-labels -Wno-import -Wno-format
210 LOCAL_CFLAGS += -fno-strict-aliasing
211 LOCAL_CFLAGS += -include "WebCorePrefix.h"
212 LOCAL_CFLAGS += -fvisibility=hidden
213 LOCAL_CFLAGS += -D__SGI_STL_INTERNAL_PAIR_H
214
215 # Enable JSC JIT if JSC is used and ENABLE_ANDROID_JSC_JIT environment
216 # variable is set to true
217 ifeq ($(JAVASCRIPT_ENGINE),jsc)
218 ifeq ($(ENABLE_ANDROID_JSC_JIT),true)
219 LOCAL_CFLAGS += -DENABLE_ANDROID_JSC_JIT=1
220 endif
221 endif
222
223 ifeq ($(TARGET_ARCH),arm)
224 LOCAL_CFLAGS += -Darm
225 # remove this warning: "note: the mangling of 'va_list' has changed in GCC 4.4"
226 LOCAL_CFLAGS += -Wno-psabi
227 endif
228
229 ifeq ($(ENABLE_SVG),true)
230 LOCAL_CFLAGS += -DENABLE_SVG=1
231 endif
232
233 # Temporary disable SVG_ANIMATION.
234 ifeq ($(ENABLE_SVG_ANIMATION),true)
235 LOCAL_CFLAGS += -DENABLE_SVG_ANIMATION=1
236 endif
237
238 ifeq ($(WEBCORE_INSTRUMENTATION),true)
239 LOCAL_CFLAGS += -DANDROID_INSTRUMENT
240 endif
241
242 # LOCAL_LDLIBS is used in simulator builds only and simulator builds are only
243 # valid on Linux
244 LOCAL_LDLIBS += -lpthread -ldl
245
246 # Build the list of shared libraries
247 LOCAL_SHARED_LIBRARIES := \
248         libandroid_runtime \
249         libnativehelper \
250         libsqlite \
251         libskia \
252         libutils \
253         libui \
254         libcutils \
255         libicuuc \
256         libicudata \
257         libicui18n \
258         libmedia \
259         libsurfaceflinger_client
260
261 ifeq ($(WEBCORE_INSTRUMENTATION),true)
262 LOCAL_SHARED_LIBRARIES += libhardware_legacy
263 endif
264
265 # We have to use the android version of libdl when we are not on the simulator
266 ifneq ($(TARGET_SIMULATOR),true)
267 LOCAL_SHARED_LIBRARIES += libdl
268 LOCAL_C_INCLUDES += \
269         external/stlport
270 endif
271
272 # Build the list of static libraries
273 LOCAL_STATIC_LIBRARIES := libxml2
274 ifeq ($(JAVASCRIPT_ENGINE),v8)
275 LOCAL_STATIC_LIBRARIES += libv8
276 endif
277
278 # Redefine LOCAL_SRC_FILES to be all the WebKit source files
279 LOCAL_SRC_FILES := $(WEBKIT_SRC_FILES)
280
281 # Define this for use in other makefiles.
282 WEBKIT_C_INCLUDES := $(LOCAL_C_INCLUDES)
283 WEBKIT_CFLAGS := $(LOCAL_CFLAGS)
284 WEBKIT_GENERATED_SOURCES := $(LOCAL_GENERATED_SOURCES)
285 WEBKIT_LDLIBS := $(LOCAL_LDLIBS)
286 WEBKIT_SHARED_LIBRARIES := $(LOCAL_SHARED_LIBRARIES)
287 WEBKIT_STATIC_LIBRARIES := $(LOCAL_STATIC_LIBRARIES)
288
289 # Build the library all at once
290 include $(BUILD_STATIC_LIBRARY)
291
292 ifeq ($(JAVASCRIPT_ENGINE),jsc)
293 # Now build libjs as a static library.
294 include $(CLEAR_VARS)
295 LOCAL_MODULE := libjs
296 LOCAL_LDLIBS := $(WEBKIT_LDLIBS)
297 LOCAL_SHARED_LIBRARIES := $(WEBKIT_SHARED_LIBRARIES)
298 LOCAL_STATIC_LIBRARIES := $(WEBKIT_STATIC_LIBRARIES)
299 LOCAL_CFLAGS := $(WEBKIT_CFLAGS)
300 # Include source files for JavaScriptCore
301 d := JavaScriptCore
302 LOCAL_PATH := $(BASE_PATH)/$d
303 LOCAL_MODULE_CLASS := STATIC_LIBRARIES
304 # Cannot use base_intermediates as this is a new module
305 intermediates := $(call local-intermediates-dir)
306 include $(LOCAL_PATH)/Android.mk
307 # Redefine LOCAL_SRC_FILES with the correct prefix
308 LOCAL_SRC_FILES := $(addprefix $d/,$(LOCAL_SRC_FILES))
309 # Use the base path to resolve file names
310 LOCAL_PATH := $(BASE_PATH)
311 # Append jsc intermediate include paths to the WebKit include list.
312 LOCAL_C_INCLUDES := $(WEBKIT_C_INCLUDES) \
313         $(intermediates) \
314         $(intermediates)/parser \
315         $(intermediates)/runtime \
316 # Build libjs
317 include $(BUILD_STATIC_LIBRARY)
318 endif  # JAVASCRIPT_ENGINE == jsc
319
320 # Now build the shared library using only the exported jni entry point. This
321 # will strip out any unused code from the entry point.
322 include $(CLEAR_VARS)
323 # if you need to make webcore huge (for debugging), enable this line
324 #LOCAL_PRELINK_MODULE := false
325 LOCAL_MODULE := libwebcore
326 LOCAL_LDLIBS := $(WEBKIT_LDLIBS)
327 LOCAL_SHARED_LIBRARIES := $(WEBKIT_SHARED_LIBRARIES)
328 LOCAL_STATIC_LIBRARIES := libwebcore $(WEBKIT_STATIC_LIBRARIES)
329 ifeq ($(JAVASCRIPT_ENGINE),jsc)
330 LOCAL_STATIC_LIBRARIES += libjs
331 endif
332 LOCAL_LDFLAGS := -fvisibility=hidden
333 LOCAL_CFLAGS := $(WEBKIT_CFLAGS)
334 LOCAL_C_INCLUDES := $(WEBKIT_C_INCLUDES)
335 LOCAL_PATH := $(BASE_PATH)
336 LOCAL_SRC_FILES := \
337         WebKit/android/jni/WebCoreJniOnLoad.cpp
338 # Do this dependency by hand. The reason we have to do this is because the
339 # headers that this file pulls in are generated during the build of webcore.
340 # We make all of our object files depend on those files so that they are built
341 # before we try to compile the file.
342 LOCAL_ADDITIONAL_DEPENDENCIES := $(filter %.h, $(WEBKIT_GENERATED_SOURCES))
343 include $(BUILD_SHARED_LIBRARY)
344
345 # Build the wds client
346 include $(BASE_PATH)/WebKit/android/wds/client/Android.mk
347
348 # Build the performance command line tool.
349 include $(BASE_PATH)/WebKit/android/benchmark/Android.mk
350
351 # Build the webkit merge tool.
352 include $(BASE_PATH)/WebKitTools/android/webkitmerge/Android.mk