2 ## Copyright 2009, The Android Open Source Project
4 ## Redistribution and use in source and binary forms, with or without
5 ## modification, are permitted provided that the following conditions
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.
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.
26 LOCAL_PATH := $(call my-dir)
28 # Control SVG compiling in webkit.
29 # Default is true unless explictly disabled.
30 ifneq ($(ENABLE_SVG),false)
34 # Control complex scripts support compiling in webkit.
35 # Default is true unless explictly disabled.
36 ifneq ($(SUPPORT_COMPLEX_SCRIPTS),false)
37 SUPPORT_COMPLEX_SCRIPTS = true
40 # Two ways to control which JS engine is used:
41 # 1. use JS_ENGINE environment variable, value can be either 'jsc' or 'v8'
42 # This is the preferred way.
43 # 2. if JS_ENGINE is not set, or is not 'jsc' or 'v8', this makefile picks
44 # up a default engine to build.
45 # To help setup buildbot, a new environment variable, USE_ALT_JS_ENGINE,
46 # can be set to true, so that two builds can be different but without
47 # specifying which JS engine to use.
48 # To enable JIT in Android's JSC, please set ENABLE_JSC_JIT environment
51 # To enable JIT in Android's JSC, please set ENABLE_JSC_JIT environment
54 # Read JS_ENGINE environment variable
55 JAVASCRIPT_ENGINE = $(JS_ENGINE)
57 # We default to the V8 JS engine.
61 ifneq ($(JAVASCRIPT_ENGINE),jsc)
62 ifneq ($(JAVASCRIPT_ENGINE),v8)
63 # No JS engine is specified, pickup the one we want as default.
64 ifeq ($(USE_ALT_JS_ENGINE),true)
65 JAVASCRIPT_ENGINE = $(ALT_ENGINE)
67 JAVASCRIPT_ENGINE = $(DEFAULT_ENGINE)
71 # We can't use V8 on the simulator
72 ifeq ($(TARGET_SIMULATOR),true)
73 JAVASCRIPT_ENGINE = jsc
76 # See if the user has specified a stack they want to use
78 # We default to the Chrome HTTP stack.
82 ifneq ($(HTTP_STACK),chrome)
83 ifneq ($(HTTP_STACK),android)
84 # No HTTP stack is specified, pickup the one we want as default.
85 ifeq ($(USE_ALT_HTTP),true)
86 HTTP_STACK = $(ALT_HTTP)
88 HTTP_STACK = $(DEFAULT_HTTP)
93 # The Chrome stack can not be used with JSC and hence can not be used be used
95 ifeq ($(JAVASCRIPT_ENGINE),jsc)
96 ifeq ($(HTTP_STACK),chrome)
97 $(error Can not build with JSC and the Chrome HTTP stack)
101 # Read the environment variable to determine if Autofill is compiled.
102 # The default is on. Chrome HTTP stack must be used when Autofill
104 ifneq ($(ENABLE_AUTOFILL),false)
105 ENABLE_AUTOFILL = true
107 ifneq ($(HTTP_STACK),chrome)
108 ENABLE_AUTOFILL = false
111 BASE_PATH := $(call my-dir)
112 include $(CLEAR_VARS)
114 # Define our module and find the intermediates directory
115 LOCAL_MODULE := libwebcore
116 LOCAL_MODULE_CLASS := STATIC_LIBRARIES
117 base_intermediates := $(call local-intermediates-dir)
119 # Using := here prevents recursive expansion
122 # We have to use bison 2.3
123 include $(BASE_PATH)/bison_check.mk
125 # Build our list of include paths. We include WebKit/android/icu first so that
126 # any files that include <unicode/ucnv.h> will include our ucnv.h first. We
127 # also add external/ as an include directory so that we can specify the real
128 # icu header directory as a more exact reference to avoid including our ucnv.h.
130 # Note that JavasCriptCore/ must be included after WebCore/, so that we pick up
131 # the right config.h.
132 LOCAL_C_INCLUDES := \
134 $(LOCAL_PATH)/WebKit/android/icu \
136 external/icu4c/common \
137 external/icu4c/i18n \
138 external/libxml2/include \
140 external/hyphenation \
141 external/skia/emoji \
142 external/skia/include/core \
143 external/skia/include/effects \
144 external/skia/include/images \
145 external/skia/include/ports \
146 external/skia/include/utils \
147 external/skia/src/ports \
148 external/sqlite/dist \
149 frameworks/base/core/jni/android/graphics
151 LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \
152 $(LOCAL_PATH)/WebCore \
153 $(LOCAL_PATH)/WebCore/accessibility \
154 $(LOCAL_PATH)/WebCore/bindings/ \
155 $(LOCAL_PATH)/WebCore/bindings/generic \
156 $(LOCAL_PATH)/WebCore/css \
157 $(LOCAL_PATH)/WebCore/dom \
158 $(LOCAL_PATH)/WebCore/editing \
159 $(LOCAL_PATH)/WebCore/fileapi \
160 $(LOCAL_PATH)/WebCore/history \
161 $(LOCAL_PATH)/WebCore/history/android \
162 $(LOCAL_PATH)/WebCore/html \
163 $(LOCAL_PATH)/WebCore/html/canvas \
164 $(LOCAL_PATH)/WebCore/html/parser \
165 $(LOCAL_PATH)/WebCore/inspector \
166 $(LOCAL_PATH)/WebCore/loader \
167 $(LOCAL_PATH)/WebCore/loader/appcache \
168 $(LOCAL_PATH)/WebCore/loader/archive \
169 $(LOCAL_PATH)/WebCore/loader/archive/android \
170 $(LOCAL_PATH)/WebCore/loader/cache \
171 $(LOCAL_PATH)/WebCore/loader/icon \
172 $(LOCAL_PATH)/WebCore/notifications \
173 $(LOCAL_PATH)/WebCore/page \
174 $(LOCAL_PATH)/WebCore/page/android \
175 $(LOCAL_PATH)/WebCore/page/animation \
176 $(LOCAL_PATH)/WebCore/platform \
177 $(LOCAL_PATH)/WebCore/platform/android \
178 $(LOCAL_PATH)/WebCore/platform/animation \
179 $(LOCAL_PATH)/WebCore/platform/graphics \
180 $(LOCAL_PATH)/WebCore/platform/graphics/android \
181 $(LOCAL_PATH)/WebCore/platform/graphics/filters \
182 $(LOCAL_PATH)/WebCore/platform/graphics/gpu \
183 $(LOCAL_PATH)/WebCore/platform/graphics/network \
184 $(LOCAL_PATH)/WebCore/platform/graphics/skia \
185 $(LOCAL_PATH)/WebCore/platform/graphics/transforms \
186 $(LOCAL_PATH)/WebCore/platform/image-decoders \
187 $(LOCAL_PATH)/WebCore/platform/image-decoders/bmp \
188 $(LOCAL_PATH)/WebCore/platform/image-decoders/gif \
189 $(LOCAL_PATH)/WebCore/platform/image-decoders/ico \
190 $(LOCAL_PATH)/WebCore/platform/image-decoders/jpeg \
191 $(LOCAL_PATH)/WebCore/platform/image-decoders/png \
192 $(LOCAL_PATH)/WebCore/platform/image-decoders/webp \
193 $(LOCAL_PATH)/WebCore/platform/mock \
194 $(LOCAL_PATH)/WebCore/platform/network \
195 $(LOCAL_PATH)/WebCore/platform/network/android \
196 $(LOCAL_PATH)/WebCore/platform/sql \
197 $(LOCAL_PATH)/WebCore/platform/text \
198 $(LOCAL_PATH)/WebCore/platform/text/transcoder \
199 $(LOCAL_PATH)/WebCore/plugins \
200 $(LOCAL_PATH)/WebCore/plugins/android \
201 $(LOCAL_PATH)/WebCore/rendering \
202 $(LOCAL_PATH)/WebCore/rendering/style \
203 $(LOCAL_PATH)/WebCore/rendering/svg \
204 $(LOCAL_PATH)/WebCore/storage \
205 $(LOCAL_PATH)/WebCore/svg \
206 $(LOCAL_PATH)/WebCore/svg/animation \
207 $(LOCAL_PATH)/WebCore/svg/graphics \
208 $(LOCAL_PATH)/WebCore/svg/graphics/filters \
209 $(LOCAL_PATH)/WebCore/svg/properties \
210 $(LOCAL_PATH)/WebCore/websockets \
211 $(LOCAL_PATH)/WebCore/workers \
212 $(LOCAL_PATH)/WebCore/xml
214 LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \
215 $(LOCAL_PATH)/WebKit/android \
216 $(LOCAL_PATH)/WebKit/android/WebCoreSupport \
217 $(LOCAL_PATH)/WebKit/android/jni \
218 $(LOCAL_PATH)/WebKit/android/nav \
219 $(LOCAL_PATH)/WebKit/android/plugins
221 LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \
222 $(LOCAL_PATH)/JavaScriptCore \
223 $(LOCAL_PATH)/JavaScriptCore/wtf \
224 $(LOCAL_PATH)/JavaScriptCore/wtf/unicode \
225 $(LOCAL_PATH)/JavaScriptCore/wtf/unicode/icu
227 LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \
228 $(base_intermediates)/WebCore/ \
229 $(base_intermediates)/WebCore/css \
230 $(base_intermediates)/WebCore/html \
231 $(base_intermediates)/WebCore/platform
233 # The following includes are needed by the AutoFill feature, or the chrome http
235 LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \
236 $(LOCAL_PATH)/WebKit/chromium \
237 $(LOCAL_PATH)/WebKit/chromium/public \
238 external/chromium/chrome/browser \
239 external/chromium/chrome/renderer \
241 external/chromium/chrome \
244 ifeq ($(JAVASCRIPT_ENGINE),v8)
245 # Include WTF source file.
247 LOCAL_PATH := $(BASE_PATH)/$d
248 intermediates := $(base_intermediates)/$d
249 include $(LOCAL_PATH)/Android.v8.wtf.mk
250 WEBKIT_SRC_FILES += $(addprefix $d/,$(LOCAL_SRC_FILES))
251 endif # JAVASCRIPT_ENGINE == v8
253 # Include source files for WebCore
255 LOCAL_PATH := $(BASE_PATH)/$d
256 JAVASCRIPTCORE_PATH := $(BASE_PATH)/JavaScriptCore
257 intermediates := $(base_intermediates)/$d
258 include $(LOCAL_PATH)/Android.mk
259 ifeq ($(JAVASCRIPT_ENGINE),jsc)
260 include $(LOCAL_PATH)/Android.jscbindings.mk
262 ifeq ($(JAVASCRIPT_ENGINE),v8)
263 include $(LOCAL_PATH)/Android.v8bindings.mk
265 WEBKIT_SRC_FILES += $(addprefix $d/,$(LOCAL_SRC_FILES))
266 LOCAL_C_INCLUDES += $(BINDING_C_INCLUDES)
268 # Include the derived source files for WebCore. Uses the same path as
270 include $(LOCAL_PATH)/Android.derived.mk
271 ifeq ($(JAVASCRIPT_ENGINE),jsc)
272 include $(LOCAL_PATH)/Android.derived.jscbindings.mk
274 ifeq ($(JAVASCRIPT_ENGINE),v8)
275 include $(LOCAL_PATH)/Android.derived.v8bindings.mk
278 # Include source files for android WebKit port
280 LOCAL_PATH := $(BASE_PATH)/$d
281 intermediates := $(base_intermediates)/$d
282 include $(LOCAL_PATH)/Android.mk
283 WEBKIT_SRC_FILES += $(addprefix $d/,$(LOCAL_SRC_FILES))
285 # Redefine LOCAL_PATH here so the build system is not confused
286 LOCAL_PATH := $(BASE_PATH)
288 # Define our compiler flags
289 LOCAL_CFLAGS += -Wno-endif-labels -Wno-import -Wno-format
290 LOCAL_CFLAGS += -fno-strict-aliasing
291 LOCAL_CFLAGS += -include "WebCorePrefix.h"
292 LOCAL_CFLAGS += -fvisibility=hidden
293 LOCAL_CFLAGS += -DALWAYS_INLINE=inline
294 # Make sure assert.h is included before assert is defined
295 LOCAL_CFLAGS += -include "assert.h"
296 ifeq ($(HTTP_STACK),chrome)
297 LOCAL_CFLAGS += -DGOOGLEURL
298 LOCAL_CFLAGS += -DWTF_USE_CHROME_NETWORK_STACK
299 endif # HTTP_STACK == chrome
300 LOCAL_CPPFLAGS := -Wno-sign-promo
302 # Adds GL and EGL extensions for the GL backend
303 LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES -DEGL_EGLEXT_PROTOTYPES
305 # Enable JSC JIT if JSC is used and ENABLE_JSC_JIT environment
306 # variable is set to true
307 ifeq ($(JAVASCRIPT_ENGINE),jsc)
308 ifeq ($(ENABLE_JSC_JIT),true)
309 LOCAL_CFLAGS += -DENABLE_ANDROID_JSC_JIT=1
313 ifeq ($(TARGET_ARCH),arm)
314 LOCAL_CFLAGS += -Darm
315 # remove this warning: "note: the mangling of 'va_list' has changed in GCC 4.4"
316 LOCAL_CFLAGS += -Wno-psabi
319 # need a flag to tell the C side when we're on devices with large memory
320 # budgets (i.e. larger than the low-end devices that initially shipped)
321 ifeq ($(ARCH_ARM_HAVE_VFP),true)
322 LOCAL_CFLAGS += -DANDROID_LARGE_MEMORY_DEVICE
325 ifeq ($(ENABLE_SVG),true)
326 LOCAL_CFLAGS += -DENABLE_SVG=1 -DENABLE_SVG_ANIMATION=1
329 ifeq ($(ENABLE_WTF_USE_ACCELERATED_COMPOSITING),false)
330 LOCAL_CFLAGS += -DWTF_USE_ACCELERATED_COMPOSITING=0
333 ifeq ($(ENABLE_WTF_USE_ACCELERATED_COMPOSITING),true)
334 LOCAL_CFLAGS += -DWTF_USE_ACCELERATED_COMPOSITING=1
337 ifeq ($(WEBCORE_INSTRUMENTATION),true)
338 LOCAL_CFLAGS += -DANDROID_INSTRUMENT
341 # LOCAL_LDLIBS is used in simulator builds only and simulator builds are only
343 LOCAL_LDLIBS += -lpthread -ldl
345 # Build the list of shared libraries
346 LOCAL_SHARED_LIBRARIES := \
357 libsurfaceflinger_client \
361 ifeq ($(WEBCORE_INSTRUMENTATION),true)
362 LOCAL_SHARED_LIBRARIES += libhardware_legacy
365 # We have to use the android version of libdl when we are not on the simulator
366 ifneq ($(TARGET_SIMULATOR),true)
367 LOCAL_SHARED_LIBRARIES += libdl libstlport
368 # We have to fake out some headers when using stlport.
369 LOCAL_C_INCLUDES += \
370 external/chromium/android
371 include external/stlport/libstlport.mk
374 # We need Harfbuzz library to support complex scripts(Arabic, Thai, Hindi...).
375 ifeq ($(SUPPORT_COMPLEX_SCRIPTS),true)
376 LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \
377 external/harfbuzz/src \
378 external/harfbuzz/contrib
379 LOCAL_SHARED_LIBRARIES += libharfbuzz
380 LOCAL_CFLAGS += -DSUPPORT_COMPLEX_SCRIPTS=1
383 # Build the list of static libraries
384 LOCAL_STATIC_LIBRARIES := libxml2 libxslt libhyphenation
385 ifeq ($(JAVASCRIPT_ENGINE),v8)
386 LOCAL_STATIC_LIBRARIES += libv8
389 ifeq ($(HTTP_STACK),chrome)
390 LOCAL_STATIC_LIBRARIES += libchromium_net
391 LOCAL_SHARED_LIBRARIES += libcrypto libssl libz
392 endif # HTTP_STACK == chrome
394 ifeq ($(ENABLE_AUTOFILL),true)
395 LOCAL_SHARED_LIBRARIES += libexpat
398 # Redefine LOCAL_SRC_FILES to be all the WebKit source files
399 LOCAL_SRC_FILES := $(WEBKIT_SRC_FILES)
401 # Define this for use in other makefiles.
402 WEBKIT_C_INCLUDES := $(LOCAL_C_INCLUDES)
403 WEBKIT_CFLAGS := $(LOCAL_CFLAGS)
404 WEBKIT_CPPFLAGS := $(LOCAL_CPPFLAGS)
405 WEBKIT_GENERATED_SOURCES := $(LOCAL_GENERATED_SOURCES)
406 WEBKIT_LDLIBS := $(LOCAL_LDLIBS)
407 WEBKIT_SHARED_LIBRARIES := $(LOCAL_SHARED_LIBRARIES)
408 WEBKIT_STATIC_LIBRARIES := $(LOCAL_STATIC_LIBRARIES)
410 # Build the library all at once
411 include $(BUILD_STATIC_LIBRARY)
413 ifeq ($(JAVASCRIPT_ENGINE),jsc)
414 # Now build libjs as a static library.
415 include $(CLEAR_VARS)
416 LOCAL_MODULE := libjs
417 LOCAL_LDLIBS := $(WEBKIT_LDLIBS)
418 LOCAL_SHARED_LIBRARIES := $(WEBKIT_SHARED_LIBRARIES)
419 LOCAL_STATIC_LIBRARIES := $(WEBKIT_STATIC_LIBRARIES)
420 LOCAL_CFLAGS := $(WEBKIT_CFLAGS)
421 # Include source files for JavaScriptCore
423 LOCAL_PATH := $(BASE_PATH)/$d
424 LOCAL_MODULE_CLASS := STATIC_LIBRARIES
425 # Cannot use base_intermediates as this is a new module
426 intermediates := $(call local-intermediates-dir)
427 include $(LOCAL_PATH)/Android.mk
428 # Redefine LOCAL_SRC_FILES with the correct prefix
429 LOCAL_SRC_FILES := $(addprefix $d/,$(LOCAL_SRC_FILES))
430 # Use the base path to resolve file names
431 LOCAL_PATH := $(BASE_PATH)
432 # Append jsc intermediate include paths to the WebKit include list.
433 LOCAL_C_INCLUDES := $(WEBKIT_C_INCLUDES) \
435 $(intermediates)/parser \
436 $(intermediates)/runtime \
438 include $(BUILD_STATIC_LIBRARY)
439 endif # JAVASCRIPT_ENGINE == jsc
441 # Now build the shared library using only the exported jni entry point. This
442 # will strip out any unused code from the entry point.
443 include $(CLEAR_VARS)
444 # if you need to make webcore huge (for debugging), enable this line
445 LOCAL_PRELINK_MODULE := false
446 LOCAL_MODULE := libwebcore
447 LOCAL_LDLIBS := $(WEBKIT_LDLIBS)
448 LOCAL_SHARED_LIBRARIES := $(WEBKIT_SHARED_LIBRARIES)
449 LOCAL_STATIC_LIBRARIES := libwebcore $(WEBKIT_STATIC_LIBRARIES)
450 ifeq ($(JAVASCRIPT_ENGINE),jsc)
451 LOCAL_STATIC_LIBRARIES += libjs
453 LOCAL_LDFLAGS := -fvisibility=hidden
454 LOCAL_CFLAGS := $(WEBKIT_CFLAGS)
455 LOCAL_CPPFLAGS := $(WEBKIT_CPPFLAGS)
456 LOCAL_C_INCLUDES := $(WEBKIT_C_INCLUDES)
457 LOCAL_PATH := $(BASE_PATH)
459 WebKit/android/jni/WebCoreJniOnLoad.cpp
461 ifeq ($(ENABLE_AUTOFILL),true)
462 # AutoFill requires some cpp files from Chromium to link with
463 # libchromium_net. We cannot compile them into libchromium_net
464 # because they have cpp file extensions, not .cc.
465 LOCAL_CFLAGS += -DWEBKIT_IMPLEMENTATION=1
467 WebKit/android/WebCoreSupport/autofill/MainThreadProxy.cpp \
468 WebKit/chromium/src/WebCString.cpp \
469 WebKit/chromium/src/WebRegularExpression.cpp \
470 WebKit/chromium/src/WebString.cpp
473 # Do this dependency by hand. The reason we have to do this is because the
474 # headers that this file pulls in are generated during the build of webcore.
475 # We make all of our object files depend on those files so that they are built
476 # before we try to compile the file.
477 LOCAL_ADDITIONAL_DEPENDENCIES := $(filter %.h, $(WEBKIT_GENERATED_SOURCES))
478 include $(BUILD_SHARED_LIBRARY)
480 # Build the wds client
481 include $(BASE_PATH)/WebKit/android/wds/client/Android.mk
483 # Build the performance command line tool.
484 include $(BASE_PATH)/WebKit/android/benchmark/Android.mk
486 # Build the webkit merge tool.
487 include $(BASE_PATH)/WebKitTools/android/webkitmerge/Android.mk