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. 28 ifneq ($(ENABLE_SVG),false) 29 ENABLE_SVG = true 30 endif 31 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 36 endif 37 38 # Read the environment variable to determine if Autofill is compiled. 39 # The default is on. 40 # is turned on. 41 ifneq ($(ENABLE_AUTOFILL),false) 42 ENABLE_AUTOFILL = true 43 endif 44 45 BASE_PATH := $(call my-dir) 46 include $(CLEAR_VARS) 47 48 # Define our module and find the intermediates directory 49 LOCAL_MODULE := libwebcore 50 LOCAL_MODULE_CLASS := STATIC_LIBRARIES 51 base_intermediates := $(call local-intermediates-dir) 52 53 # Using := here prevents recursive expansion 54 WEBKIT_SRC_FILES := 55 56 # We have to use bison 2.3 57 include $(BASE_PATH)/bison_check.mk 58 59 SOURCE_PATH := $(BASE_PATH)/Source 60 WEBCORE_PATH := $(SOURCE_PATH)/WebCore 61 JAVASCRIPTCORE_PATH := $(SOURCE_PATH)/JavaScriptCore 62 WEBKIT_PATH := $(SOURCE_PATH)/WebKit 63 WEBCORE_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. 72 LOCAL_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 96 LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \ 97 $(SOURCE_PATH) 98 99 LOCAL_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 168 LOCAL_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 175 LOCAL_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 183 LOCAL_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 192 LOCAL_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 201 LOCAL_CFLAGS += -DWEBKIT_IMPLEMENTATION=1 202 203 # Include WTF source file. 204 d := Source/JavaScriptCore 205 LOCAL_PATH := $(BASE_PATH)/$d 206 intermediates := $(base_intermediates)/$d 207 include $(LOCAL_PATH)/Android.v8.wtf.mk 208 WEBKIT_SRC_FILES += $(addprefix $d/,$(LOCAL_SRC_FILES)) 209 210 # Include source files for WebCore 211 d := Source/WebCore 212 LOCAL_PATH := $(BASE_PATH)/$d 213 intermediates := $(base_intermediates)/$d 214 include $(LOCAL_PATH)/Android.mk 215 include $(LOCAL_PATH)/Android.v8bindings.mk 216 WEBKIT_SRC_FILES += $(addprefix $d/,$(LOCAL_SRC_FILES)) 217 LOCAL_C_INCLUDES += $(BINDING_C_INCLUDES) 218 219 # Include the derived source files for WebCore. Uses the same path as 220 # WebCore 221 include $(LOCAL_PATH)/Android.derived.mk 222 include $(LOCAL_PATH)/Android.derived.v8bindings.mk 223 224 # Include source files for android WebKit port 225 d := Source/WebKit 226 LOCAL_PATH := $(BASE_PATH)/$d 227 intermediates := $(base_intermediates)/$d 228 include $(LOCAL_PATH)/Android.mk 229 WEBKIT_SRC_FILES += $(addprefix $d/,$(LOCAL_SRC_FILES)) 230 231 # Redefine LOCAL_PATH here so the build system is not confused 232 LOCAL_PATH := $(BASE_PATH) 233 234 # Define our compiler flags 235 LOCAL_CFLAGS += -Wno-endif-labels -Wno-import -Wno-format 236 LOCAL_CFLAGS += -fno-strict-aliasing 237 LOCAL_CFLAGS += -include "WebCorePrefix.h" 238 LOCAL_CFLAGS += -fvisibility=hidden 239 LOCAL_CFLAGS += -DALWAYS_INLINE=inline 240 # Make sure assert.h is included before assert is defined 241 LOCAL_CFLAGS += -include "assert.h" 242 LOCAL_CFLAGS += -DGOOGLEURL 243 LOCAL_CPPFLAGS := -Wno-sign-promo 244 LOCAL_CPPFLAGS := -Wno-c++0x-compat 245 246 # Adds GL and EGL extensions for the GL backend 247 LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES -DEGL_EGLEXT_PROTOTYPES 248 249 ifeq ($(TARGET_ARCH),arm) 250 LOCAL_CFLAGS += -Darm 251 # remove this warning: "note: the mangling of 'va_list' has changed in GCC 4.4" 252 LOCAL_CFLAGS += -Wno-psabi 253 endif 254 255 # need a flag to tell the C side when we're on devices with large memory 256 # budgets (i.e. larger than the low-end devices that initially shipped) 257 ifeq ($(ARCH_ARM_HAVE_VFP),true) 258 LOCAL_CFLAGS += -DANDROID_LARGE_MEMORY_DEVICE 259 endif 260 261 ifeq ($(ENABLE_SVG),true) 262 LOCAL_CFLAGS += -DENABLE_SVG=1 -DENABLE_SVG_ANIMATION=1 263 endif 264 265 ifeq ($(ENABLE_WTF_USE_ACCELERATED_COMPOSITING),false) 266 LOCAL_CFLAGS += -DWTF_USE_ACCELERATED_COMPOSITING=0 267 endif 268 269 ifeq ($(ENABLE_WTF_USE_ACCELERATED_COMPOSITING),true) 270 LOCAL_CFLAGS += -DWTF_USE_ACCELERATED_COMPOSITING=1 271 endif 272 273 # LOCAL_LDLIBS is used in simulator builds only and simulator builds are only 274 # valid on Linux 275 LOCAL_LDLIBS += -lpthread -ldl 276 277 # Build the list of shared libraries 278 # We have to use the android version of libdl 279 LOCAL_SHARED_LIBRARIES := \ 280 libEGL \ 281 libGLESv2 \ 282 libandroid \ 283 libandroidfw \ 284 libandroid_runtime \ 285 libchromium_net \ 286 libcrypto \ 287 libcutils \ 288 libdl \ 289 libgui \ 290 libicuuc \ 291 libicui18n \ 292 libmedia \ 293 libmedia_native \ 294 libnativehelper \ 295 libskia \ 296 libsqlite \ 297 libssl \ 298 libstlport \ 299 libutils \ 300 libui \ 301 libz 302 303 # We have to fake out some headers when using stlport. 304 LOCAL_C_INCLUDES += \ 305 external/chromium/android 306 include external/stlport/libstlport.mk 307 308 # We need Harfbuzz library to support complex scripts(Arabic, Thai, Hindi...). 309 ifeq ($(SUPPORT_COMPLEX_SCRIPTS),true) 310 LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \ 311 external/harfbuzz/src \ 312 external/harfbuzz/contrib 313 LOCAL_SHARED_LIBRARIES += libharfbuzz 314 LOCAL_CFLAGS += -DSUPPORT_COMPLEX_SCRIPTS=1 315 endif 316 317 # Build the list of static libraries 318 LOCAL_STATIC_LIBRARIES := libxml2 libxslt libhyphenation libskiagpu libv8 319 320 ifeq ($(ENABLE_AUTOFILL),true) 321 LOCAL_SHARED_LIBRARIES += libexpat 322 endif 323 324 # Redefine LOCAL_SRC_FILES to be all the WebKit source files 325 LOCAL_SRC_FILES := $(WEBKIT_SRC_FILES) 326 327 # Define this for use in other makefiles. 328 WEBKIT_C_INCLUDES := $(LOCAL_C_INCLUDES) 329 WEBKIT_CFLAGS := $(LOCAL_CFLAGS) 330 WEBKIT_CPPFLAGS := $(LOCAL_CPPFLAGS) 331 WEBKIT_GENERATED_SOURCES := $(LOCAL_GENERATED_SOURCES) 332 WEBKIT_LDLIBS := $(LOCAL_LDLIBS) 333 WEBKIT_SHARED_LIBRARIES := $(LOCAL_SHARED_LIBRARIES) 334 WEBKIT_STATIC_LIBRARIES := $(LOCAL_STATIC_LIBRARIES) 335 336 # Build the library all at once 337 include $(BUILD_STATIC_LIBRARY) 338 339 # Now build the shared library using only the exported jni entry point. This 340 # will strip out any unused code from the entry point. 341 include $(CLEAR_VARS) 342 # Do not attempt prelink this library. Needed to keep master-gpl happy, no 343 # effect in master. 344 # TODO: remove this when master-gpl is updated. 345 LOCAL_PRELINK_MODULE := false 346 LOCAL_MODULE := libwebcore 347 LOCAL_LDLIBS := $(WEBKIT_LDLIBS) 348 LOCAL_SHARED_LIBRARIES := $(WEBKIT_SHARED_LIBRARIES) 349 LOCAL_STATIC_LIBRARIES := libwebcore $(WEBKIT_STATIC_LIBRARIES) 350 LOCAL_LDFLAGS := -fvisibility=hidden 351 LOCAL_CFLAGS := $(WEBKIT_CFLAGS) 352 LOCAL_CPPFLAGS := $(WEBKIT_CPPFLAGS) 353 LOCAL_C_INCLUDES := $(WEBKIT_C_INCLUDES) 354 LOCAL_PATH := $(BASE_PATH) 355 LOCAL_SRC_FILES := \ 356 Source/WebKit/android/jni/WebCoreJniOnLoad.cpp \ 357 Source/WebKit/chromium/src/android/WebDOMTextContentWalker.cpp \ 358 Source/WebKit/chromium/src/android/WebHitTestInfo.cpp \ 359 Source/WebKit/chromium/src/WebRange.cpp \ 360 Source/WebKit/chromium/src/WebString.cpp 361 362 ifeq ($(ENABLE_AUTOFILL),true) 363 # AutoFill requires some cpp files from Chromium to link with 364 # libchromium_net. We cannot compile them into libchromium_net 365 # because they have cpp file extensions, not .cc. 366 LOCAL_SRC_FILES += \ 367 Source/WebKit/android/WebCoreSupport/autofill/MainThreadProxy.cpp \ 368 Source/WebKit/chromium/src/WebCString.cpp \ 369 Source/WebKit/chromium/src/WebRegularExpression.cpp 370 endif 371 372 # Do this dependency by hand. The reason we have to do this is because the 373 # headers that this file pulls in are generated during the build of webcore. 374 # We make all of our object files depend on those files so that they are built 375 # before we try to compile the file. 376 LOCAL_ADDITIONAL_DEPENDENCIES := $(filter %.h, $(WEBKIT_GENERATED_SOURCES)) 377 include $(BUILD_SHARED_LIBRARY) 378 379 # Build the wds client 380 include $(WEBKIT_PATH)/android/wds/client/Android.mk 381 382 # Build the webkit merge tool. 383 include $(BASE_PATH)/Tools/android/webkitmerge/Android.mk 384