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
130 SOURCE_PATH := $(BASE_PATH)/Source
131 WEBCORE_PATH := $(SOURCE_PATH)/WebCore
132 JAVASCRIPTCORE_PATH := $(SOURCE_PATH)/JavaScriptCore
133 WEBKIT_PATH := $(SOURCE_PATH)/WebKit
134 WEBCORE_INTERMEDIATES_PATH := $(base_intermediates)/Source/WebCore
136 # Build our list of include paths. We include Source/WebKit/android/icu first so that
137 # any files that include <unicode/ucnv.h> will include our ucnv.h first. We
138 # also add external/ as an include directory so that we can specify the real
139 # icu header directory as a more exact reference to avoid including our ucnv.h.
141 # Note that JavasCriptCore/ must be included after WebCore/, so that we pick up
142 # the right config.h.
143 LOCAL_C_INCLUDES := \
145 $(WEBKIT_PATH)/android/icu \
147 external/icu4c/common \
148 external/icu4c/i18n \
150 external/libxml2/include \
152 external/hyphenation \
153 external/skia/emoji \
154 external/skia/include/core \
155 external/skia/include/effects \
156 external/skia/include/images \
157 external/skia/include/ports \
158 external/skia/include/utils \
159 external/skia/src/ports \
160 external/sqlite/dist \
161 frameworks/base/core/jni/android/graphics \
162 frameworks/base/include
164 # Add Source/ for the include of <JavaScriptCore/config.h> from WebCore/config.h
165 LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \
168 LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \
170 $(WEBCORE_PATH)/accessibility \
171 $(WEBCORE_PATH)/bindings/ \
172 $(WEBCORE_PATH)/bindings/generic \
173 $(WEBCORE_PATH)/css \
174 $(WEBCORE_PATH)/dom \
175 $(WEBCORE_PATH)/editing \
176 $(WEBCORE_PATH)/fileapi \
177 $(WEBCORE_PATH)/history \
178 $(WEBCORE_PATH)/history/android \
179 $(WEBCORE_PATH)/html \
180 $(WEBCORE_PATH)/html/canvas \
181 $(WEBCORE_PATH)/html/parser \
182 $(WEBCORE_PATH)/html/shadow \
183 $(WEBCORE_PATH)/inspector \
184 $(WEBCORE_PATH)/loader \
185 $(WEBCORE_PATH)/loader/appcache \
186 $(WEBCORE_PATH)/loader/archive \
187 $(WEBCORE_PATH)/loader/archive/android \
188 $(WEBCORE_PATH)/loader/cache \
189 $(WEBCORE_PATH)/loader/icon \
190 $(WEBCORE_PATH)/notifications \
191 $(WEBCORE_PATH)/page \
192 $(WEBCORE_PATH)/page/android \
193 $(WEBCORE_PATH)/page/animation \
194 $(WEBCORE_PATH)/platform \
195 $(WEBCORE_PATH)/platform/android \
196 $(WEBCORE_PATH)/platform/animation \
197 $(WEBCORE_PATH)/platform/graphics \
198 $(WEBCORE_PATH)/platform/graphics/android \
199 $(WEBCORE_PATH)/platform/graphics/filters \
200 $(WEBCORE_PATH)/platform/graphics/gpu \
201 $(WEBCORE_PATH)/platform/graphics/network \
202 $(WEBCORE_PATH)/platform/graphics/skia \
203 $(WEBCORE_PATH)/platform/graphics/transforms \
204 $(WEBCORE_PATH)/platform/image-decoders \
205 $(WEBCORE_PATH)/platform/image-decoders/bmp \
206 $(WEBCORE_PATH)/platform/image-decoders/gif \
207 $(WEBCORE_PATH)/platform/image-decoders/ico \
208 $(WEBCORE_PATH)/platform/image-decoders/jpeg \
209 $(WEBCORE_PATH)/platform/image-decoders/png \
210 $(WEBCORE_PATH)/platform/image-decoders/webp \
211 $(WEBCORE_PATH)/platform/mock \
212 $(WEBCORE_PATH)/platform/network \
213 $(WEBCORE_PATH)/platform/network/android \
214 $(WEBCORE_PATH)/platform/sql \
215 $(WEBCORE_PATH)/platform/text \
216 $(WEBCORE_PATH)/platform/text/transcoder \
217 $(WEBCORE_PATH)/plugins \
218 $(WEBCORE_PATH)/plugins/android \
219 $(WEBCORE_PATH)/rendering \
220 $(WEBCORE_PATH)/rendering/style \
221 $(WEBCORE_PATH)/rendering/svg \
222 $(WEBCORE_PATH)/storage \
223 $(WEBCORE_PATH)/svg \
224 $(WEBCORE_PATH)/svg/animation \
225 $(WEBCORE_PATH)/svg/graphics \
226 $(WEBCORE_PATH)/svg/graphics/filters \
227 $(WEBCORE_PATH)/svg/properties \
228 $(WEBCORE_PATH)/websockets \
229 $(WEBCORE_PATH)/workers \
232 LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \
233 $(WEBKIT_PATH)/android \
234 $(WEBKIT_PATH)/android/WebCoreSupport \
235 $(WEBKIT_PATH)/android/jni \
236 $(WEBKIT_PATH)/android/nav \
237 $(WEBKIT_PATH)/android/plugins
239 LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \
240 $(JAVASCRIPTCORE_PATH) \
241 $(JAVASCRIPTCORE_PATH)/wtf \
242 $(JAVASCRIPTCORE_PATH)/wtf/unicode \
243 $(JAVASCRIPTCORE_PATH)/wtf/unicode/icu
245 LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \
246 $(WEBCORE_INTERMEDIATES_PATH) \
247 $(WEBCORE_INTERMEDIATES_PATH)/css \
248 $(WEBCORE_INTERMEDIATES_PATH)/html \
249 $(WEBCORE_INTERMEDIATES_PATH)/platform
251 # The following includes are needed by the AutoFill feature, or the chrome http
253 LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \
254 $(WEBKIT_PATH)/chromium \
255 $(WEBKIT_PATH)/chromium/public \
256 external/chromium/chrome/browser \
257 external/chromium/chrome/renderer \
259 external/chromium/chrome \
262 ifeq ($(JAVASCRIPT_ENGINE),v8)
263 # Include WTF source file.
264 d := Source/JavaScriptCore
265 LOCAL_PATH := $(BASE_PATH)/$d
266 intermediates := $(base_intermediates)/$d
267 include $(LOCAL_PATH)/Android.v8.wtf.mk
268 WEBKIT_SRC_FILES += $(addprefix $d/,$(LOCAL_SRC_FILES))
269 endif # JAVASCRIPT_ENGINE == v8
271 # Include source files for WebCore
273 LOCAL_PATH := $(BASE_PATH)/$d
274 intermediates := $(base_intermediates)/$d
275 include $(LOCAL_PATH)/Android.mk
276 ifeq ($(JAVASCRIPT_ENGINE),jsc)
277 include $(LOCAL_PATH)/Android.jscbindings.mk
279 ifeq ($(JAVASCRIPT_ENGINE),v8)
280 include $(LOCAL_PATH)/Android.v8bindings.mk
282 WEBKIT_SRC_FILES += $(addprefix $d/,$(LOCAL_SRC_FILES))
283 LOCAL_C_INCLUDES += $(BINDING_C_INCLUDES)
285 # Include the derived source files for WebCore. Uses the same path as
287 include $(LOCAL_PATH)/Android.derived.mk
288 ifeq ($(JAVASCRIPT_ENGINE),jsc)
289 include $(LOCAL_PATH)/Android.derived.jscbindings.mk
291 ifeq ($(JAVASCRIPT_ENGINE),v8)
292 include $(LOCAL_PATH)/Android.derived.v8bindings.mk
295 # Include source files for android WebKit port
297 LOCAL_PATH := $(BASE_PATH)/$d
298 intermediates := $(base_intermediates)/$d
299 include $(LOCAL_PATH)/Android.mk
300 WEBKIT_SRC_FILES += $(addprefix $d/,$(LOCAL_SRC_FILES))
302 # Redefine LOCAL_PATH here so the build system is not confused
303 LOCAL_PATH := $(BASE_PATH)
305 # Define our compiler flags
306 LOCAL_CFLAGS += -Wno-endif-labels -Wno-import -Wno-format
307 LOCAL_CFLAGS += -fno-strict-aliasing
308 LOCAL_CFLAGS += -include "WebCorePrefix.h"
309 LOCAL_CFLAGS += -fvisibility=hidden
310 LOCAL_CFLAGS += -DALWAYS_INLINE=inline
311 # Make sure assert.h is included before assert is defined
312 LOCAL_CFLAGS += -include "assert.h"
313 ifeq ($(HTTP_STACK),chrome)
314 LOCAL_CFLAGS += -DGOOGLEURL
315 LOCAL_CFLAGS += -DWTF_USE_CHROME_NETWORK_STACK
316 endif # HTTP_STACK == chrome
317 LOCAL_CPPFLAGS := -Wno-sign-promo
319 # Adds GL and EGL extensions for the GL backend
320 LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES -DEGL_EGLEXT_PROTOTYPES
322 # Enable JSC JIT if JSC is used and ENABLE_JSC_JIT environment
323 # variable is set to true
324 ifeq ($(JAVASCRIPT_ENGINE),jsc)
325 ifeq ($(ENABLE_JSC_JIT),true)
326 LOCAL_CFLAGS += -DENABLE_ANDROID_JSC_JIT=1
330 ifeq ($(TARGET_ARCH),arm)
331 LOCAL_CFLAGS += -Darm
332 # remove this warning: "note: the mangling of 'va_list' has changed in GCC 4.4"
333 LOCAL_CFLAGS += -Wno-psabi
336 # need a flag to tell the C side when we're on devices with large memory
337 # budgets (i.e. larger than the low-end devices that initially shipped)
338 ifeq ($(ARCH_ARM_HAVE_VFP),true)
339 LOCAL_CFLAGS += -DANDROID_LARGE_MEMORY_DEVICE
342 ifeq ($(ENABLE_SVG),true)
343 LOCAL_CFLAGS += -DENABLE_SVG=1 -DENABLE_SVG_ANIMATION=1
346 ifeq ($(ENABLE_WTF_USE_ACCELERATED_COMPOSITING),false)
347 LOCAL_CFLAGS += -DWTF_USE_ACCELERATED_COMPOSITING=0
350 ifeq ($(ENABLE_WTF_USE_ACCELERATED_COMPOSITING),true)
351 LOCAL_CFLAGS += -DWTF_USE_ACCELERATED_COMPOSITING=1
354 ifeq ($(WEBCORE_INSTRUMENTATION),true)
355 LOCAL_CFLAGS += -DANDROID_INSTRUMENT
358 # LOCAL_LDLIBS is used in simulator builds only and simulator builds are only
360 LOCAL_LDLIBS += -lpthread -ldl
362 # Build the list of shared libraries
363 LOCAL_SHARED_LIBRARIES := \
374 libsurfaceflinger_client \
379 ifeq ($(WEBCORE_INSTRUMENTATION),true)
380 LOCAL_SHARED_LIBRARIES += libhardware_legacy
383 # We have to use the android version of libdl when we are not on the simulator
384 ifneq ($(TARGET_SIMULATOR),true)
385 LOCAL_SHARED_LIBRARIES += libdl libstlport
386 # We have to fake out some headers when using stlport.
387 LOCAL_C_INCLUDES += \
388 external/chromium/android
389 include external/stlport/libstlport.mk
392 # We need Harfbuzz library to support complex scripts(Arabic, Thai, Hindi...).
393 ifeq ($(SUPPORT_COMPLEX_SCRIPTS),true)
394 LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \
395 external/harfbuzz/src \
396 external/harfbuzz/contrib
397 LOCAL_SHARED_LIBRARIES += libharfbuzz
398 LOCAL_CFLAGS += -DSUPPORT_COMPLEX_SCRIPTS=1
401 # Build the list of static libraries
402 LOCAL_STATIC_LIBRARIES := libxml2 libxslt libhyphenation
403 ifeq ($(JAVASCRIPT_ENGINE),v8)
404 LOCAL_STATIC_LIBRARIES += libv8
407 ifeq ($(HTTP_STACK),chrome)
408 LOCAL_STATIC_LIBRARIES += libchromium_net
409 LOCAL_SHARED_LIBRARIES += libcrypto libssl libz
410 endif # HTTP_STACK == chrome
412 ifeq ($(ENABLE_AUTOFILL),true)
413 LOCAL_SHARED_LIBRARIES += libexpat
416 # Redefine LOCAL_SRC_FILES to be all the WebKit source files
417 LOCAL_SRC_FILES := $(WEBKIT_SRC_FILES)
419 # Define this for use in other makefiles.
420 WEBKIT_C_INCLUDES := $(LOCAL_C_INCLUDES)
421 WEBKIT_CFLAGS := $(LOCAL_CFLAGS)
422 WEBKIT_CPPFLAGS := $(LOCAL_CPPFLAGS)
423 WEBKIT_GENERATED_SOURCES := $(LOCAL_GENERATED_SOURCES)
424 WEBKIT_LDLIBS := $(LOCAL_LDLIBS)
425 WEBKIT_SHARED_LIBRARIES := $(LOCAL_SHARED_LIBRARIES)
426 WEBKIT_STATIC_LIBRARIES := $(LOCAL_STATIC_LIBRARIES)
428 # Build the library all at once
429 include $(BUILD_STATIC_LIBRARY)
431 ifeq ($(JAVASCRIPT_ENGINE),jsc)
432 # Now build libjs as a static library.
433 include $(CLEAR_VARS)
434 LOCAL_MODULE := libjs
435 LOCAL_LDLIBS := $(WEBKIT_LDLIBS)
436 LOCAL_SHARED_LIBRARIES := $(WEBKIT_SHARED_LIBRARIES)
437 LOCAL_STATIC_LIBRARIES := $(WEBKIT_STATIC_LIBRARIES)
438 LOCAL_CFLAGS := $(WEBKIT_CFLAGS)
439 # Include source files for JavaScriptCore
440 d := Source/JavaScriptCore
441 LOCAL_PATH := $(BASE_PATH)/$d
442 LOCAL_MODULE_CLASS := STATIC_LIBRARIES
443 # Cannot use base_intermediates as this is a new module
444 intermediates := $(call local-intermediates-dir)
445 include $(LOCAL_PATH)/Android.mk
446 # Redefine LOCAL_SRC_FILES with the correct prefix
447 LOCAL_SRC_FILES := $(addprefix $d/,$(LOCAL_SRC_FILES))
448 # Use the base path to resolve file names
449 LOCAL_PATH := $(BASE_PATH)
450 # Append jsc intermediate include paths to the WebKit include list.
451 LOCAL_C_INCLUDES := $(WEBKIT_C_INCLUDES) \
453 $(intermediates)/parser \
454 $(intermediates)/runtime \
456 include $(BUILD_STATIC_LIBRARY)
457 endif # JAVASCRIPT_ENGINE == jsc
459 # Now build the shared library using only the exported jni entry point. This
460 # will strip out any unused code from the entry point.
461 include $(CLEAR_VARS)
462 # if you need to make webcore huge (for debugging), enable this line
463 LOCAL_MODULE := libwebcore
464 LOCAL_LDLIBS := $(WEBKIT_LDLIBS)
465 LOCAL_SHARED_LIBRARIES := $(WEBKIT_SHARED_LIBRARIES)
466 LOCAL_STATIC_LIBRARIES := libwebcore $(WEBKIT_STATIC_LIBRARIES)
467 ifeq ($(JAVASCRIPT_ENGINE),jsc)
468 LOCAL_STATIC_LIBRARIES += libjs
470 LOCAL_LDFLAGS := -fvisibility=hidden
471 LOCAL_CFLAGS := $(WEBKIT_CFLAGS)
472 LOCAL_CPPFLAGS := $(WEBKIT_CPPFLAGS)
473 LOCAL_C_INCLUDES := $(WEBKIT_C_INCLUDES)
474 LOCAL_PATH := $(BASE_PATH)
476 Source/WebKit/android/jni/WebCoreJniOnLoad.cpp
478 ifeq ($(ENABLE_AUTOFILL),true)
479 # AutoFill requires some cpp files from Chromium to link with
480 # libchromium_net. We cannot compile them into libchromium_net
481 # because they have cpp file extensions, not .cc.
482 LOCAL_CFLAGS += -DWEBKIT_IMPLEMENTATION=1
484 Source/WebKit/android/WebCoreSupport/autofill/MainThreadProxy.cpp \
485 Source/WebKit/chromium/src/WebCString.cpp \
486 Source/WebKit/chromium/src/WebRegularExpression.cpp \
487 Source/WebKit/chromium/src/WebString.cpp
490 # Do this dependency by hand. The reason we have to do this is because the
491 # headers that this file pulls in are generated during the build of webcore.
492 # We make all of our object files depend on those files so that they are built
493 # before we try to compile the file.
494 LOCAL_ADDITIONAL_DEPENDENCIES := $(filter %.h, $(WEBKIT_GENERATED_SOURCES))
495 include $(BUILD_SHARED_LIBRARY)
497 # Build the wds client
498 include $(WEBKIT_PATH)/android/wds/client/Android.mk
500 # Build the performance command line tool.
501 include $(WEBKIT_PATH)/android/benchmark/Android.mk
503 # Build the webkit merge tool.
504 include $(BASE_PATH)/Tools/android/webkitmerge/Android.mk