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 # Control SVG compiling in webkit.
27 # Default is true unless explictly disabled.
28 ifneq ($(ENABLE_SVG),false)
32 # Control complex scripts support compiling in webkit.
33 # Default is true unless explictly disabled.
34 ifneq ($(SUPPORT_COMPLEX_SCRIPTS),false)
35 SUPPORT_COMPLEX_SCRIPTS = true
38 # Two ways to control which JS engine is used:
39 # 1. use JS_ENGINE environment variable, value can be either 'jsc' or 'v8'
40 # This is the preferred way.
41 # 2. if JS_ENGINE is not set, or is not 'jsc' or 'v8', this makefile picks
42 # up a default engine to build.
43 # To help setup buildbot, a new environment variable, USE_ALT_JS_ENGINE,
44 # can be set to true, so that two builds can be different but without
45 # specifying which JS engine to use.
46 # To enable JIT in Android's JSC, please set ENABLE_JSC_JIT environment
49 # To enable JIT in Android's JSC, please set ENABLE_JSC_JIT environment
52 # Read JS_ENGINE environment variable
53 JAVASCRIPT_ENGINE = $(JS_ENGINE)
55 # We default to the V8 JS engine.
59 ifneq ($(JAVASCRIPT_ENGINE),jsc)
60 ifneq ($(JAVASCRIPT_ENGINE),v8)
61 # No JS engine is specified, pickup the one we want as default.
62 ifeq ($(USE_ALT_JS_ENGINE),true)
63 JAVASCRIPT_ENGINE = $(ALT_ENGINE)
65 JAVASCRIPT_ENGINE = $(DEFAULT_ENGINE)
69 # We can't use V8 on the simulator
70 ifeq ($(TARGET_SIMULATOR),true)
71 JAVASCRIPT_ENGINE = jsc
74 # V8 also requires an ARMv7 CPU, and since we must use jsc, we cannot
75 # use the Chrome http stack either.
76 ifneq ($(strip $(ARCH_ARM_HAVE_ARMV7A)),true)
77 JAVASCRIPT_ENGINE := jsc
81 # See if the user has specified a stack they want to use
83 # We default to the Chrome HTTP stack.
87 ifneq ($(HTTP_STACK),chrome)
88 ifneq ($(HTTP_STACK),android)
89 # No HTTP stack is specified, pickup the one we want as default.
90 ifeq ($(USE_ALT_HTTP),true)
91 HTTP_STACK = $(ALT_HTTP)
93 HTTP_STACK = $(DEFAULT_HTTP)
98 # The Chrome stack can not be used with JSC and hence can not be used be used
100 ifeq ($(JAVASCRIPT_ENGINE),jsc)
101 ifeq ($(HTTP_STACK),chrome)
102 $(error Can not build with JSC and the Chrome HTTP stack)
106 # Read the environment variable to determine if Autofill is compiled.
107 # The default is on. Chrome HTTP stack must be used when Autofill
109 ifneq ($(ENABLE_AUTOFILL),false)
110 ENABLE_AUTOFILL = true
112 ifneq ($(HTTP_STACK),chrome)
113 ENABLE_AUTOFILL = false
116 BASE_PATH := $(call my-dir)
117 include $(CLEAR_VARS)
119 # Define our module and find the intermediates directory
120 LOCAL_MODULE := libwebcore
121 LOCAL_MODULE_CLASS := STATIC_LIBRARIES
122 base_intermediates := $(call local-intermediates-dir)
124 # Using := here prevents recursive expansion
127 # We have to use bison 2.3
128 include $(BASE_PATH)/bison_check.mk
131 SOURCE_PATH := $(BASE_PATH)/Source
132 WEBCORE_PATH := $(SOURCE_PATH)/WebCore
133 JAVASCRIPTCORE_PATH := $(SOURCE_PATH)/JavaScriptCore
134 WEBKIT_PATH := $(BASE_PATH)/WebKit
135 WEBCORE_INTERMEDIATES_PATH := $(base_intermediates)/Source/WebCore
137 # Build our list of include paths. We include WebKit/android/icu first so that
139 # Build our list of include paths. We include Source/WebKit/android/icu first so that
140 >>>>>>> WebKit.org @ r75993
141 # any files that include <unicode/ucnv.h> will include our ucnv.h first. We
142 # also add external/ as an include directory so that we can specify the real
143 # icu header directory as a more exact reference to avoid including our ucnv.h.
145 # Note that JavasCriptCore/ must be included after WebCore/, so that we pick up
146 # the right config.h.
147 LOCAL_C_INCLUDES := \
150 $(WEBKIT_PATH)/android/icu \
152 $(LOCAL_PATH)/Source/WebKit/android/icu \
153 >>>>>>> WebKit.org @ r75993
155 external/icu4c/common \
156 external/icu4c/i18n \
158 external/libxml2/include \
160 external/hyphenation \
161 external/skia/emoji \
162 external/skia/include/core \
163 external/skia/include/effects \
164 external/skia/include/images \
165 external/skia/include/ports \
166 external/skia/include/utils \
167 external/skia/src/ports \
168 external/sqlite/dist \
169 frameworks/base/core/jni/android/graphics \
170 frameworks/base/include
172 # Add Source/ for the include of <JavaScriptCore/config.h> from WebCore/config.h
173 LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \
176 LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \
179 $(WEBCORE_PATH)/accessibility \
180 $(WEBCORE_PATH)/bindings/ \
181 $(WEBCORE_PATH)/bindings/generic \
182 $(WEBCORE_PATH)/css \
183 $(WEBCORE_PATH)/dom \
184 $(WEBCORE_PATH)/editing \
185 $(WEBCORE_PATH)/fileapi \
186 $(WEBCORE_PATH)/history \
187 $(WEBCORE_PATH)/history/android \
188 $(WEBCORE_PATH)/html \
189 $(WEBCORE_PATH)/html/canvas \
190 $(WEBCORE_PATH)/html/parser \
191 $(WEBCORE_PATH)/html/shadow \
192 $(WEBCORE_PATH)/inspector \
193 $(WEBCORE_PATH)/loader \
194 $(WEBCORE_PATH)/loader/appcache \
195 $(WEBCORE_PATH)/loader/archive \
196 $(WEBCORE_PATH)/loader/archive/android \
197 $(WEBCORE_PATH)/loader/cache \
198 $(WEBCORE_PATH)/loader/icon \
199 $(WEBCORE_PATH)/notifications \
200 $(WEBCORE_PATH)/page \
201 $(WEBCORE_PATH)/page/android \
202 $(WEBCORE_PATH)/page/animation \
203 $(WEBCORE_PATH)/platform \
204 $(WEBCORE_PATH)/platform/android \
205 $(WEBCORE_PATH)/platform/animation \
206 $(WEBCORE_PATH)/platform/graphics \
207 $(WEBCORE_PATH)/platform/graphics/android \
208 $(WEBCORE_PATH)/platform/graphics/filters \
209 $(WEBCORE_PATH)/platform/graphics/gpu \
210 $(WEBCORE_PATH)/platform/graphics/network \
211 $(WEBCORE_PATH)/platform/graphics/skia \
212 $(WEBCORE_PATH)/platform/graphics/transforms \
213 $(WEBCORE_PATH)/platform/image-decoders \
214 $(WEBCORE_PATH)/platform/image-decoders/bmp \
215 $(WEBCORE_PATH)/platform/image-decoders/gif \
216 $(WEBCORE_PATH)/platform/image-decoders/ico \
217 $(WEBCORE_PATH)/platform/image-decoders/jpeg \
218 $(WEBCORE_PATH)/platform/image-decoders/png \
219 $(WEBCORE_PATH)/platform/image-decoders/webp \
220 $(WEBCORE_PATH)/platform/mock \
221 $(WEBCORE_PATH)/platform/network \
222 $(WEBCORE_PATH)/platform/network/android \
223 $(WEBCORE_PATH)/platform/sql \
224 $(WEBCORE_PATH)/platform/text \
225 $(WEBCORE_PATH)/platform/text/transcoder \
226 $(WEBCORE_PATH)/plugins \
227 $(WEBCORE_PATH)/plugins/android \
228 $(WEBCORE_PATH)/rendering \
229 $(WEBCORE_PATH)/rendering/style \
230 $(WEBCORE_PATH)/rendering/svg \
231 $(WEBCORE_PATH)/storage \
232 $(WEBCORE_PATH)/svg \
233 $(WEBCORE_PATH)/svg/animation \
234 $(WEBCORE_PATH)/svg/graphics \
235 $(WEBCORE_PATH)/svg/graphics/filters \
236 $(WEBCORE_PATH)/svg/properties \
237 $(WEBCORE_PATH)/websockets \
238 $(WEBCORE_PATH)/workers \
241 $(LOCAL_PATH)/Source/WebKit/android \
242 $(LOCAL_PATH)/Source/WebKit/android/WebCoreSupport \
243 $(LOCAL_PATH)/Source/WebKit/android/jni \
244 $(LOCAL_PATH)/Source/WebKit/android/nav \
245 $(LOCAL_PATH)/Source/WebKit/android/plugins \
246 $(LOCAL_PATH)/Source/WebKit/android/stl
247 >>>>>>> WebKit.org @ r75993
249 LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \
250 $(WEBKIT_PATH)/android \
251 $(WEBKIT_PATH)/android/WebCoreSupport \
252 $(WEBKIT_PATH)/android/jni \
253 $(WEBKIT_PATH)/android/nav \
254 $(WEBKIT_PATH)/android/plugins
256 LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \
257 $(JAVASCRIPTCORE_PATH) \
258 $(JAVASCRIPTCORE_PATH)/wtf \
259 $(JAVASCRIPTCORE_PATH)/wtf/unicode \
260 $(JAVASCRIPTCORE_PATH)/wtf/unicode/icu
262 LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \
263 $(WEBCORE_INTERMEDIATES_PATH) \
264 $(WEBCORE_INTERMEDIATES_PATH)/css \
265 $(WEBCORE_INTERMEDIATES_PATH)/html \
266 $(WEBCORE_INTERMEDIATES_PATH)/platform
268 # The following includes are needed by the AutoFill feature, or the chrome http
270 LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \
271 $(WEBKIT_PATH)/chromium \
272 $(WEBKIT_PATH)/chromium/public \
273 external/chromium/chrome/browser \
274 external/chromium/chrome/renderer \
276 external/chromium/chrome \
279 ifeq ($(JAVASCRIPT_ENGINE),v8)
280 # Include WTF source file.
281 d := Source/JavaScriptCore
282 LOCAL_PATH := $(BASE_PATH)/$d
283 intermediates := $(base_intermediates)/$d
284 include $(LOCAL_PATH)/Android.v8.wtf.mk
285 WEBKIT_SRC_FILES += $(addprefix $d/,$(LOCAL_SRC_FILES))
286 endif # JAVASCRIPT_ENGINE == v8
288 # Include source files for WebCore
290 LOCAL_PATH := $(BASE_PATH)/$d
291 intermediates := $(base_intermediates)/$d
292 include $(LOCAL_PATH)/Android.mk
293 ifeq ($(JAVASCRIPT_ENGINE),jsc)
294 include $(LOCAL_PATH)/Android.jscbindings.mk
296 ifeq ($(JAVASCRIPT_ENGINE),v8)
297 include $(LOCAL_PATH)/Android.v8bindings.mk
299 WEBKIT_SRC_FILES += $(addprefix $d/,$(LOCAL_SRC_FILES))
300 LOCAL_C_INCLUDES += $(BINDING_C_INCLUDES)
302 # Include the derived source files for WebCore. Uses the same path as
304 include $(LOCAL_PATH)/Android.derived.mk
305 ifeq ($(JAVASCRIPT_ENGINE),jsc)
306 include $(LOCAL_PATH)/Android.derived.jscbindings.mk
308 ifeq ($(JAVASCRIPT_ENGINE),v8)
309 include $(LOCAL_PATH)/Android.derived.v8bindings.mk
312 # Include source files for android WebKit port
314 LOCAL_PATH := $(BASE_PATH)/$d
315 intermediates := $(base_intermediates)/$d
316 include $(LOCAL_PATH)/Android.mk
317 WEBKIT_SRC_FILES += $(addprefix $d/,$(LOCAL_SRC_FILES))
319 # Redefine LOCAL_PATH here so the build system is not confused
320 LOCAL_PATH := $(BASE_PATH)
322 # Define our compiler flags
323 LOCAL_CFLAGS += -Wno-endif-labels -Wno-import -Wno-format
324 LOCAL_CFLAGS += -fno-strict-aliasing
325 LOCAL_CFLAGS += -include "WebCorePrefix.h"
326 LOCAL_CFLAGS += -fvisibility=hidden
327 LOCAL_CFLAGS += -DALWAYS_INLINE=inline
328 # Make sure assert.h is included before assert is defined
329 LOCAL_CFLAGS += -include "assert.h"
330 ifeq ($(HTTP_STACK),chrome)
331 LOCAL_CFLAGS += -DGOOGLEURL
332 LOCAL_CFLAGS += -DWTF_USE_CHROME_NETWORK_STACK
333 endif # HTTP_STACK == chrome
334 LOCAL_CPPFLAGS := -Wno-sign-promo
336 # Adds GL and EGL extensions for the GL backend
337 LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES -DEGL_EGLEXT_PROTOTYPES
339 # Enable JSC JIT if JSC is used and ENABLE_JSC_JIT environment
340 # variable is set to true
341 ifeq ($(JAVASCRIPT_ENGINE),jsc)
342 ifeq ($(ENABLE_JSC_JIT),true)
343 LOCAL_CFLAGS += -DENABLE_ANDROID_JSC_JIT=1
347 ifeq ($(TARGET_ARCH),arm)
348 LOCAL_CFLAGS += -Darm
349 # remove this warning: "note: the mangling of 'va_list' has changed in GCC 4.4"
350 LOCAL_CFLAGS += -Wno-psabi
353 # need a flag to tell the C side when we're on devices with large memory
354 # budgets (i.e. larger than the low-end devices that initially shipped)
355 ifeq ($(ARCH_ARM_HAVE_VFP),true)
356 LOCAL_CFLAGS += -DANDROID_LARGE_MEMORY_DEVICE
359 ifeq ($(ENABLE_SVG),true)
360 LOCAL_CFLAGS += -DENABLE_SVG=1 -DENABLE_SVG_ANIMATION=1
363 ifeq ($(ENABLE_WTF_USE_ACCELERATED_COMPOSITING),false)
364 LOCAL_CFLAGS += -DWTF_USE_ACCELERATED_COMPOSITING=0
367 ifeq ($(ENABLE_WTF_USE_ACCELERATED_COMPOSITING),true)
368 LOCAL_CFLAGS += -DWTF_USE_ACCELERATED_COMPOSITING=1
371 ifeq ($(WEBCORE_INSTRUMENTATION),true)
372 LOCAL_CFLAGS += -DANDROID_INSTRUMENT
375 # LOCAL_LDLIBS is used in simulator builds only and simulator builds are only
377 LOCAL_LDLIBS += -lpthread -ldl
379 # Build the list of shared libraries
380 LOCAL_SHARED_LIBRARIES := \
391 libsurfaceflinger_client \
396 ifeq ($(WEBCORE_INSTRUMENTATION),true)
397 LOCAL_SHARED_LIBRARIES += libhardware_legacy
400 # We have to use the android version of libdl when we are not on the simulator
401 ifneq ($(TARGET_SIMULATOR),true)
402 LOCAL_SHARED_LIBRARIES += libdl libstlport
403 # We have to fake out some headers when using stlport.
404 LOCAL_C_INCLUDES += \
405 external/chromium/android
406 include external/stlport/libstlport.mk
409 # We need Harfbuzz library to support complex scripts(Arabic, Thai, Hindi...).
410 ifeq ($(SUPPORT_COMPLEX_SCRIPTS),true)
411 LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \
412 external/harfbuzz/src \
413 external/harfbuzz/contrib
414 LOCAL_SHARED_LIBRARIES += libharfbuzz
415 LOCAL_CFLAGS += -DSUPPORT_COMPLEX_SCRIPTS=1
418 # Build the list of static libraries
419 LOCAL_STATIC_LIBRARIES := libxml2 libxslt libhyphenation
420 ifeq ($(JAVASCRIPT_ENGINE),v8)
421 LOCAL_STATIC_LIBRARIES += libv8
424 ifeq ($(HTTP_STACK),chrome)
425 LOCAL_STATIC_LIBRARIES += libchromium_net
426 LOCAL_SHARED_LIBRARIES += libcrypto libssl libz
427 endif # HTTP_STACK == chrome
429 ifeq ($(ENABLE_AUTOFILL),true)
430 LOCAL_SHARED_LIBRARIES += libexpat
433 # Redefine LOCAL_SRC_FILES to be all the WebKit source files
434 LOCAL_SRC_FILES := $(WEBKIT_SRC_FILES)
436 # Define this for use in other makefiles.
437 WEBKIT_C_INCLUDES := $(LOCAL_C_INCLUDES)
438 WEBKIT_CFLAGS := $(LOCAL_CFLAGS)
439 WEBKIT_CPPFLAGS := $(LOCAL_CPPFLAGS)
440 WEBKIT_GENERATED_SOURCES := $(LOCAL_GENERATED_SOURCES)
441 WEBKIT_LDLIBS := $(LOCAL_LDLIBS)
442 WEBKIT_SHARED_LIBRARIES := $(LOCAL_SHARED_LIBRARIES)
443 WEBKIT_STATIC_LIBRARIES := $(LOCAL_STATIC_LIBRARIES)
445 # Build the library all at once
446 include $(BUILD_STATIC_LIBRARY)
448 ifeq ($(JAVASCRIPT_ENGINE),jsc)
449 # Now build libjs as a static library.
450 include $(CLEAR_VARS)
451 LOCAL_MODULE := libjs
452 LOCAL_LDLIBS := $(WEBKIT_LDLIBS)
453 LOCAL_SHARED_LIBRARIES := $(WEBKIT_SHARED_LIBRARIES)
454 LOCAL_STATIC_LIBRARIES := $(WEBKIT_STATIC_LIBRARIES)
455 LOCAL_CFLAGS := $(WEBKIT_CFLAGS)
456 # Include source files for JavaScriptCore
457 d := Source/JavaScriptCore
458 LOCAL_PATH := $(BASE_PATH)/$d
459 LOCAL_MODULE_CLASS := STATIC_LIBRARIES
460 # Cannot use base_intermediates as this is a new module
461 intermediates := $(call local-intermediates-dir)
462 include $(LOCAL_PATH)/Android.mk
463 # Redefine LOCAL_SRC_FILES with the correct prefix
464 LOCAL_SRC_FILES := $(addprefix $d/,$(LOCAL_SRC_FILES))
465 # Use the base path to resolve file names
466 LOCAL_PATH := $(BASE_PATH)
467 # Append jsc intermediate include paths to the WebKit include list.
468 LOCAL_C_INCLUDES := $(WEBKIT_C_INCLUDES) \
470 $(intermediates)/parser \
471 $(intermediates)/runtime \
473 include $(BUILD_STATIC_LIBRARY)
474 endif # JAVASCRIPT_ENGINE == jsc
476 # Now build the shared library using only the exported jni entry point. This
477 # will strip out any unused code from the entry point.
478 include $(CLEAR_VARS)
479 # if you need to make webcore huge (for debugging), enable this line
480 LOCAL_MODULE := libwebcore
481 LOCAL_LDLIBS := $(WEBKIT_LDLIBS)
482 LOCAL_SHARED_LIBRARIES := $(WEBKIT_SHARED_LIBRARIES)
483 LOCAL_STATIC_LIBRARIES := libwebcore $(WEBKIT_STATIC_LIBRARIES)
484 ifeq ($(JAVASCRIPT_ENGINE),jsc)
485 LOCAL_STATIC_LIBRARIES += libjs
487 LOCAL_LDFLAGS := -fvisibility=hidden
488 LOCAL_CFLAGS := $(WEBKIT_CFLAGS)
489 LOCAL_CPPFLAGS := $(WEBKIT_CPPFLAGS)
490 LOCAL_C_INCLUDES := $(WEBKIT_C_INCLUDES)
491 LOCAL_PATH := $(BASE_PATH)
493 WebKit/android/jni/WebCoreJniOnLoad.cpp
495 ifeq ($(ENABLE_AUTOFILL),true)
496 # AutoFill requires some cpp files from Chromium to link with
497 # libchromium_net. We cannot compile them into libchromium_net
498 # because they have cpp file extensions, not .cc.
499 LOCAL_CFLAGS += -DWEBKIT_IMPLEMENTATION=1
501 WebKit/android/WebCoreSupport/autofill/MainThreadProxy.cpp \
502 WebKit/chromium/src/WebCString.cpp \
503 WebKit/chromium/src/WebRegularExpression.cpp \
504 WebKit/chromium/src/WebString.cpp
507 # Do this dependency by hand. The reason we have to do this is because the
508 # headers that this file pulls in are generated during the build of webcore.
509 # We make all of our object files depend on those files so that they are built
510 # before we try to compile the file.
511 LOCAL_ADDITIONAL_DEPENDENCIES := $(filter %.h, $(WEBKIT_GENERATED_SOURCES))
512 include $(BUILD_SHARED_LIBRARY)
514 # Build the wds client
515 include $(BASE_PATH)/WebKit/android/wds/client/Android.mk
517 # Build the performance command line tool.
518 include $(BASE_PATH)/WebKit/android/benchmark/Android.mk
520 # Build the webkit merge tool.
521 include $(BASE_PATH)/Tools/android/webkitmerge/Android.mk