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# Control SVG compiling in webkit. 27# Default is true unless explictly disabled. 28ifneq ($(ENABLE_SVG),false) 29 ENABLE_SVG = true 30endif 31 32# Control complex scripts support compiling in webkit. 33# Default is true unless explictly disabled. 34ifneq ($(SUPPORT_COMPLEX_SCRIPTS),false) 35 SUPPORT_COMPLEX_SCRIPTS = true 36endif 37 38# Read the environment variable to determine if Autofill is compiled. 39# The default is on. 40# is turned on. 41ifneq ($(ENABLE_AUTOFILL),false) 42 ENABLE_AUTOFILL = true 43endif 44 45BASE_PATH := $(call my-dir) 46include $(CLEAR_VARS) 47 48# Define our module and find the intermediates directory 49LOCAL_MODULE := libwebcore 50LOCAL_MODULE_CLASS := STATIC_LIBRARIES 51base_intermediates := $(call local-intermediates-dir) 52 53# Using := here prevents recursive expansion 54WEBKIT_SRC_FILES := 55 56# We have to use bison 2.3 57include $(BASE_PATH)/bison_check.mk 58 59SOURCE_PATH := $(BASE_PATH)/Source 60WEBCORE_PATH := $(SOURCE_PATH)/WebCore 61JAVASCRIPTCORE_PATH := $(SOURCE_PATH)/JavaScriptCore 62WEBKIT_PATH := $(SOURCE_PATH)/WebKit 63WEBCORE_INTERMEDIATES_PATH := $(base_intermediates)/Source/WebCore 64 65# Build our list of include paths. We include Source/WebKit/android/icu first so that 66# any files that include <unicode/ucnv.h> will include our ucnv.h first. We 67# also add external/ as an include directory so that we can specify the real 68# icu header directory as a more exact reference to avoid including our ucnv.h. 69# 70# Note that JavasCriptCore/ must be included after WebCore/, so that we pick up 71# the right config.h. 72LOCAL_C_INCLUDES := \ 73 $(JNI_H_INCLUDE) \ 74 $(WEBKIT_PATH)/android/icu \ 75 external/ \ 76 external/icu4c/common \ 77 external/icu4c/i18n \ 78 external/jpeg \ 79 external/libxml2/include \ 80 external/libxslt \ 81 external/hyphenation \ 82 external/skia/emoji \ 83 external/skia/gpu/include \ 84 external/skia/include/core \ 85 external/skia/include/effects \ 86 external/skia/include/gpu \ 87 external/skia/include/images \ 88 external/skia/include/ports \ 89 external/skia/include/utils \ 90 external/skia/src/ports \ 91 external/sqlite/dist \ 92 frameworks/base/core/jni/android/graphics \ 93 frameworks/base/include 94 95# Add Source/ for the include of <JavaScriptCore/config.h> from WebCore/config.h 96LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \ 97 $(SOURCE_PATH) 98 99LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \ 100 $(WEBCORE_PATH) \ 101 $(WEBCORE_PATH)/accessibility \ 102 $(WEBCORE_PATH)/bindings/ \ 103 $(WEBCORE_PATH)/bindings/generic \ 104 $(WEBCORE_PATH)/css \ 105 $(WEBCORE_PATH)/dom \ 106 $(WEBCORE_PATH)/editing \ 107 $(WEBCORE_PATH)/fileapi \ 108 $(WEBCORE_PATH)/history \ 109 $(WEBCORE_PATH)/history/android \ 110 $(WEBCORE_PATH)/html \ 111 $(WEBCORE_PATH)/html/canvas \ 112 $(WEBCORE_PATH)/html/parser \ 113 $(WEBCORE_PATH)/html/shadow \ 114 $(WEBCORE_PATH)/inspector \ 115 $(WEBCORE_PATH)/loader \ 116 $(WEBCORE_PATH)/loader/appcache \ 117 $(WEBCORE_PATH)/loader/archive \ 118 $(WEBCORE_PATH)/loader/archive/android \ 119 $(WEBCORE_PATH)/loader/cache \ 120 $(WEBCORE_PATH)/loader/icon \ 121 $(WEBCORE_PATH)/notifications \ 122 $(WEBCORE_PATH)/page \ 123 $(WEBCORE_PATH)/page/android \ 124 $(WEBCORE_PATH)/page/animation \ 125 $(WEBCORE_PATH)/platform \ 126 $(WEBCORE_PATH)/platform/android \ 127 $(WEBCORE_PATH)/platform/animation \ 128 $(WEBCORE_PATH)/platform/graphics \ 129 $(WEBCORE_PATH)/platform/graphics/android \ 130 $(WEBCORE_PATH)/platform/graphics/android/context \ 131 $(WEBCORE_PATH)/platform/graphics/android/fonts \ 132 $(WEBCORE_PATH)/platform/graphics/android/layers \ 133 $(WEBCORE_PATH)/platform/graphics/android/rendering \ 134 $(WEBCORE_PATH)/platform/graphics/android/utils \ 135 $(WEBCORE_PATH)/platform/graphics/filters \ 136 $(WEBCORE_PATH)/platform/graphics/gpu \ 137 $(WEBCORE_PATH)/platform/graphics/network \ 138 $(WEBCORE_PATH)/platform/graphics/skia \ 139 $(WEBCORE_PATH)/platform/graphics/transforms \ 140 $(WEBCORE_PATH)/platform/image-decoders \ 141 $(WEBCORE_PATH)/platform/image-decoders/bmp \ 142 $(WEBCORE_PATH)/platform/image-decoders/gif \ 143 $(WEBCORE_PATH)/platform/image-decoders/ico \ 144 $(WEBCORE_PATH)/platform/image-decoders/jpeg \ 145 $(WEBCORE_PATH)/platform/image-decoders/png \ 146 $(WEBCORE_PATH)/platform/image-decoders/webp \ 147 $(WEBCORE_PATH)/platform/mock \ 148 $(WEBCORE_PATH)/platform/network \ 149 $(WEBCORE_PATH)/platform/network/android \ 150 $(WEBCORE_PATH)/platform/sql \ 151 $(WEBCORE_PATH)/platform/text \ 152 $(WEBCORE_PATH)/platform/text/transcoder \ 153 $(WEBCORE_PATH)/plugins \ 154 $(WEBCORE_PATH)/plugins/android \ 155 $(WEBCORE_PATH)/rendering \ 156 $(WEBCORE_PATH)/rendering/style \ 157 $(WEBCORE_PATH)/rendering/svg \ 158 $(WEBCORE_PATH)/storage \ 159 $(WEBCORE_PATH)/svg \ 160 $(WEBCORE_PATH)/svg/animation \ 161 $(WEBCORE_PATH)/svg/graphics \ 162 $(WEBCORE_PATH)/svg/graphics/filters \ 163 $(WEBCORE_PATH)/svg/properties \ 164 $(WEBCORE_PATH)/websockets \ 165 $(WEBCORE_PATH)/workers \ 166 $(WEBCORE_PATH)/xml 167 168LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \ 169 $(WEBKIT_PATH)/android \ 170 $(WEBKIT_PATH)/android/WebCoreSupport \ 171 $(WEBKIT_PATH)/android/jni \ 172 $(WEBKIT_PATH)/android/nav \ 173 $(WEBKIT_PATH)/android/plugins 174 175LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \ 176 $(JAVASCRIPTCORE_PATH) \ 177 $(JAVASCRIPTCORE_PATH)/collector/handles \ 178 $(JAVASCRIPTCORE_PATH)/heap \ 179 $(JAVASCRIPTCORE_PATH)/wtf \ 180 $(JAVASCRIPTCORE_PATH)/wtf/unicode \ 181 $(JAVASCRIPTCORE_PATH)/wtf/unicode/icu 182 183LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \ 184 $(WEBCORE_INTERMEDIATES_PATH) \ 185 $(WEBCORE_INTERMEDIATES_PATH)/css \ 186 $(WEBCORE_INTERMEDIATES_PATH)/html \ 187 $(WEBCORE_INTERMEDIATES_PATH)/platform \ 188 $(WEBCORE_INTERMEDIATES_PATH)/xml 189 190# The following includes are needed by the AutoFill feature, or the chrome http 191# stack 192LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \ 193 $(WEBKIT_PATH)/chromium \ 194 $(WEBKIT_PATH)/chromium/public \ 195 external/chromium/chrome/browser \ 196 external/chromium/chrome/renderer \ 197 external/chromium \ 198 external/chromium/chrome \ 199 external/skia 200 201LOCAL_CFLAGS += -DWEBKIT_IMPLEMENTATION=1 202 203# Include WTF source file. 204d := Source/JavaScriptCore 205LOCAL_PATH := $(BASE_PATH)/$d 206intermediates := $(base_intermediates)/$d 207include $(LOCAL_PATH)/Android.v8.wtf.mk 208WEBKIT_SRC_FILES += $(addprefix $d/,$(LOCAL_SRC_FILES)) 209 210# Include source files for WebCore 211d := Source/WebCore 212LOCAL_PATH := $(BASE_PATH)/$d 213intermediates := $(base_intermediates)/$d 214include $(LOCAL_PATH)/Android.mk 215include $(LOCAL_PATH)/Android.v8bindings.mk 216WEBKIT_SRC_FILES += $(addprefix $d/,$(LOCAL_SRC_FILES)) 217LOCAL_C_INCLUDES += $(BINDING_C_INCLUDES) 218 219# Include the derived source files for WebCore. Uses the same path as 220# WebCore 221include $(LOCAL_PATH)/Android.derived.mk 222include $(LOCAL_PATH)/Android.derived.v8bindings.mk 223 224# Include source files for android WebKit port 225d := Source/WebKit 226LOCAL_PATH := $(BASE_PATH)/$d 227intermediates := $(base_intermediates)/$d 228include $(LOCAL_PATH)/Android.mk 229WEBKIT_SRC_FILES += $(addprefix $d/,$(LOCAL_SRC_FILES)) 230 231# Redefine LOCAL_PATH here so the build system is not confused 232LOCAL_PATH := $(BASE_PATH) 233 234# Define our compiler flags 235LOCAL_CFLAGS += -Wno-endif-labels -Wno-import -Wno-format 236LOCAL_CFLAGS += -fno-strict-aliasing 237LOCAL_CFLAGS += -include "WebCorePrefix.h" 238LOCAL_CFLAGS += -fvisibility=hidden 239LOCAL_CFLAGS += -DALWAYS_INLINE=inline 240# Make sure assert.h is included before assert is defined 241LOCAL_CFLAGS += -include "assert.h" 242LOCAL_CFLAGS += -DGOOGLEURL 243LOCAL_CPPFLAGS := -Wno-sign-promo 244LOCAL_CPPFLAGS := -Wno-c++0x-compat 245 246# Adds GL and EGL extensions for the GL backend 247LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES -DEGL_EGLEXT_PROTOTYPES 248 249ifeq ($(TARGET_ARCH),arm) 250LOCAL_CFLAGS += -Darm 251# remove this warning: "note: the mangling of 'va_list' has changed in GCC 4.4" 252LOCAL_CFLAGS += -Wno-psabi 253endif 254 255ifeq ($(TARGET_ARCH_VARIANT),x86-atom) 256LOCAL_CFLAGS += -fno-pic 257endif 258 259# need a flag to tell the C side when we're on devices with large memory 260# budgets (i.e. larger than the low-end devices that initially shipped) 261ifeq ($(ARCH_ARM_HAVE_VFP),true) 262LOCAL_CFLAGS += -DANDROID_LARGE_MEMORY_DEVICE 263endif 264 265ifeq ($(TARGET_ARCH),x86) 266LOCAL_CFLAGS += -DANDROID_LARGE_MEMORY_DEVICE 267endif 268 269ifeq ($(ENABLE_SVG),true) 270LOCAL_CFLAGS += -DENABLE_SVG=1 -DENABLE_SVG_ANIMATION=1 271endif 272 273ifeq ($(ENABLE_WTF_USE_ACCELERATED_COMPOSITING),false) 274LOCAL_CFLAGS += -DWTF_USE_ACCELERATED_COMPOSITING=0 275endif 276 277ifeq ($(ENABLE_WTF_USE_ACCELERATED_COMPOSITING),true) 278LOCAL_CFLAGS += -DWTF_USE_ACCELERATED_COMPOSITING=1 279endif 280 281# LOCAL_LDLIBS is used in simulator builds only and simulator builds are only 282# valid on Linux 283LOCAL_LDLIBS += -lpthread -ldl 284 285# Build the list of shared libraries 286# We have to use the android version of libdl 287LOCAL_SHARED_LIBRARIES := \ 288 libEGL \ 289 libGLESv2 \ 290 libandroid \ 291 libandroidfw \ 292 libandroid_runtime \ 293 libchromium_net \ 294 libcrypto \ 295 libcutils \ 296 libdl \ 297 libgui \ 298 libicuuc \ 299 libicui18n \ 300 libmedia \ 301 libmedia_native \ 302 libnativehelper \ 303 libskia \ 304 libsqlite \ 305 libssl \ 306 libstlport \ 307 libutils \ 308 libui \ 309 libz 310 311# We have to fake out some headers when using stlport. 312LOCAL_C_INCLUDES += \ 313 external/chromium/android 314include external/stlport/libstlport.mk 315 316# We need Harfbuzz library to support complex scripts(Arabic, Thai, Hindi...). 317ifeq ($(SUPPORT_COMPLEX_SCRIPTS),true) 318LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \ 319 external/harfbuzz/src \ 320 external/harfbuzz/contrib 321LOCAL_SHARED_LIBRARIES += libharfbuzz 322LOCAL_CFLAGS += -DSUPPORT_COMPLEX_SCRIPTS=1 323endif 324 325# Build the list of static libraries 326LOCAL_STATIC_LIBRARIES := libxml2 libxslt libhyphenation libskiagpu libv8 327 328ifeq ($(ENABLE_AUTOFILL),true) 329LOCAL_SHARED_LIBRARIES += libexpat 330endif 331 332# Redefine LOCAL_SRC_FILES to be all the WebKit source files 333LOCAL_SRC_FILES := $(WEBKIT_SRC_FILES) 334 335# Define this for use in other makefiles. 336WEBKIT_C_INCLUDES := $(LOCAL_C_INCLUDES) 337WEBKIT_CFLAGS := $(LOCAL_CFLAGS) 338WEBKIT_CPPFLAGS := $(LOCAL_CPPFLAGS) 339WEBKIT_GENERATED_SOURCES := $(LOCAL_GENERATED_SOURCES) 340WEBKIT_LDLIBS := $(LOCAL_LDLIBS) 341WEBKIT_SHARED_LIBRARIES := $(LOCAL_SHARED_LIBRARIES) 342WEBKIT_STATIC_LIBRARIES := $(LOCAL_STATIC_LIBRARIES) 343 344ifneq ($(strip $(WITH_ADDRESS_SANITIZER)),) 345 LOCAL_MODULE_PATH := $(TARGET_OUT_STATIC_LIBRARIES)/asan 346 LOCAL_ADDRESS_SANITIZER := true 347endif 348 349# Build the library all at once 350include $(BUILD_STATIC_LIBRARY) 351 352# Now build the shared library using only the exported jni entry point. This 353# will strip out any unused code from the entry point. 354include $(CLEAR_VARS) 355# Do not attempt prelink this library. Needed to keep master-gpl happy, no 356# effect in master. 357# TODO: remove this when master-gpl is updated. 358LOCAL_PRELINK_MODULE := false 359LOCAL_MODULE := libwebcore 360LOCAL_LDLIBS := $(WEBKIT_LDLIBS) 361LOCAL_SHARED_LIBRARIES := $(WEBKIT_SHARED_LIBRARIES) 362LOCAL_STATIC_LIBRARIES := libwebcore $(WEBKIT_STATIC_LIBRARIES) 363LOCAL_LDFLAGS := -fvisibility=hidden 364LOCAL_CFLAGS := $(WEBKIT_CFLAGS) 365LOCAL_CPPFLAGS := $(WEBKIT_CPPFLAGS) 366LOCAL_C_INCLUDES := $(WEBKIT_C_INCLUDES) 367LOCAL_PATH := $(BASE_PATH) 368LOCAL_SRC_FILES := \ 369 Source/WebKit/android/jni/WebCoreJniOnLoad.cpp \ 370 Source/WebKit/chromium/src/android/WebDOMTextContentWalker.cpp \ 371 Source/WebKit/chromium/src/android/WebHitTestInfo.cpp \ 372 Source/WebKit/chromium/src/WebRange.cpp \ 373 Source/WebKit/chromium/src/WebString.cpp 374 375ifeq ($(ENABLE_AUTOFILL),true) 376# AutoFill requires some cpp files from Chromium to link with 377# libchromium_net. We cannot compile them into libchromium_net 378# because they have cpp file extensions, not .cc. 379LOCAL_SRC_FILES += \ 380 Source/WebKit/android/WebCoreSupport/autofill/MainThreadProxy.cpp \ 381 Source/WebKit/chromium/src/WebCString.cpp \ 382 Source/WebKit/chromium/src/WebRegularExpression.cpp 383endif 384 385# Do this dependency by hand. The reason we have to do this is because the 386# headers that this file pulls in are generated during the build of webcore. 387# We make all of our object files depend on those files so that they are built 388# before we try to compile the file. 389LOCAL_ADDITIONAL_DEPENDENCIES := $(filter %.h, $(WEBKIT_GENERATED_SOURCES)) 390 391ifneq ($(strip $(WITH_ADDRESS_SANITIZER)),) 392 LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/asan 393 LOCAL_ADDRESS_SANITIZER := true 394endif 395 396include $(BUILD_SHARED_LIBRARY) 397 398# Build the wds client 399include $(WEBKIT_PATH)/android/wds/client/Android.mk 400 401# Build the webkit merge tool. 402include $(BASE_PATH)/Tools/android/webkitmerge/Android.mk 403