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