Home | History | Annotate | Download | only in webkit
      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 LOCAL_PATH := $(call my-dir)
     27 
     28 # Two ways to control which JS engine is used:
     29 # 1. use JS_ENGINE environment variable, value can be either 'jsc' or 'v8'
     30 #    This is the preferred way.
     31 # 2. if JS_ENGINE is not set, or is not 'jsc' or 'v8', this makefile picks
     32 #    up a default engine to build.
     33 #    To help setup buildbot, a new environment variable, USE_ALT_JS_ENGINE,
     34 #    can be set to true, so that two builds can be different but without
     35 #    specifying which JS engine to use.
     36 
     37 # To enable JIT in Android's JSC, please set ENABLE_JSC_JIT environment
     38 # variable to true.
     39 
     40 # Read JS_ENGINE environment variable
     41 JAVASCRIPT_ENGINE = $(JS_ENGINE)
     42 
     43 # The default / alternative engine depends on the device class.
     44 # On devices with a lot of memory (e.g. Passion/Sholes), the
     45 # default is V8. On everything else, the only choice is JSC.
     46 # TODO: use ARCH_ARM_HAVE_ARMV7 once that variable is added to
     47 # the build system.
     48 ifeq ($(ARCH_ARM_HAVE_VFP),true)
     49     DEFAULT_ENGINE = v8
     50     ALT_ENGINE = jsc
     51 else
     52     DEFAULT_ENGINE = jsc
     53     ALT_ENGINE = jsc
     54 endif
     55 
     56 ifneq ($(JAVASCRIPT_ENGINE),jsc)
     57   ifneq ($(JAVASCRIPT_ENGINE),v8)
     58     # No JS engine is specified, pickup the one we want as default.
     59     ifeq ($(USE_ALT_JS_ENGINE),true)
     60       JAVASCRIPT_ENGINE = $(ALT_ENGINE)
     61     else
     62       JAVASCRIPT_ENGINE = $(DEFAULT_ENGINE)
     63     endif
     64   endif
     65 endif
     66 
     67 BASE_PATH := $(call my-dir)
     68 include $(CLEAR_VARS)
     69 
     70 # Define our module and find the intermediates directory
     71 LOCAL_MODULE := libwebcore
     72 LOCAL_MODULE_CLASS := STATIC_LIBRARIES
     73 base_intermediates := $(call local-intermediates-dir)
     74 
     75 # Using := here prevents recursive expansion
     76 WEBKIT_SRC_FILES :=
     77 
     78 # We have to use bison 2.3
     79 include $(BASE_PATH)/bison_check.mk
     80 
     81 # Build our list of include paths. We include WebKit/android/icu first so that
     82 # any files that include <unicode/ucnv.h> will include our ucnv.h first. We
     83 # also add external/ as an include directory so that we can specify the real
     84 # icu header directory as a more exact reference to avoid including our ucnv.h.
     85 #
     86 # Note that JavasCriptCore/ must be included after WebCore/, so that we pick up
     87 # the right config.h.
     88 LOCAL_C_INCLUDES := \
     89 	$(JNI_H_INCLUDE) \
     90 	$(LOCAL_PATH)/WebKit/android/icu \
     91 	external/ \
     92 	external/icu4c/common \
     93 	external/icu4c/i18n \
     94 	external/libxml2/include \
     95 	external/skia/emoji \
     96 	external/skia/include/core \
     97 	external/skia/include/effects \
     98 	external/skia/include/images \
     99 	external/skia/include/ports \
    100 	external/skia/include/utils \
    101 	external/skia/src/ports \
    102 	external/sqlite/dist \
    103 	frameworks/base/core/jni/android/graphics
    104 
    105 LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \
    106 	$(LOCAL_PATH)/WebCore \
    107 	$(LOCAL_PATH)/WebCore/accessibility \
    108 	$(LOCAL_PATH)/WebCore/bindings/generic \
    109 	$(LOCAL_PATH)/WebCore/css \
    110 	$(LOCAL_PATH)/WebCore/dom \
    111 	$(LOCAL_PATH)/WebCore/editing \
    112 	$(LOCAL_PATH)/WebCore/history \
    113 	$(LOCAL_PATH)/WebCore/history/android \
    114 	$(LOCAL_PATH)/WebCore/html \
    115 	$(LOCAL_PATH)/WebCore/html/canvas \
    116 	$(LOCAL_PATH)/WebCore/inspector \
    117 	$(LOCAL_PATH)/WebCore/loader \
    118 	$(LOCAL_PATH)/WebCore/loader/appcache \
    119 	$(LOCAL_PATH)/WebCore/loader/icon \
    120 	$(LOCAL_PATH)/WebCore/notifications \
    121 	$(LOCAL_PATH)/WebCore/page \
    122 	$(LOCAL_PATH)/WebCore/page/android \
    123 	$(LOCAL_PATH)/WebCore/page/animation \
    124 	$(LOCAL_PATH)/WebCore/platform \
    125 	$(LOCAL_PATH)/WebCore/platform/android \
    126 	$(LOCAL_PATH)/WebCore/platform/animation \
    127 	$(LOCAL_PATH)/WebCore/platform/graphics \
    128 	$(LOCAL_PATH)/WebCore/platform/graphics/android \
    129 	$(LOCAL_PATH)/WebCore/platform/graphics/filters \
    130 	$(LOCAL_PATH)/WebCore/platform/graphics/network \
    131 	$(LOCAL_PATH)/WebCore/platform/graphics/skia \
    132 	$(LOCAL_PATH)/WebCore/platform/graphics/transforms \
    133 	$(LOCAL_PATH)/WebCore/platform/image-decoders \
    134 	$(LOCAL_PATH)/WebCore/platform/image-decoders/bmp \
    135 	$(LOCAL_PATH)/WebCore/platform/image-decoders/gif \
    136 	$(LOCAL_PATH)/WebCore/platform/image-decoders/ico \
    137 	$(LOCAL_PATH)/WebCore/platform/image-decoders/jpeg \
    138 	$(LOCAL_PATH)/WebCore/platform/image-decoders/png \
    139 	$(LOCAL_PATH)/WebCore/platform/mock \
    140 	$(LOCAL_PATH)/WebCore/platform/network \
    141 	$(LOCAL_PATH)/WebCore/platform/network/android \
    142 	$(LOCAL_PATH)/WebCore/platform/sql \
    143 	$(LOCAL_PATH)/WebCore/platform/text \
    144 	$(LOCAL_PATH)/WebCore/plugins \
    145 	$(LOCAL_PATH)/WebCore/plugins/android \
    146 	$(LOCAL_PATH)/WebCore/rendering \
    147 	$(LOCAL_PATH)/WebCore/rendering/style \
    148 	$(LOCAL_PATH)/WebCore/storage \
    149 	$(LOCAL_PATH)/WebCore/svg \
    150 	$(LOCAL_PATH)/WebCore/svg/animation \
    151 	$(LOCAL_PATH)/WebCore/svg/graphics \
    152 	$(LOCAL_PATH)/WebCore/svg/graphics/filters \
    153 	$(LOCAL_PATH)/WebCore/websockets \
    154 	$(LOCAL_PATH)/WebCore/workers \
    155 	$(LOCAL_PATH)/WebCore/xml
    156 
    157 LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \
    158 	$(LOCAL_PATH)/WebKit/android \
    159 	$(LOCAL_PATH)/WebKit/android/WebCoreSupport \
    160 	$(LOCAL_PATH)/WebKit/android/jni \
    161 	$(LOCAL_PATH)/WebKit/android/nav \
    162 	$(LOCAL_PATH)/WebKit/android/plugins
    163 
    164 LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \
    165 	$(LOCAL_PATH)/JavaScriptCore \
    166 	$(LOCAL_PATH)/JavaScriptCore/wtf \
    167 	$(LOCAL_PATH)/JavaScriptCore/wtf/unicode \
    168 	$(LOCAL_PATH)/JavaScriptCore/wtf/unicode/icu
    169 
    170 LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \
    171 	$(base_intermediates)/WebCore/ \
    172 	$(base_intermediates)/WebCore/css \
    173 	$(base_intermediates)/WebCore/html \
    174 	$(base_intermediates)/WebCore/platform
    175 
    176 ifeq ($(JAVASCRIPT_ENGINE),v8)
    177 # Include WTF source file.
    178 d := JavaScriptCore
    179 LOCAL_PATH := $(BASE_PATH)/$d
    180 intermediates := $(base_intermediates)/$d
    181 include $(LOCAL_PATH)/Android.v8.wtf.mk
    182 WEBKIT_SRC_FILES += $(addprefix $d/,$(LOCAL_SRC_FILES))
    183 endif  # JAVASCRIPT_ENGINE == v8
    184 
    185 # Include source files for WebCore
    186 d := WebCore
    187 LOCAL_PATH := $(BASE_PATH)/$d
    188 JAVASCRIPTCORE_PATH := $(BASE_PATH)/JavaScriptCore
    189 intermediates := $(base_intermediates)/$d
    190 include $(LOCAL_PATH)/Android.mk
    191 ifeq ($(JAVASCRIPT_ENGINE),jsc)
    192 include $(LOCAL_PATH)/Android.jscbindings.mk
    193 endif
    194 ifeq ($(JAVASCRIPT_ENGINE),v8)
    195 include $(LOCAL_PATH)/Android.v8bindings.mk
    196 endif
    197 WEBKIT_SRC_FILES += $(addprefix $d/,$(LOCAL_SRC_FILES))
    198 LOCAL_C_INCLUDES += $(BINDING_C_INCLUDES)
    199 
    200 # Include the derived source files for WebCore. Uses the same path as
    201 # WebCore
    202 include $(LOCAL_PATH)/Android.derived.mk
    203 ifeq ($(JAVASCRIPT_ENGINE),jsc)
    204 include $(LOCAL_PATH)/Android.derived.jscbindings.mk
    205 endif
    206 ifeq ($(JAVASCRIPT_ENGINE),v8)
    207 include $(LOCAL_PATH)/Android.derived.v8bindings.mk
    208 endif
    209 
    210 # Include source files for android WebKit port
    211 d := WebKit
    212 LOCAL_PATH := $(BASE_PATH)/$d
    213 intermediates := $(base_intermediates)/$d
    214 include $(LOCAL_PATH)/Android.mk
    215 WEBKIT_SRC_FILES += $(addprefix $d/,$(LOCAL_SRC_FILES))
    216 
    217 # Redefine LOCAL_PATH here so the build system is not confused
    218 LOCAL_PATH := $(BASE_PATH)
    219 
    220 # Define our compiler flags
    221 LOCAL_CFLAGS += -Wno-endif-labels -Wno-import -Wno-format
    222 LOCAL_CFLAGS += -fno-strict-aliasing
    223 LOCAL_CFLAGS += -include "WebCorePrefix.h"
    224 LOCAL_CFLAGS += -fvisibility=hidden
    225 
    226 # Enable JSC JIT if JSC is used and ENABLE_JSC_JIT environment
    227 # variable is set to true
    228 ifeq ($(JAVASCRIPT_ENGINE),jsc)
    229 ifeq ($(ENABLE_JSC_JIT),true)
    230 LOCAL_CFLAGS += -DENABLE_ANDROID_JSC_JIT=1
    231 endif
    232 endif
    233 
    234 ifeq ($(TARGET_ARCH),arm)
    235 LOCAL_CFLAGS += -Darm
    236 # remove this warning: "note: the mangling of 'va_list' has changed in GCC 4.4"
    237 LOCAL_CFLAGS += -Wno-psabi
    238 endif
    239 
    240 # need a flag to tell the C side when we're on devices with large memory
    241 # budgets (i.e. larger than the low-end devices that initially shipped)
    242 ifeq ($(ARCH_ARM_HAVE_VFP),true)
    243 LOCAL_CFLAGS += -DANDROID_LARGE_MEMORY_DEVICE
    244 endif
    245 
    246 ifeq ($(ENABLE_SVG),true)
    247 LOCAL_CFLAGS += -DENABLE_SVG=1
    248 endif
    249 
    250 ifeq ($(ENABLE_WTF_USE_ACCELERATED_COMPOSITING),false)
    251 LOCAL_CFLAGS += -DWTF_USE_ACCELERATED_COMPOSITING=0
    252 endif
    253 
    254 ifeq ($(ENABLE_WTF_USE_ACCELERATED_COMPOSITING),true)
    255 LOCAL_CFLAGS += -DWTF_USE_ACCELERATED_COMPOSITING=1
    256 endif
    257 
    258 # Temporary disable SVG_ANIMATION.
    259 ifeq ($(ENABLE_SVG_ANIMATION),true)
    260 LOCAL_CFLAGS += -DENABLE_SVG_ANIMATION=1
    261 endif
    262 
    263 ifeq ($(WEBCORE_INSTRUMENTATION),true)
    264 LOCAL_CFLAGS += -DANDROID_INSTRUMENT
    265 endif
    266 
    267 # LOCAL_LDLIBS is used in simulator builds only and simulator builds are only
    268 # valid on Linux
    269 LOCAL_LDLIBS += -lpthread -ldl
    270 
    271 # Build the list of shared libraries
    272 LOCAL_SHARED_LIBRARIES := \
    273 	libandroid_runtime \
    274 	libnativehelper \
    275 	libsqlite \
    276 	libskia \
    277 	libutils \
    278 	libui \
    279 	libcutils \
    280 	libicuuc \
    281 	libicudata \
    282 	libicui18n \
    283 	libmedia \
    284 	libsurfaceflinger_client
    285 
    286 ifeq ($(WEBCORE_INSTRUMENTATION),true)
    287 LOCAL_SHARED_LIBRARIES += libhardware_legacy
    288 endif
    289 
    290 # We have to use the android version of libdl when we are not on the simulator
    291 ifneq ($(TARGET_SIMULATOR),true)
    292 LOCAL_SHARED_LIBRARIES += libdl libstlport
    293 include external/stlport/libstlport.mk
    294 endif
    295 
    296 # Build the list of static libraries
    297 LOCAL_STATIC_LIBRARIES := libxml2
    298 ifeq ($(JAVASCRIPT_ENGINE),v8)
    299 LOCAL_STATIC_LIBRARIES += libv8
    300 endif
    301 
    302 # Redefine LOCAL_SRC_FILES to be all the WebKit source files
    303 LOCAL_SRC_FILES := $(WEBKIT_SRC_FILES)
    304 
    305 # Define this for use in other makefiles.
    306 WEBKIT_C_INCLUDES := $(LOCAL_C_INCLUDES)
    307 WEBKIT_CFLAGS := $(LOCAL_CFLAGS)
    308 WEBKIT_GENERATED_SOURCES := $(LOCAL_GENERATED_SOURCES)
    309 WEBKIT_LDLIBS := $(LOCAL_LDLIBS)
    310 WEBKIT_SHARED_LIBRARIES := $(LOCAL_SHARED_LIBRARIES)
    311 WEBKIT_STATIC_LIBRARIES := $(LOCAL_STATIC_LIBRARIES)
    312 
    313 # Build the library all at once
    314 include $(BUILD_STATIC_LIBRARY)
    315 
    316 ifeq ($(JAVASCRIPT_ENGINE),jsc)
    317 # Now build libjs as a static library.
    318 include $(CLEAR_VARS)
    319 LOCAL_MODULE := libjs
    320 LOCAL_LDLIBS := $(WEBKIT_LDLIBS)
    321 LOCAL_SHARED_LIBRARIES := $(WEBKIT_SHARED_LIBRARIES)
    322 LOCAL_STATIC_LIBRARIES := $(WEBKIT_STATIC_LIBRARIES)
    323 LOCAL_CFLAGS := $(WEBKIT_CFLAGS)
    324 # Include source files for JavaScriptCore
    325 d := JavaScriptCore
    326 LOCAL_PATH := $(BASE_PATH)/$d
    327 LOCAL_MODULE_CLASS := STATIC_LIBRARIES
    328 # Cannot use base_intermediates as this is a new module
    329 intermediates := $(call local-intermediates-dir)
    330 include $(LOCAL_PATH)/Android.mk
    331 # Redefine LOCAL_SRC_FILES with the correct prefix
    332 LOCAL_SRC_FILES := $(addprefix $d/,$(LOCAL_SRC_FILES))
    333 # Use the base path to resolve file names
    334 LOCAL_PATH := $(BASE_PATH)
    335 # Append jsc intermediate include paths to the WebKit include list.
    336 LOCAL_C_INCLUDES := $(WEBKIT_C_INCLUDES) \
    337 	$(intermediates) \
    338 	$(intermediates)/parser \
    339 	$(intermediates)/runtime \
    340 # Build libjs
    341 include $(BUILD_STATIC_LIBRARY)
    342 endif  # JAVASCRIPT_ENGINE == jsc
    343 
    344 # Now build the shared library using only the exported jni entry point. This
    345 # will strip out any unused code from the entry point.
    346 include $(CLEAR_VARS)
    347 # if you need to make webcore huge (for debugging), enable this line
    348 #LOCAL_PRELINK_MODULE := false
    349 LOCAL_MODULE := libwebcore
    350 LOCAL_LDLIBS := $(WEBKIT_LDLIBS)
    351 LOCAL_SHARED_LIBRARIES := $(WEBKIT_SHARED_LIBRARIES)
    352 LOCAL_STATIC_LIBRARIES := libwebcore $(WEBKIT_STATIC_LIBRARIES)
    353 ifeq ($(JAVASCRIPT_ENGINE),jsc)
    354 LOCAL_STATIC_LIBRARIES += libjs
    355 endif
    356 LOCAL_LDFLAGS := -fvisibility=hidden
    357 LOCAL_CFLAGS := $(WEBKIT_CFLAGS)
    358 LOCAL_C_INCLUDES := $(WEBKIT_C_INCLUDES)
    359 LOCAL_PATH := $(BASE_PATH)
    360 LOCAL_SRC_FILES := \
    361 	WebKit/android/jni/WebCoreJniOnLoad.cpp
    362 # Do this dependency by hand. The reason we have to do this is because the
    363 # headers that this file pulls in are generated during the build of webcore.
    364 # We make all of our object files depend on those files so that they are built
    365 # before we try to compile the file.
    366 LOCAL_ADDITIONAL_DEPENDENCIES := $(filter %.h, $(WEBKIT_GENERATED_SOURCES))
    367 include $(BUILD_SHARED_LIBRARY)
    368 
    369 # Build the wds client
    370 include $(BASE_PATH)/WebKit/android/wds/client/Android.mk
    371 
    372 # Build the performance command line tool.
    373 include $(BASE_PATH)/WebKit/android/benchmark/Android.mk
    374 
    375 # Build the webkit merge tool.
    376 include $(BASE_PATH)/WebKitTools/android/webkitmerge/Android.mk
    377